diff --git a/es_distributed/policies.py b/es_distributed/policies.py index b3cfcbd..3e46d38 100644 --- a/es_distributed/policies.py +++ b/es_distributed/policies.py @@ -181,10 +181,10 @@ def _make_net(self, o): aidx_na = bins(x, adim, len(acvals_k), 'out') # values in [0, k-1] a = tf.gather_nd( acvals_ak, - tf.concat(2, [ + tf.concat([ tf.tile(np.arange(adim)[None, :, None], [tf.shape(aidx_na)[0], 1, 1]), tf.expand_dims(aidx_na, -1) - ]) # (n,a,2) + ], 2) # (n,a,2) ) # (n,a) elif ac_bin_mode == 'continuous': a = U.dense(x, adim, 'out', U.normc_initializer(0.01)) diff --git a/es_distributed/tf_util.py b/es_distributed/tf_util.py index 4eebf6c..52a7191 100644 --- a/es_distributed/tf_util.py +++ b/es_distributed/tf_util.py @@ -28,7 +28,7 @@ def max(x, axis=None, keepdims=False): def min(x, axis=None, keepdims=False): return tf.reduce_min(x, reduction_indices=None if axis is None else [axis], keep_dims = keepdims) def concatenate(arrs, axis=0): - return tf.concat(axis, arrs) + return tf.concat(arrs, axis) def argmax(x, axis=None): return tf.argmax(x, dimension=axis) @@ -179,8 +179,8 @@ def intprod(x): def flatgrad(loss, var_list): grads = tf.gradients(loss, var_list) - return tf.concat(0, [tf.reshape(grad, [numel(v)]) - for (v, grad) in zip(var_list, grads)]) + return tf.concat([tf.reshape(grad, [numel(v)]) + for (v, grad) in zip(var_list, grads)], 0) class SetFromFlat(object): def __init__(self, var_list, dtype=tf.float32): @@ -202,7 +202,7 @@ def __call__(self, theta): class GetFlat(object): def __init__(self, var_list): - self.op = tf.concat(0, [tf.reshape(v, [numel(v)]) for v in var_list]) + self.op = tf.concat([tf.reshape(v, [numel(v)]) for v in var_list], 0) def __call__(self): return get_session().run(self.op)