python的AttributeError错误

imdb_data_bunch.one_bach()//这个one_bach()不存在

AttributeError Traceback (most recent call last)
in ()
----> 1 imdb_data_bunch.one_bach()
/opt/conda/lib/python3.6/site-packages/fastai/basic_data.py in getattr(self, k)
120 return cls(*dls, path=path, device=device, dl_tfms=dl_tfms, collate_fn=collate_fn, no_check=no_check)
121
–> 122 def getattr(self,k:int)->Any: return getattr(self.train_dl, k)
123 def setstate(self,data:Any): self.dict.update(data)
124
/opt/conda/lib/python3.6/site-packages/fastai/basic_data.py in getattr(self, k)
36
37 def len(self)->int: return len(self.dl)
—> 38 def getattr(self,k:str)->Any: return getattr(self.dl, k)
39 def setstate(self,data:Any): self.dict.update(data)
40
/opt/conda/lib/python3.6/site-packages/fastai/basic_data.py in DataLoader___getattr__(dl, k)
18 torch.utils.data.DataLoader.init = intercept_args
19
—> 20 def DataLoader___getattr__(dl, k:str)->Any: return getattr(dl.dataset, k)
21 DataLoader.getattr = DataLoader___getattr__
22
/opt/conda/lib/python3.6/site-packages/fastai/data_block.py in getattr(self, k)
641 res = getattr(y, k, None)
642 if res is not None: return res
–> 643 raise AttributeError(k)
644
645 def setstate(self,data:Any): self.dict.update(data)
AttributeError: one_bach

AttributeError是因为调用了one_bach()不存在,改正为one_batch()就成功了

imdb_data_bunch.one_batch()//这个one_batch()存在,就不再报“AttributeError错误”了

你可能感兴趣的:(学习总结,问题解决)