ehsanhaghighat/sciann

BUG (?) -- Different order of (-,*) operators result different data type

Opened this issue · 0 comments

Dear friends,

Please consider the following lines of code:

import numpy as np
import sciann as sn
z = sn.Variable('z')
omega = sn.Functional('omega', z,
                 hidden_layers=[10,10],
                 activation='tanh')
omega_z = sn.diff(omega, z)
data = np.array([1,2,3,4,5,6,7,8,9,10])
print(type(data - 1/omega_z))
print(type(1/omega_z - data))
print(type(data * 1/omega_z ))
print(type(1/omega_z * data))

We observe that different order of operators between ndarray and sciann.functionals.mlp_functional.MLPFunctional results different outcome. I do not now if this is somehow desirable - I can not think of a reason for this. I suspect that there is something wrong at __ mul__ and __ add__ methods definitions.