import tensorflow as tf

                flat_shape = (np.prod(shape[:-1]), shape[-1])
            else:
                raise NotImplementedError
            a = np.random.normal(0.0, 1.0, flat_shape)
            u, _, v = np.linalg.svd(a, full_matrices=False)
            q = u if u.shape == flat_shape else v  # pick the one with the correct shape
            q = q.reshape(shape)
            return (scale * q[:shape[0], :shape[1]]).astype(np.float32)
        return _ortho_init
    ####################################################

    def _build_anet(self, name, trainable):
        # 定義Actor 新舊的網路模型
        with tf.variable_scope(name):
            c0 = tf.cast(self.tfs, tf.float32) / 255.
            c1 = tf.nn.relu(self.conv(c0,
                                      'c1',
                                      nf=32,
                                      rf=8,
                                      stride=4,
                                      init_scale=np.sqrt(2)))
            c2 = tf.nn.relu(self.conv(c1,
                                      'c2',
                                      nf=64,
                                      rf=4,
                                      stride=2,
