为什么我会收到一个名为“使用序列设置数组元素”的错误?

问题描述 投票:0回答:1

我正在学习通过视频对中子进行编码,即使我的代码与教程中的代码相同,但还是出现错误,我做错了什么?

inputs = [[1, 2, 3, 2.5],
          [2.0, 5.0, -1.0, 2.0],
          [-1,5, 2.7, 3.3, -0.8]]
weights = [[0.2, 0.8, -0.5, 1.0], 
           [0.5, -0.91, 0.26, -0.5], 
           [-0.26, -0.27, 0.17, 0.87]]
biases = [2, 3, 0.5]

output = np.dot(inputs, np.array(weights).T) + biases
python deep-learning neural-network
1个回答
2
投票

-1,5
应该是
-1.5
(在
inputs
数组中):

inputs = [[1, 2, 3, 2.5], [2.0, 5.0, -1.0, 2.0], [-1.5, 2.7, 3.3, -0.8]]
weights = [[0.2, 0.8, -0.5, 1.0], [0.5, -0.91, 0.26, -0.5], [-0.26, -0.27, 0.17, 0.87]]
biases = [2, 3, 0.5]

output = np.dot(inputs, np.array(weights).T) + biases
print(output)

打印:

[[ 4.8    1.21   2.385]
 [ 8.9   -1.81   0.2  ]
 [ 1.41   1.051  0.026]]
© www.soinside.com 2019 - 2024. All rights reserved.