本文整理汇总了Python中chainer.functions.elu方法的典型用法代码示例。如果您正苦于以下问题:Python functions.elu方法的具体用法?Python functions.elu怎么用?Python functions.elu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chainer.functions
的用法示例。
在下文中一共展示了functions.elu方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import elu [as 别名]
def __init__(self,
in_channels,
out_channels):
super(LwopEncoderFinalBlock, self).__init__()
with self.init_scope():
self.pre_conv = conv1x1_block(
in_channels=in_channels,
out_channels=out_channels,
use_bias=True,
use_bn=False)
self.body = SimpleSequential()
with self.body.init_scope():
for i in range(3):
setattr(self.body, "block{}".format(i + 1), dwsconv3x3_block(
in_channels=out_channels,
out_channels=out_channels,
use_bn=False,
dw_activation=(lambda: F.elu),
pw_activation=(lambda: F.elu)))
self.post_conv = conv3x3_block(
in_channels=out_channels,
out_channels=out_channels,
use_bias=True,
use_bn=False)
示例2: forward
# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import elu [as 别名]
def forward(self, inputs):
# Input shape: [batch_size, num_nodes, feature_dims]
batch_size, num_nodes = inputs.shape[:2]
inputs = inputs.reshape(batch_size * num_nodes, -1)
# New shape: [batch_size * num_nodes, feature_dims]
x = F.elu(self.fc1(inputs))
x = F.dropout(x, self.dropout_prob)
x = F.elu(self.fc2(x))
x = self.bn(x)
return x.reshape(batch_size, num_nodes, -1)
示例3: make_q_func
# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import elu [as 别名]
def make_q_func(self, env):
n_hidden_channels = 10
return StatelessRecurrentSequential(
L.Linear(env.observation_space.low.size, n_hidden_channels),
F.elu,
L.NStepRNNTanh(1, n_hidden_channels, n_hidden_channels, 0),
L.Linear(n_hidden_channels, env.action_space.n),
DiscreteActionValue,
)
示例4: forward
# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import elu [as 别名]
def forward(self, inputs, device):
x, = inputs
return functions.elu(x, alpha=self.alpha),
示例5: __call__
# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import elu [as 别名]
def __call__(self, x, test=False):
h = self.b1(F.elu(self.c1(x)), test=test)
h = self.b2(F.elu(self.c2(h)), test=test)
h = self.b3(F.elu(self.c3(h)), test=test)
h = self.r1(h, test=test)
h = self.r2(h, test=test)
h = self.r3(h, test=test)
h = self.r4(h, test=test)
h = self.r5(h, test=test)
h = self.b4(F.elu(self.d1(h)), test=test)
h = self.b5(F.elu(self.d2(h)), test=test)
y = self.d3(h)
return (F.tanh(y)+1)*127.5
示例6: selu
# 需要导入模块: from chainer import functions [as 别名]
# 或者: from chainer.functions import elu [as 别名]
def selu(x):
alpha = float(1.6732632423543772848170429916717)
scale = float(1.0507009873554804934193349852946)
return scale * F.elu(x, alpha = alpha)