Spaces:
Paused
Paused
Update videoretalking/third_part/GPEN/face_model/op/fused_act.py
Browse files
videoretalking/third_part/GPEN/face_model/op/fused_act.py
CHANGED
@@ -19,7 +19,7 @@ from torch.utils.cpp_extension import load, _import_module_from_library
|
|
19 |
# )
|
20 |
|
21 |
|
22 |
-
fused = _import_module_from_library('fused', '/tmp/torch_extensions/fused', True)
|
23 |
|
24 |
|
25 |
class FusedLeakyReLUFunctionBackward(Function):
|
@@ -90,7 +90,7 @@ class FusedLeakyReLU(nn.Module):
|
|
90 |
|
91 |
|
92 |
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5, device='cpu'):
|
93 |
-
if platform.system() == 'Linux' and torch.cuda.is_available() and device != 'cpu':
|
94 |
-
|
95 |
-
else:
|
96 |
-
|
|
|
19 |
# )
|
20 |
|
21 |
|
22 |
+
# fused = _import_module_from_library('fused', '/tmp/torch_extensions/fused', True)
|
23 |
|
24 |
|
25 |
class FusedLeakyReLUFunctionBackward(Function):
|
|
|
90 |
|
91 |
|
92 |
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5, device='cpu'):
|
93 |
+
# if platform.system() == 'Linux' and torch.cuda.is_available() and device != 'cpu':
|
94 |
+
# return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
|
95 |
+
# else:
|
96 |
+
return scale * F.leaky_relu(input + bias.view((1, -1)+(1,)*(len(input.shape)-2)), negative_slope=negative_slope)
|