Tensorflow matmul尺寸

2024-10-01 17:29:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行下面的代码,最后一行抛出一个错误。你知道吗

weights = tf.Variable(
tf.truncated_normal([DATA_POINTS, hidden1_units],
                        stddev=1.0 / math.sqrt(float(DATA_POINTS))),
    name='weights')
biases = tf.Variable(tf.zeros([hidden1_units]),
                     name='biases')
hidden1 = tf.nn.relu(tf.matmul(images, weights) + biases)

错误:

InvalidArgumentError (see above for traceback): Matrix size-incompatible: In[0]: [96,336], In[1]: [366,128]

我不明白为什么我会犯这个错误。把[96366]矩阵乘以[366128]矩阵行吗?你知道吗

谢谢


Tags: 代码nameindatatf错误矩阵variable

热门问题