本文整理汇总了Python中chainer.FunctionSet.conv5_2_2方法的典型用法代码示例。如果您正苦于以下问题:Python FunctionSet.conv5_2_2方法的具体用法?Python FunctionSet.conv5_2_2怎么用?Python FunctionSet.conv5_2_2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chainer.FunctionSet
的用法示例。
在下文中一共展示了FunctionSet.conv5_2_2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from chainer import FunctionSet [as 别名]
# 或者: from chainer.FunctionSet import conv5_2_2 [as 别名]
#.........这里部分代码省略.........
conv4_27_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_28_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_28_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_28_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_29_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_29_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_29_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_30_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_30_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_30_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_31_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_31_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_31_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_32_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_32_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_32_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_33_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_33_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_33_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_34_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_34_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_34_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_35_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_35_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_35_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv4_36_1=F.Convolution2D(1024, 256, 1, wscale=w, stride=1),
conv4_36_2=F.Convolution2D(256, 256, 3, wscale=w, stride=1, pad=1),
conv4_36_3=F.Convolution2D(256, 1024, 1, wscale=w, stride=1),
conv5_1_1=F.Convolution2D(1024, 512, 1, wscale=w, stride=2),
conv5_1_2=F.Convolution2D(512, 512, 3, wscale=w, stride=1, pad=1),
conv5_1_3=F.Convolution2D(512, 2048, 1, wscale=w, stride=1),
conv5_1_ex=F.Convolution2D(1024, 2048, 1, wscale=w, stride=2),
conv5_2_1=F.Convolution2D(2048, 512, 1, wscale=w, stride=1),
conv5_2_2=F.Convolution2D(512, 512, 3, wscale=w, stride=1, pad=1),
conv5_2_3=F.Convolution2D(512, 2048, 1, wscale=w, stride=1),
conv5_3_1=F.Convolution2D(2048, 512, 1, wscale=w, stride=1),
conv5_3_2=F.Convolution2D(512, 512, 3, wscale=w, stride=1, pad=1),
conv5_3_3=F.Convolution2D(512, 2048, 1, wscale=w, stride=1),
q_value=F.Linear(2048, self.num_of_actions,
initialW=np.zeros((self.num_of_actions, 2048),
dtype=np.float32))
)
self.model_target = copy.deepcopy(self.model)
print "Initizlizing Optimizer"
self.optimizer = optimizers.Adam()
self.optimizer.setup(self.model.collect_parameters())
def forward(self, state, action, Reward, state_dash, episode_end):
num_of_batch = state.shape[0]
s = Variable(state)
s_dash = Variable(state_dash)
Q = self.Q_func(s) # Get Q-value
# Generate Target Signals
tmp = self.Q_func_target(s_dash) # Q(s',*)
tmp = list(map(np.max, tmp.data.get())) # max_a Q(s',a)
max_Q_dash = np.asanyarray(tmp, dtype=np.float32)
target = np.asanyarray(Q.data.get(), dtype=np.float32)
for i in xrange(num_of_batch):
if not episode_end[i][0]:
tmp_ = np.sign(Reward[i]) + self.gamma * max_Q_dash[i]
else: