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
ModelZoo
stylegan3_pytorch
Commits
25d7d09b
Commit
25d7d09b
authored
Sep 03, 2024
by
mashun1
Browse files
Update bias_act.py
parent
451b975a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torch_utils/ops/bias_act.py
torch_utils/ops/bias_act.py
+2
-2
No files found.
torch_utils/ops/bias_act.py
View file @
25d7d09b
...
@@ -81,8 +81,8 @@ def bias_act(x, b=None, dim=1, act='linear', alpha=None, gain=None, clamp=None,
...
@@ -81,8 +81,8 @@ def bias_act(x, b=None, dim=1, act='linear', alpha=None, gain=None, clamp=None,
"""
"""
assert
isinstance
(
x
,
torch
.
Tensor
)
assert
isinstance
(
x
,
torch
.
Tensor
)
assert
impl
in
[
'ref'
,
'cuda'
]
assert
impl
in
[
'ref'
,
'cuda'
]
if
impl
==
'cuda'
and
x
.
device
.
type
==
'cuda'
and
_init
():
#
if impl == 'cuda' and x.device.type == 'cuda' and _init():
return
_bias_act_cuda
(
dim
=
dim
,
act
=
act
,
alpha
=
alpha
,
gain
=
gain
,
clamp
=
clamp
).
apply
(
x
,
b
)
#
return _bias_act_cuda(dim=dim, act=act, alpha=alpha, gain=gain, clamp=clamp).apply(x, b)
return
_bias_act_ref
(
x
=
x
,
b
=
b
,
dim
=
dim
,
act
=
act
,
alpha
=
alpha
,
gain
=
gain
,
clamp
=
clamp
)
return
_bias_act_ref
(
x
=
x
,
b
=
b
,
dim
=
dim
,
act
=
act
,
alpha
=
alpha
,
gain
=
gain
,
clamp
=
clamp
)
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
...
...
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