ssydasheng
ssydasheng

Reputation: 13

How to compute symbolic theano vector transpose?

I want to compute the symbolic result of v*v.transpose, with v being a n*1 tensor vector. However, theano tensor's transpose does not work for vector. And I don't want to use get_value() because I want to do symbolic gradient afterwards. How should I do in order to get the symbolic transpose?

Upvotes: 1

Views: 1038

Answers (1)

malioboro
malioboro

Reputation: 3291

theano.tensor.transpose is work with vector. Below is the code to do symbolic v*v.transpose in theano:

import theano
import theano.tensor as T

v = T.ivector("v")
b = T.dot(v,T.transpose(v))
z = theano.function([v],b)

A = [1,2,3]
x = z(A)
print x

Upvotes: 2

Related Questions