a = T.iscalar()
b = T.iscalar()
c = a
d = c+b
f = theano.function(
inputs=[a,b],
outputs=d
)
print(f(2,3))
这段代码正在执行并正在打印5.但如果我更改下面的代码,
a = T.iscalar()
b = T.iscalar()
e = T.iscalar()
c = a
d = c+b
c = e
f = theano.function(
inputs=[e,b],
outputs=d
)
print(f(2,3))
我收到以下错误:
theano.compile.function_module.UnusedInputError: theano.function was asked to create a function computing outputs given certain inputs, but the provided input variable at index 0 is not part of the computational graph needed to compute the outputs:
似乎c
仅依赖a
而不依赖e
。
我的问题是,theano是否只允许一个表达式来赋值符号变量?