Suppose I have defined my object:
import numpy as np
class myTensor:
def __init__(self,data):
self.data=np.array(data)
self.parent=[]
How can I pass 'myTensor' as inputs to np.dot? For example:
t1=myTensor([1,2])
t2=myTensor([3,4])
Now, if I call
t3=np.dot(t1,t2)
I expect t3 to be another myTensor object, whose t3.data is the dot product of array [1,2] and [3,4], that is, 11; and t3.parents to be the list containing t1 and t2.
Thanks for any suggestions!!