Solved by ptrblck in post #8 
              
              
                Broadcasting wasn’t available in version 0.1.12. 
You could try: 
tensor_vec = tensor_vec / tensor_vec.sum(0).expand_as(tensor_vec)