naf_ir.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:gymexperiments 作者: tambetm 项目源码 文件源码
def createLayers():
  x = Input(shape=env.observation_space.shape, name='x')
  u = Input(shape=env.action_space.shape, name='u')
  if args.batch_norm:
    h = BatchNormalization()(x)
  else:
    h = x
  for i in xrange(args.layers):
    h = Dense(args.hidden_size, activation=args.activation, name='h'+str(i+1),
        kernel_constraint=W_constraint, kernel_regularizer=kernel_regularizer)(h)
    if args.batch_norm and i != args.layers - 1:
      h = BatchNormalization()(h)
  v = Dense(1, name='v', kernel_constraint=W_constraint, \
    kernel_regularizer=kernel_regularizer)(h)
  m = Dense(num_actuators, name='m', kernel_constraint=W_constraint, \
    kernel_regularizer=kernel_regularizer)(h)
  l0 = Dense(num_actuators * (num_actuators + 1)/2, name='l0',
             kernel_constraint=W_constraint, kernel_regularizer=kernel_regularizer)(h)
  l = Lambda(_L, output_shape=(num_actuators, num_actuators), name='l')(l0)
  p = Lambda(_P, output_shape=(num_actuators, num_actuators), name='p')(l)
  #a = merge([m, p, u], mode=_A, output_shape=(None, num_actuators,), name="a")
  a = merge([m, p, u], mode=_A, output_shape=(num_actuators,), name="a")
  #q = merge([v, a], mode=_Q, output_shape=(None, num_actuators,), name="q")
  q = add([v, a], name="q")
  return x, u, m, v, q, p, a
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号