可以使用具有不同图像尺寸的`tf.layers.conv3d`吗?使用“无”而不是固定整数?

时间:2018-10-11 19:15:01

标签: python python-2.7 tensorflow convolution

以下脚本不起作用:

import tensorflow as tf
import numpy as np 
input = np.ones((1,1, 3,50,50))
t_ph = tf.placeholder(dtype=tf.float32, shape=(1,1,3,None,50), name='input')
# t_ph = tf.placeholder(dtype=tf.float32, shape=(1,1,3,50,50), name='input')
t_conv3d = tf.layers.conv3d(
    inputs=t_ph,
    filters=48,
    kernel_size=[3,3,3],
    data_format='channels_first',
    activation=tf.nn.relu
)

with tf.Session() as sess: 
    sess.run([tf.local_variables_initializer(), tf.global_variables_initializer()])

    should_fail = t_conv3d.eval(feed_dict={t_ph: input})
    print "should_fail ", should_fail.shape

错误:TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'

是否可以使用参数'None'而不是整数的conv3d?

0 个答案:

没有答案