如何使用theano获取代码的错误行?

如何使用theano获取代码的错误行?,theano,Theano,在常见问题页面中, 我看到了这个例子 import numpy as np import theano import theano.tensor as T x = T.vector() y = T.vector() z = x + x z = z + y f = theano.function([x, y], z) f(np.ones((2,)), np.ones((3,))) 如果我使用optimizer=fast\u compile或optimizer=None和exception\u

在常见问题页面中, 我看到了这个例子

import numpy as np
import theano
import theano.tensor as T

x = T.vector()
y = T.vector()
z = x + x
z = z + y
f = theano.function([x, y], z)
f(np.ones((2,)), np.ones((3,)))
如果我使用optimizer=fast\u compile或optimizer=None和exception\u verbosity=high,我应该会看到

Backtrace when the node is created:
  File "test0.py", line 8, in <module>
    z = z + y

Debugprint of the apply node:
Elemwise{add,no_inplace} [id A] <TensorType(float64, vector)> ''
 |Elemwise{add,no_inplace} [id B] <TensorType(float64, vector)> ''
 | |<TensorType(float64, vector)> [id C] <TensorType(float64, vector)>
 | |<TensorType(float64, vector)> [id C] <TensorType(float64, vector)>
 |<TensorType(float64, vector)> [id D] <TensorType(float64, vector)>
创建节点时的回溯:
文件“test0.py”,第8行,在
z=z+y
应用节点的调试打印:
Elemwise{add,no_in place}[id A]''
|Elemwise{add,no_in place}[id B]''
||[id C]
||[id C]
|[id D]
但我只是看到了

Traceback (most recent call last):
  File "C:\test.py", line 21, in <module>
    f(np.ones((2,)), np.ones((3,)))
  File "C:\Anaconda\lib\site-packages\theano\compile\function_module.py", line 606, in __call__
    storage_map=self.fn.storage_map)
  File "C:\Anaconda\lib\site-packages\theano\compile\function_module.py", line 595, in __call__
    outputs = self.fn()
ValueError: Input dimension mis-match. (input[0].shape[0] = 2, input[1].shape[0] = 3)
Apply node that caused the error: Elemwise{add,no_inplace}(Elemwise{add,no_inplace}.0, <TensorType(float32, vector)>)
Inputs types: [TensorType(float32, vector), TensorType(float32, vector)]
Inputs shapes: [(2L,), (3L,)]
Inputs strides: [(4L,), (4L,)]
Inputs values: [array([ 2.,  2.], dtype=float32), array([ 1.,  1.,  1.], dtype=float32)]

Backtrace when the node is created:
  File "C:\Anaconda\lib\site-packages\theano\gof\type.py", line 318, in __call__
    return utils.add_tag_trace(self.make_variable(name))

Debugprint of the apply node: 
Elemwise{add,no_inplace} [@A] <TensorType(float32, vector)> ''   
 |Elemwise{add,no_inplace} [@B] <TensorType(float32, vector)> ''   
 | |<TensorType(float32, vector)> [@C] <TensorType(float32, vector)>
 | |<TensorType(float32, vector)> [@C] <TensorType(float32, vector)>
 |<TensorType(float32, vector)> [@D] <TensorType(float32, vector)>

Storage map footprint:
 - <TensorType(float32, vector)>, Shape: (2L,), ElemSize: 4 Byte(s), TotalSize: 8 Byte(s)
 - Elemwise{add,no_inplace}.0, Shape: (2L,), ElemSize: 4 Byte(s), TotalSize: 8 Byte(s)
 - <TensorType(float32, vector)>, Shape: (3L,), ElemSize: 4 Byte(s), TotalSize: 12 Byte(s)
回溯(最近一次呼叫最后一次):
文件“C:\test.py”,第21行,在
f(np.one((2,)),np.one((3,))
文件“C:\Anaconda\lib\site packages\theano\compile\function\u module.py”,第606行,在调用中__
存储映射=self.fn.storage映射)
文件“C:\Anaconda\lib\site packages\theano\compile\function\u module.py”,第595行,在调用中__
输出=self.fn()
ValueError:输入维度不匹配。(输入[0]。形状[0]=2,输入[1]。形状[0]=3)
导致错误的应用节点:Elemwise{add,no_inplace}(Elemwise{add,no_inplace}.0,)
输入类型:[TensorType(浮点32,向量),TensorType(浮点32,向量)]
输入形状:[(2L,),(3L,)]
输入跨步:[(4L,),(4L,)]
输入值:[array([2,2.],dtype=float32),array([1,1,1.],dtype=float32]
创建节点时进行回溯:
文件“C:\Anaconda\lib\site packages\theano\gof\type.py”,第318行,在调用中__
返回utils.add_tag_trace(self.make_变量(名称))
应用节点的调试打印:
元素{add,no_inplace}[@A]''
|Elemwise{add,no_inplace}[@B]''
||[@C]
||[@C]
|[@D]
存储映射示意图:
-,形状:(2L,),电子化:4字节,总大小:8字节
-Elemwise{add,no_inplace}.0,形状:(2L,),ElemSize:4字节,TotalSize:8字节
-,形状:(3L,),电子化:4字节,总大小:12字节
回溯线没有告诉我线路。有什么问题