类型错误:无法将“4”解释为数据类型

Him*_*aur 4 python numpy forward neural-network conv-neural-network

我正在尝试学习神经网络。以下是代码。我收到错误“TypeError:无法将“4”解释为数据类型”任何人都可以帮我识别错误吗?

import numpy as np

inputs = [[1, 2 , 3, 2.5],
      [2, 5, 9, 10],
      [5, 1, 2, 7],
      [3, 2, 1, 4],
      [1,1.5, 7, 8]]

class layer_dense:
      def __init__ (self, n_inputs, m_neurons):
        self.weights= np.random.rand(n_inputs, m_neurons)
        self.biases= np.zeros(1, m_neurons)
     def forward (self, inputs):
        self.output= np.dot(inputs, self.weights)+self.biases
    
layer1 = layer_dense(4, 4)
layer2 = layer_dense(5,2)

layer1.forward(inputs)
layer2.forward(layer1.output)
print(layer2.output)
Run Code Online (Sandbox Code Playgroud)

Nir*_*baz 6

每个功能描述

numpy.zeros(shape, dtype=float, order='C')
Run Code Online (Sandbox Code Playgroud)

第二个参数应该是数据类型而不是数字