我想知道如何使用SageMath安装Theano库的步骤?
回答:
只需在终端中运行以下命令,使用pip安装Theano即可。
$ sage -pip install theano
下次运行Sage时,Theano就可用。
sage: from theano import *sage: import theano.tensor as Tsage: from theano import functionsage: x = T.dscalar('x')sage: y = T.dscalar('y')sage: z = x + ysage: f = function([x, y], z)sage: f(2, 3)array(5.0)sage: numpy.allclose(f(16.3, 12.1), 28.4)Truesage: type(x)<class 'theano.tensor.var.TensorVariable'>