__init__() got multiple values for argument 'units'
时间: 2023-09-25 17:14:29 浏览: 187
这个错误是因为在创建ResidualBlock类的实例时,传递了多个值给了'units'参数。根据引用\[1\]中的代码,ResidualBlock类的构造函数定义如下:
```python
def __init__( self, n_layers, n_neurons, **kwargs):
super().__init__(**kwargs)
self.hidden = \[keras.layers.Dense(n_neurons, activation="elu", kernel_initializer="he_normal") for _ in range(n_layers)\]
```
在创建block1实例时,传递了两个参数2和30,这两个参数分别被赋值给了'n_layers'和'n_neurons'。所以,如果你在创建block1实例时传递了额外的参数,就会出现这个错误。请检查你的代码,确保只传递了两个参数给block1实例的构造函数。
#### 引用[.reference_title]
- *1* *2* *3* [12 _Custom Models and Training with TensorFlow_tensor_ structure_Activation_Layers_huber_Loss_Metric](https://blog.csdn.net/Linli522362242/article/details/107294292)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文