Solved by kahroba in post #5 
              
              
                As you said I mistakenly called a tensor as a function 
The problem was solved by converting self.tgt_embed (tgt) to self.tgt_embed 
thanks