raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'DrugBAN' object has no attribute 'n_output'
时间: 2023-10-10 15:11:19 浏览: 166
This error message indicates that you are trying to access an attribute called "n_output" that does not exist in an object of the "DrugBAN" class.
To fix this error, you need to either add the "n_output" attribute to the "DrugBAN" class or modify your code to use a different attribute that exists in the class. You may also need to check that you are instantiating the object correctly and passing the necessary arguments.
相关问题
in __getattr__ raise AttributeError( {} object has no attribute {} .format( AttributeError: Model object has no attribute gr
引用\[1\]和\[2\]是关于Python中使用win32com库操作Word文档的代码和错误信息。根据错误信息,这段代码中的`word.Document`应该改为`word.Documents`,因为`word.Documents`是Word应用程序对象的属性,而`word.Document`是不存在的属性。这个错误可以通过修改代码来解决。引用\[3\]是一个关于重新安装pytorch的参考链接,但与问题中的错误信息无关。
问题: AttributeError: Model object has no attribute gr
回答: 这个错误是由于在模型对象中没有名为"gr"的属性导致的。要解决这个错误,你需要检查你的代码并确保你正确地使用了模型对象的属性。可能是你在代码中错误地引用了"gr"属性,或者你的模型对象确实没有这个属性。请仔细检查你的代码并根据模型的文档或示例来正确使用属性。
#### 引用[.reference_title]
- *1* *2* [in __getattr__ raise AttributeError("%s.%s" % (self._username_, attr)) AttributeError: word.app](https://blog.csdn.net/qq_34648209/article/details/81912253)[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^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor](https://blog.csdn.net/weixin_41012399/article/details/125411726)[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^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
AttributeError: type object 'torch._C._profiler.ProfilerActivity' has no attribute 'FORWARD'
在 PyTorch 中,ProfilerActivity 类是用于记录分析神经网络的运行时间和内存使用情况的。该类包含了许多属性,其中包括 FORWARD、BACKWARD、CUDA、CPU 等等。这些属性表示了在分析过程中记录的不同类型的活动。
如果出现类似 "AttributeError: type object 'torch._C._profiler.ProfilerActivity' has no attribute 'FORWARD'" 的错误,这通常意味着你正在使用的版本的 PyTorch 不支持或者没有实现这个属性。这可能是因为你正在使用较旧的版本的 PyTorch,或者你正在使用一个不完全兼容的自定义版本。
如果你需要使用 FORWARD 属性,你可以尝试更新 PyTorch 到最新版本,或者查看 PyTorch 文档以了解 FORWARD 属性的替代方案。
阅读全文
相关推荐













