尝试在 Theano 中使用 GPU 时如何查找哪个变量是 float64

How to find which variable is float64 when trying to use GPU in Theano

theano中,使用gpu时,变量必须是float32。我检查了我所有的变量都是 folat32,但我仍然得到以下错误。

ERROR (theano.gof.opt): Optimization failure due to: local_gpu_incsubtensor
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "/public/home/ybfan/anaconda/lib/python2.7/site-packages/theano/gof/opt.py", line 1286, in process_node
    replacements = lopt.transform(node)
File "/public/home/ybfan/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/opt.py", line 855, in local_gpu_incsubtensor
    gpu_from_host(y),
File "/public/home/ybfan/anaconda/lib/python2.7/site-packages/theano/gof/op.py", line 399, in __call__
    node = self.make_node(*inputs, **kwargs)
File "/public/home/ybfan/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/basic_ops.py", line 128, in make_node
    dtype=x.dtype)()])
File "/public/home/ybfan/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/type.py", line 68, in __init__
    (self.__class__.__name__, dtype, name))
TypeError: CudaNdarrayType only supports dtype float32 for now. Tried using dtype float64 for variable None

好像有些变量还是float64,我的问题是如何定位我用的是float64变量

在 Theano 0.7 中,您可以使用 Theano 标志:warn_float64。您可以给他以下值之一:'ignore'、'warn'、'raise'、'pdb'.

这使您可以轻松找到创建 float64 的位置。