2
我試圖運行該腳本lstm_ptb.py但它拋出一個TypeError以下行:Theano:ifelse類型錯誤
shrink_factor = ifelse(T.gt(norm_gparams,max_grad_norm),max_grad_norm/norm_gparams,1.)
這是該行正在努力實現:
if norm_gparams > max_grad_norm:
shrink_factor = max_grad_norm/norm_gparams
else:
shrink_factor = 1.
它說:
TypeError: The two branches should have identical types, but they are TensorType(float64, scalar) and TensorType(float32, scalar) respectively. This error could be raised if for example you provided a one element list on the
then
branch but a tensor on theelse
branch
如何解決錯誤請?謝謝