更新时间:2023-12-01 07:50:27
Theano 张量"变量是符号变量.你用它们构建的东西就像你编写的程序.你需要编译一个 Theano 函数来执行这个程序的功能.有两种方法可以编译 Theano 函数:
Theano "tensor" variable are symbolic variable. What you build with them are like a programme that you write. You need to compile a Theano function to execute what this program do. There is 2 ways to compile a Theano function:
f = theano.function([testxx.input], [outxx])
f_a1 = f(a)
# Or the combined computation/execution
f_a2 = outxx.eval({testxx.input: a})
当你编译一个 Theano 函数时,你必须知道输入是什么,输出是什么.这就是为什么在对 theano.function() 的调用中有 2 个参数.eval() 是一个接口,它将在给定的符号输入和相应的值上编译和执行 Theano 函数.
When you compile a Theano function, your must tell what the input are and what the output are. That is why there is 2 parameter in the call to theano.function(). eval() is a interface that will compile and execute a Theano function on a given symbolic inputs with corresponding values.