2016-11-22 57 views

回答

0

只需在终端中使用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'> 
+0

非常感谢教授。塞缪尔Lelièvre –