首页 > 解决方案 > make_tensor_proto raise ValueError("None values not supported.")

问题描述

我正面临这个例外:

make_tensor_proto 中的文件“/opt/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py”,第 445 行引发 ValueError(“不支持无值。”)

ValueError:不支持任何值。

当我执行这部分代码时:

        with tf.variable_scope('{}_discriminator'.format(name), reuse=True):
            self.input_x = input_x


            #self.input_sequence =  tf.placeholder(dtype=tf.float32, shape=[None, None])
            self.target_label = tf.placeholder(dtype=tf.int32, shape=[None, output_size])
            self.target_weights = tf.placeholder(dtype=tf.float32, shape=[None])

            self.z = z

            # now declare the weights connecting the input to the hidden layer
            self.W1 = tf.Variable(tf.random_normal([input_size, hidden_layer1], stddev=0.01), name='W1')
            self.b1 = tf.Variable(tf.random_normal([hidden_layer1]), name='b1')

            # and the weights connecting the hidden layer to the output layer
            self.W2 = tf.Variable(tf.random_normal([hidden_layer1, output_size], stddev=0.01), name='W2')
            self.b2 = tf.Variable(tf.random_normal([output_size]), name='b2')
             

            self.hidden_out = tf.add(tf.matmul(self.input_x, self.W1), self.b1)
            self.hidden_out = tf.nn.relu(self.hidden_out)

            self.output = tf.nn.softmax(tf.add(tf.matmul(self.hidden_out, self.W2), self.b2))

标签: tensorflow

解决方案


推荐阅读