MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / PReLU

Function PReLU

tensorpack/models/nonlin.py:42–65  ·  view source on GitHub ↗

Parameterized ReLU as in the paper `Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification `_. Args: x (tf.Tensor): input init (float): initial value for the learnable slope. name (str): d

(x, init=0.001, name=None)

Source from the content-addressed store, hash-verified

40@layer_register()
41@disable_autograph()
42def PReLU(x, init=0.001, name=None):
43 """
44 Parameterized ReLU as in the paper `Delving Deep into Rectifiers: Surpassing
45 Human-Level Performance on ImageNet Classification
46 <http://arxiv.org/abs/1502.01852>`_.
47
48 Args:
49 x (tf.Tensor): input
50 init (float): initial value for the learnable slope.
51 name (str): deprecated argument. Don&#x27;t use
52
53 Variable Names:
54
55 * ``alpha``: learnable slope.
56 """
57 if name is not None:
58 log_deprecated("PReLU(name=...)", "The output tensor will be named `output`.")
59 init = tfv1.constant_initializer(init)
60 alpha = tfv1.get_variable('alpha', [], initializer=init)
61 x = ((1 + alpha) * x + (1 - alpha) * tf.abs(x))
62 ret = tf.multiply(x, 0.5, name=name or None)
63
64 ret.variables = VariableHolder(alpha=alpha)
65 return ret
66
67
68@layer_register(use_scope=None)

Callers 2

_get_NN_predictionMethod · 0.85
_get_DQN_predictionMethod · 0.85

Calls 3

log_deprecatedFunction · 0.85
VariableHolderClass · 0.85
get_variableMethod · 0.80

Tested by

no test coverage detected