在Python中,當我使用此導入語句breze.learn.mlp導入iter_minibatches時,出現以下錯誤。導入錯誤python
這裏iter_minibatches
是一個在mlp.py中定義的函數。
Traceback (most recent call last):
File "/home/vinod/PycharmProjects/MLPonTheano/MLPbreze.py", line 15, in <module>
from breze.learn.mlp import Mlp, FastDropoutNetwork
File "/home/vinod/breze/breze/learn/mlp.py", line 22, in <module>
from breze.learn.base import SupervisedModel
File "/home/vinod/breze/breze/learn/base.py", line 21, in <module>
from breze.learn.mlp import iter_minibatches
ImportError: cannot import name iter_minibatches
*「這裏'iter_minibatches'是一個在mlp.py中定義的函數」* - 你能證明它嗎? – Sam
'dir(breze.learn.mlp)'輸出了什麼? – IanAuld
def iter_minibatches(lst,batch_size,dims,n_cycles = False,random_state = None): print'inside iter mini batches:',lst [0] 批次= [minibatches(i,batch_size,d)for i,d in zip(lst,dims)] .... –