TypeError: load_data() got an unexpected keyword argument 'one_hot'
时间: 2023-11-20 18:53:41 浏览: 95
根据引用提供的解决办法,这个错误是因为在load_data()函数中使用了一个不被支持的关键字参数'one_hot'。如果你使用的是Python3,那么不需要使用'one_hot'参数,直接将其从函数调用中删除即可。如果你使用的是Python2,那么你需要检查你的代码是否正确地使用了'one_hot'参数。
代码示例:
```python
# Python3
(x_train, y_train), (x_test, y_test) = mnist.load_data()
```
```python
# Python2
(x_train, y_train), (x_test, y_test) = mnist.load_data(one_hot=True)
```
相关问题
TypeError: load() got an unexpected keyword argument 'scale'
TypeError: load() got an unexpected keyword argument 'scale' 是一个错误提示,它表示在调用load()函数时传入了一个名为'scale'的关键字参数,但该函数并不支持这个参数。
load()函数通常用于加载模型或数据。根据错误提示,可能是在调用load()函数时传入了一个错误的参数。要解决这个错误,可以检查代码中load()函数的调用,并确保传入的参数与函数定义一致。
如果你能提供更多的上下文或代码片段,我可以给出更具体的帮助。
TypeError: __init__() got an unexpected keyword argument 'degradation'
根据提供的引用内容,出现了两个不同的错误:TypeError: __init__() got an unexpected keyword argument 'autocompletion' 和 TypeError: init() got an unexpected keyword argument 'indices'。这两个错误都是因为在调用函数时传递了不支持的参数导致的。
如果出现了类似的错误TypeError: __init__() got an unexpected keyword argument 'degradation',则说明在调用某个函数时传递了不支持的参数'degradation'。解决这个问题的方法是检查代码中是否有拼写错误或者参数名错误,并确保传递的参数是函数支持的。
如果确定传递的参数是正确的,但仍然出现了这个错误,则可能是因为使用的库版本过低或者过高导致的。可以尝试更新或降低库的版本来解决这个问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)