Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
apex
Commits
35a85789
Commit
35a85789
authored
Sep 03, 2019
by
ptrblck
Committed by
mcarilli
Sep 03, 2019
Browse files
remove deprecated backaned.FunctionBackend calls (#466)
parent
53eae198
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
apex/amp/utils.py
apex/amp/utils.py
+3
-9
No files found.
apex/amp/utils.py
View file @
35a85789
...
@@ -129,25 +129,19 @@ def as_inplace(fns):
...
@@ -129,25 +129,19 @@ def as_inplace(fns):
yield
x
+
'_'
yield
x
+
'_'
def
has_func
(
mod
,
fn
):
def
has_func
(
mod
,
fn
):
if
isinstance
(
mod
,
torch
.
nn
.
backends
.
backend
.
FunctionBackend
):
if
isinstance
(
mod
,
dict
):
return
fn
in
mod
.
function_classes
elif
isinstance
(
mod
,
dict
):
return
fn
in
mod
return
fn
in
mod
else
:
else
:
return
hasattr
(
mod
,
fn
)
return
hasattr
(
mod
,
fn
)
def
get_func
(
mod
,
fn
):
def
get_func
(
mod
,
fn
):
if
isinstance
(
mod
,
torch
.
nn
.
backends
.
backend
.
FunctionBackend
):
if
isinstance
(
mod
,
dict
):
return
mod
.
function_classes
[
fn
]
elif
isinstance
(
mod
,
dict
):
return
mod
[
fn
]
return
mod
[
fn
]
else
:
else
:
return
getattr
(
mod
,
fn
)
return
getattr
(
mod
,
fn
)
def
set_func
(
mod
,
fn
,
new_fn
):
def
set_func
(
mod
,
fn
,
new_fn
):
if
isinstance
(
mod
,
torch
.
nn
.
backends
.
backend
.
FunctionBackend
):
if
isinstance
(
mod
,
dict
):
mod
.
function_classes
[
fn
]
=
new_fn
elif
isinstance
(
mod
,
dict
):
mod
[
fn
]
=
new_fn
mod
[
fn
]
=
new_fn
else
:
else
:
setattr
(
mod
,
fn
,
new_fn
)
setattr
(
mod
,
fn
,
new_fn
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment