Tensorflow Code 示例

来源:互联网 发布:delphi sql 高亮 编辑:程序博客网 时间:2024/05/29 03:19

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]))

原创粉丝点击