1
我想知道使用SageMath安装Theano库的步骤吗?如何在本地安装使用sageMath的Theano库?
我想知道使用SageMath安装Theano库的步骤吗?如何在本地安装使用sageMath的Theano库?
只需在终端中使用pip安装theano即可。
$ sage -pip install theano
下次运行Sage时,theano可用。
sage: from theano import *
sage: import theano.tensor as T
sage: from theano import function
sage: x = T.dscalar('x')
sage: y = T.dscalar('y')
sage: z = x + y
sage: f = function([x, y], z)
sage: f(2, 3)
array(5.0)
sage: numpy.allclose(f(16.3, 12.1), 28.4)
True
sage: type(x)
<class 'theano.tensor.var.TensorVariable'>
非常感谢教授。塞缪尔Lelièvre –