Skip to content

Instantly share code, notes, and snippets.

@MarcCote
Created September 15, 2014 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcCote/1e0a8b7d7a5a1ff002f3 to your computer and use it in GitHub Desktop.
Save MarcCote/1e0a8b7d7a5a1ff002f3 to your computer and use it in GitHub Desktop.
Unexpected behaviour when summing stacked tensors
import theano
import theano.tensor as T
import numpy as np
A = theano.shared(np.array([1, 2, 3, 4, 5]))
print "Theano"
print T.sum(T.stack(A, A), axis=0).eval()
print T.sum(T.stack(A, A), axis=1).eval()
print "Numpy"
print np.sum(T.stack(A, A).eval(), axis=0)
print np.sum(T.stack(A, A).eval(), axis=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment