报错:AttributeError: module ‘torch‘ has no attribute ‘_six‘
报错:AttributeError: module ‘torch‘ has no attribute ‘_six‘
2024/3/27

重构代码的时候发现使用的模板数据读取时报错,查资料_six是用于处理不同 Python 版本或其他库版本之间的差异,以确保在不同环境下代码的正确性和可用性。
找到这个位置if isinstance(root, torch._six.string_classes):,发现是在判断是否为str类型,所以将torch._six.string_classes改为str,这样就没报错了。


浙公网安备 33010602011771号