Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fotisAnagnostopoulos opened this issue Nov 6, 2022 · 0 comments

Comments

@fotisAnagnostopoulos
Copy link

fotisAnagnostopoulos commented Nov 6, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant