【发布时间】:2021-10-27 09:10:58
【问题描述】:
例如,
# x is a tensor
print(x)
[1, 0]
# after repeating it
print(x)
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
TensorFlow 1.10 中没有 tf.repeat,那么是否有最好的可替换方式来实现它?
【问题讨论】:
-
您可能还应该报告您是如何产生
x的以及您的边界条件是什么......例如,这个任务在 NumPy 中非常简单......如果没有额外的信息,它会很简单建议使用它,然后来回移动你想要的任何对象类型。 -
@norok2 但是
tf 1.10中没有tensor.numpy(),并且在注册会话时不能使用tensor.eval(),所以可能很难使用numpy来解决这个问题。
标签: python tensorflow tensor