代码之家  ›  专栏  ›  技术社区  ›  j35t3r

我可以用不同大小的图片使用“tf.layers.conv3d”吗?使用“None”而不是fix整数?

  •  1
  • j35t3r  · 技术社区  · 7 年前

    以下脚本不起作用:

    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'

    0 回复  |  直到 7 年前
    推荐文章