Created
          February 19, 2014 19:35 
        
      - 
      
- 
        Save MarcCote/9099852 to your computer and use it in GitHub Desktop. 
    Gist showing an erroneous result from tensor.dot when one of the operand is zero.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import numpy as np | |
| import theano | |
| import theano.tensor as T | |
| print "Version:", theano.version.version | |
| print "=Theano=" | |
| A = T.zeros((2,10)) | |
| B = T.zeros((30, 10)) | |
| print "Shape of A:", A.eval().shape | |
| print "Shape of B:", B.eval().shape | |
| print "AB =\n", T.dot(A,B).eval() | |
| print "Shape of AB:", T.dot(A,B).eval().shape | |
| print "=Numpy=" | |
| A = np.zeros((2,10)) | |
| B = np.zeros((30, 10)) | |
| print "Shape of A:", A.shape | |
| print "Shape of B:", B.shape | |
| print "AB =", np.dot(A,B) | |
| print "Shape of AB:", np.dot(A,B).shape | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment