theano入门教程1.2

theano入门教程1.2

1. 两个矩阵相加


import theano.tensor as T

from theano import function


x = T.dmatrix('x')

y = T.dmatrix('y')

z = x + y

f = function([x,y], z)

f([2,3], [4,5])


2 .logistic function


import theano.tensor as T

from theano import function

x = T.dmatrix('x')

s = 1/ (1 + T.exp(-x))

logistic = function([x], s)

logistic([1, 2])








原文地址:https://www.cnblogs.com/fireae/p/3769582.html