raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'bool'.
时间: 2023-10-02 19:10:23 浏览: 141
在解决 "AttributeError: module 'tensorflow.compat.v1' has no attribute 'contrib'" 的问题中,可以尝试修改 seq_loss.py 文件。具体的解决方法是将 "self.numpy()" 改成 "self.cpu().numpy()"。在 tensor.py 文件中,可以找到第458行,即 def __array__(self, dtype=None): if dtype is None: return self.numpy() else: return self.numpy().astype(dtype, copy=False)。将其中的 "self.numpy()" 替换为 "self.cpu().numpy()"。
另外,针对 "raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'bool'" 的问题,这个错误发生在 "C:\anaconda3\envs\openvino\lib\site-packages\openvino\tools\mo\middle\passes\convert_data_type.py" 文件的第43行。这个错误的原因是 numpy 模块中没有名为 'bool' 的属性。
为了解决这个问题,可以尝试更新 numpy 模块或者使用其他替代方法来处理数据类型转换。你可以检查一下你的 numpy 模块的版本,确保它是最新的。如果是最新的版本,那么可能需要查找其他可用的数据类型转换方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [AttributeError: module 'tensorflow.compat.v1' has no attribute '](https://download.csdn.net/download/qq_38766019/86272235)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [问题解决之 TypeError: can‘t convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to](https://blog.csdn.net/qq_39220334/article/details/122892707)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Yolov5由升级引起的报错:AttributeError: module ‘numpy‘ has no attribute ‘bool‘.](https://blog.csdn.net/tanmx219/article/details/130779085)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]