擅长:python、mysql、java
<p>简单的解决方案:转置</p>
<pre><code>>>> import theano as th
>>> T = th.tensor
>>> x = th.tensor.matrix()
>>> y = T.nnet.softmax(x.T).T
>>> fn = th.function([x],y)
>>> fn([[1.,2.],[1.,3.]])
array([[ 0.5 , 0.26894143],
[ 0.5 , 0.7310586 ]], dtype=float32)
</code></pre>
<p>对于张量rank>;=3,转置需要指定轴。在</p>
^{pr2}$