有关
encoder_cell = copy.deepcopy(cell)
或
encoder_cell = cPickle.loads(cPickle.dumps(cell, -1))
在tensoflow1.2中,它会引发错误,如:
encoder_cell = cPickle.loads(cPickle.dumps(cell, -1))
TypeError: can't pickle _thread.lock objects
但它在tensorflow1.0.1上运行良好
答案 0 :(得分:0)
如果您正在使用旧版seq2seq.py
,请将其添加到您的脚本中:
setattr(tf.contrib.rnn.GRUCell, '__deepcopy__', lambda self, _: self)
setattr(tf.contrib.rnn.BasicLSTMCell, '__deepcopy__', lambda self, _: self)
setattr(tf.contrib.rnn.MultiRNNCell, '__deepcopy__', lambda self, _: self)