Tensorflow Code 示例

1.张量乘法

def f1(X,w):
    c = tf.einsum('ijl,lk->ijk', X, w) 
    print c.shape
    return c


def output(self, x):
    batch_size = tf.shape(x)[0]
    x = tf.reshape(x, [-1, self._shape[0]])
    linear = tf.matmul(x, self._W)
    return self._activation(tf.reshape(linear, [batch_size, -1]))

猜你喜欢

转载自blog.csdn.net/mzg12345678/article/details/78319521