在theano中为符号变量分配多个表达式

时间:2017-08-30 15:35:01

标签: python-3.x theano

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是否只允许一个表达式来赋值符号变量?

0 个答案:

没有答案