RuntimeError: __class__ not set defining ‘‘ as <class>. Was __classcell__ propagated to type.__new_

问题描述

报错提示类中不能有super的方法。 

问题:

RuntimeError: __class__ not set defining 'AttentionModelFixed' as . Was __classcell__ propagated to type.__new__?

报错代码: 

class AttentionModelFixed(NamedTuple):

    def __getitem__(self, key):
        if xxxx:
            return AttentionModelFixed(xxx)            )
        return super(AttentionModelFixed, self).__getitem__(key)

 


解决方案:

启动正确的虚拟环境。

你可能感兴趣的:(人工智能,算法,django,python)