假设我们有一个tensorflow占位符,如下所示:
x = tf.placeholder(tf.float32, (2, 2, 3 ..., 1))我想创建另一个张量y,它的形状是as x,除了第一维和第二维,这是x的三倍。
y = tf.placeholder(tf.float32, (6, 6, 3, ..., 1))x的形状不是预先定义的,所以我想做的是如下所示:
y = tf.placeholder(tf.float32, (x.shape[0]* 3, x.shape[1] * 3, remaining_are_the_same_as_x_shape))你能告诉我如何在丹索弗洛做这件事吗?
发布于 2018-09-03 07:39:36
这个怎么样?
x = tf.placeholder(tf.float32, (2, 2, 3 , 1))
shape = x.get_shape().as_list()
shape[0] = shape[0] * 3
shape[1] = shape[1] * 3
y = tf.placeholder(tf.float32, shape=shape)
shape = y.get_shape().as_list()
print(shape)6、6、3、1
https://stackoverflow.com/questions/52142344
复制相似问题