错误:无法在Module .__ init __()调用之前分配模块,即使在使用super(DecoderRNN,self).__ init __()之后也无法分配模块

时间:2018-07-31 20:20:26

标签: python python-3.x deep-learning pytorch

我收到以下错误:

class Validator {
  constructor (body) {
    this._body = body;
  }
  
  selector(str) {
    this._selector = str;
    return this;
  }
  
  minLength(num) {
    this._minLength = num;
    return this;
  }
  
  maxLength(num) {
    this._maxLength = num;
    return this;
  }
  
  validate() {
    // run your validation logic here and return true or false accordingly
    return true
  }
}

const req = { body: 'body' };
const test = new Validator(req.body);
const myBoolean = test
  .selector('firstName')
  .minLength(2)
  .maxLength(5)
  .validate();
  
console.log('rules:');
console.log(test);
console.log(`result: ${myBoolean}`);

尽管,此错误已在

中解决。

AttributeError: cannot assign module before Module.__init__() call

通过在类中包含AttributeError: cannot assign module before Module.__init__() call 方法,即使使用了建议的解决方案,我仍然继续收到相同的错误。

以下是我开发的课程:

super().__init__()

0 个答案:

没有答案