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

Python operator add (tensor<int> + <float>) fails #33

Closed
srohit0 opened this issue Sep 10, 2019 · 1 comment
Closed

Python operator add (tensor<int> + <float>) fails #33

srohit0 opened this issue Sep 10, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@srohit0
Copy link
Member

srohit0 commented Sep 10, 2019

tensor<int> + <float> fails

>>> import dnnc as dc
>>> a=dc.arange(5).asTypeInt()
>>> a
[0 1 2 3 4]
>>> b=a+1
>>> b
[1 2 3 4 5]
>>> b=a+1.0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'dnnc.iTensor' and 'float'

whereas, tensor<float> + <int> and tensor<float> + <float> WORKS

>>> import dnnc as dc
>>> a=dc.arange(5)
>>> a
[0.000000 1.000000 2.000000 3.000000 4.000000]
>>> b=a+1
>>> b
[1.000000 2.000000 3.000000 4.000000 5.000000]
>>> b=a+1.0
>>> b
[1.000000 2.000000 3.000000 4.000000 5.000000]
@srohit0 srohit0 added the bug Something isn't working label Sep 10, 2019
@srohit0 srohit0 changed the title Python operator add (<int tensor> + <float>) fails Python operator add (tensor<int> + <float>) fails Sep 11, 2019
@srohit0
Copy link
Member Author

srohit0 commented Sep 24, 2019

BUG script for types bool, int, float tensor and scalar operations.

 import dnnc as dc
 
 b1 = dc.arange(10, 5).asTypeBool();
 b2 = dc.arange(10, 5).asTypeBool();
 i1 = dc.arange(5).asTypeInt();
 i2 = dc.arange(5).asTypeInt();
 f1 = dc.arange(5);
 f2 = dc.arange(5);

# all of these operators fail.
 print(b1+b2)
 print(i1+i2)
 print(f1+f2)
 print(b1+i1)
 print(b1+f1)
 print(i1+b1)
 print(i1+f1)
 print(f1+b1)
 print(f1+i1)
 print(b1+False)
 print(b1+1)
 print(b1+1.0)
 print(i1+False)
 print(i1+1)
 print(i1+1.0)
 print(f1+False)
 print(f1+1)
 print(f1+1.0)
 print(True+b1)
 print(True+i1)
 print(True+f1)
 print(1+b1)
 print(1+i1)
 print(1+f1)
 print(1.0+b1)
 print(1.0+i1)
 print(1.0+f1)

@srohit0 srohit0 closed this as completed in b9f29ae Nov 1, 2019
srohit0 added a commit that referenced this issue Nov 1, 2019
Full numpy binary support, fixed #33, fixed #50, fixed #70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants