__init__() got an unexpected keyword argument 'crop_size'
时间: 2023-09-23 11:06:12 浏览: 59
这个错误通常是因为您在调用 `__init__()` 方法时传递了一个名为 `crop_size` 的关键字参数,但该类的 `__init__()` 方法并没有定义接受该参数。
请确保您在实例化类时使用正确的参数和参数名称。您可以查看类的定义,了解它的构造函数接受哪些参数,并相应地进行调整。如果您不确定如何正确使用该类,请参考文档或示例代码来获取更多信息。
相关问题
__init__() got an unexpected keyword argument
__init__()方法是Python中的一个特殊方法,用于初始化对象的属性。当在创建对象时,传递给__init__()方法的参数与定义的参数不匹配时,就会出现"__init__() got an unexpected keyword argument"的错误。
这个错误通常发生在以下情况下:
1. 定义了一个类,并在__init__()方法中定义了一些参数,但在创建对象时传递了不匹配的参数。
2. 在子类中重写了父类的__init__()方法,并且子类的参数与父类的参数不匹配。
解决这个问题的方法是检查传递给__init__()方法的参数是否与定义的参数一致。确保参数名称和数量都正确,并且没有多余的参数。
__init__() got an unexpected keyword argument 'vacab_size
根据提供的引用内容,我们可以得知出现了一个错误提示:__init__() got an unexpected keyword argument 'size'。这个错误提示通常是由于在调用某个函数时,传入了该函数不支持的参数。因此,出现这个错误提示的原因可能是在调用某个函数时,传入了一个名为'size'的参数,但该函数并不支持这个参数。
而与此类似的错误提示还有:__init__() got an unexpected keyword argument 'codec'。这个错误提示通常是由于在使用pdfminer库时,传入了一个名为'codec'的参数,但该库并不支持这个参数。解决这个问题的方法是将'codec'参数改为'codecname'参数。
因此,我们可以猜测,__init__() got an unexpected keyword argument 'vacab_size'也是类似的错误提示,可能是在调用某个函数时,传入了一个名为'vacab_size'的参数,但该函数并不支持这个参数。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![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)