AttributeError: 'NoneType' object has no attribute 'cfg'
时间: 2023-08-22 07:08:49 浏览: 100
引用中提到的解决方案是在访问engine之前添加以下两行代码:last_layer = network.get_layer(network.num_layers - 1)和network.mark_output(last_layer.get_output(0))。这样可以确保所需的对象被正确赋值,避免出现'NoneType' object has no attribute 'cfg'的错误。中的代码中,如果没有找到匹配的元素,调用group()方法就会出错。因此,使用正则表达式匹配时,需要先检查是否成功匹配到了元素,再进行相应的操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [已解决AttributeError: ‘NoneType‘ object has no attribute ‘group](https://blog.csdn.net/yuan2019035055/article/details/125667357)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [AttributeError: ‘NoneType’ object has no attribute ‘create_execution_context’](https://blog.csdn.net/m0_59249795/article/details/124210102)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [python错误笔记:AttributeError: ‘NoneType‘ object has no attribute ‘group](https://blog.csdn.net/fan13938409755/article/details/125774878)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文