Deepquantiles TypeError:super(type,obj):obj必须是类型的实例或子类型吗?

时间:2019-11-21 02:47:37

标签: python keras

为什么会出现此错误?

TypeError: super(type, obj): obj must be an instance or subtype of type

这是我的models.py文件

class Lambda(Layer):
    @interfaces.legacy_lambda_support
    def __init__(self, function, output_shape=None,
                 mask=None, arguments=None, **kwargs):
        super(Lambda, self).__init__(**kwargs)
        self.function = function
        self.arguments = arguments if arguments else {}
        if mask is not None:
            self.supports_masking = True
        self.mask = mask

        if output_shape is None:
            self._output_shape = None
        elif isinstance(output_shape, (tuple, list)):
            self._output_shape = tuple(output_shape)
        else:
            if not callable(output_shape):
                raise TypeError('In Lambda, `output_shape` '
                                'must be a list, a tuple, or a function.')
            self._output_shape = output_shape

    def call(self, inputs, mask=None):
        arguments = self.arguments
        if has_arg(self.function, 'mask'):
            arguments['mask'] = mask
        return self.function(inputs, **arguments)

完整的错误消息在这里,

    647     def call(self, inputs, mask=None):
    648         arguments = self.arguments
--> 649         if has_arg(self.function, 'mask'):
    650             arguments['mask'] = mask
    651         return self.function(inputs, **arguments)

TypeError: super(type, obj): obj must be an instance or subtype of type

有人可以向我解释错误的原因以及如何解决吗?如果需要,我愿意提供更多信息。

0 个答案:

没有答案