使用Tensorflow中的填充功能重复矩阵的列

时间:2017-01-19 08:14:32

标签: tensorflow concatenation tile

我写了以下函数:

Private Sub TextBox5_Change()
    ActiveSheet.ListObjects("nameofthetable").Range.AutoFilter Field:=3, Criteria1:=TextBox5.Value
End Sub

这个想法是A是一个比B更宽的矩阵。我想通过重复自身来扩大B(当A的行长不完全除以B的那个时也应该工作。)

如果你运行上面的代码,你会得到:

A = tf.constant([[1,2,3,4,4,5,6,7,2],[4,5,6,6,4,5,6,7,2],[6,7,8,9,4,5,6,7,2]])
B = tf.constant([[19,15],
             [18,14],
             [17,13]])

diff = A.get_shape()[1] - B.get_shape()[1]

Bt = tf.transpose(B)
for idx in range(diff):
    col = tf.gather_nd(Bt, [[idx]])
    Bt = tf.concat(0, [Bt, col])

result = tf.transpose(Bt)

with tf.Session() as sess:
    res = sess.run(result)
    print(res)

关于如何通过使用张量流函数来实现这一点的任何想法?

0 个答案:

没有答案