简体   繁体   English

Tensorflow:形状必须为5级,但'conv3D'为1级

[英]Tensorflow: shape must be rank 5 but is rank 1 for 'conv3D'

import tensorflow as tf
import numpy as tf
if __name__ == '__main__':
    with tf.Graph().as_default():
        inputs = np.zeros([5,10,10,10,3])
        print(inputs)
        outputs = tf.nn.conv3d(
            input=inputs,
            filter=[5, 5, 5, 3, 8],  # filter:[filter_depth, filter_height, file_width, in_channels, out_channels]
            strides=[1, 4, 4, 4, 1],
            padding='SAME'
        )
        # outputs = get_model(inputs, True)
        print(outputs)

When I run the plain code in pycharm, it return the error information: 当我在pycharm中运行普通代码时,它返回错误信息:

ValueError: shape must be rank 5 but is rank 1 for 'conv3D'(op: 'Conv3D') with input shapes: [5,10,10,10,3],[5].

引用链接: https : //www.tensorflow.org/api_docs/python/tf/nn/conv3d过滤器应该是张量,具体来说是一个变量(可训练),因此将filter=[5, 5, 5, 3, 8] 5,5,5 filter=[5, 5, 5, 3, 8] filter=tf.get_variable(shape=[5, 5, 5, 3, 8], dtype=tf.float64, name='filter')然后运行它并可以正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 形状必须是等级 4,但对于 '{{node Conv2D}} 是等级 2 - Shape must be rank 4 but is rank 2 for '{{node Conv2D}} Tensorflow Shape必须为1级但为2级 - Tensorflow Shape must be rank 1 but is rank 2 "ValueError:形状必须为 4 级,但对于 '{{node Conv2D_5}} 为 0 级,tf.nn.conv2d" - ValueError: Shape must be rank 4 but is rank 0 for '{{node Conv2D_5}} , tf.nn.conv2d Tensorflow: ValueError: Shape must be rank 4 but is rank 5 - Tensorflow: ValueError: Shape must be rank 4 but is rank 5 Tensorflow:ValueError:Shape必须是等级2,但是等级3 - Tensorflow : ValueError: Shape must be rank 2 but is rank 3 TensorFlow 推荐者 - ValueError:形状必须为 2 级,但为 3 级 - TensorFlow Recommenders - ValueError: Shape must be rank 2 but is rank 3 Tensorflow 2.0 Conv3D input_shape 问题 - Tensorflow 2.0 Conv3D input_shape Problem Tensorflow - ValueError:Shape必须为1,但对于'ParseExample / ParseExample'为0 - Tensorflow - ValueError: Shape must be rank 1 but is rank 0 for 'ParseExample/ParseExample' Tensorflow错误:形状必须为0级,但对于'cond_1 / Switch'为1级 - Tensorflow error: Shape must be rank 0 but is rank 1 for 'cond_1/Switch' Tensorflow:optimizer.minimize()-“ ValueError:形状必须为0级,但为1级 - Tensorflow: optimizer.minimize() - "ValueError: Shape must be rank 0 but is rank 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM