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

TYPE-ERROR in basic operations if types differ #173

Open
stewart123579 opened this issue Jul 3, 2022 · 0 comments
Open

TYPE-ERROR in basic operations if types differ #173

stewart123579 opened this issue Jul 3, 2022 · 0 comments

Comments

@stewart123579
Copy link
Contributor

I'm not even convinced this is a bug or appropriate behaviour...

Depending on the order of arguments we can get a type-error from [the setf] (https://github.com/quil-lang/magicl/blob/master/src/high-level/abstract-tensor.lisp#L197=) in binary-operator

(defparameter int-tensor (magicl:from-list '(1 2 3) '(3)))
(defparameter float-tensor (magicl:from-list '(1.0 2.0 3.0) '(3)))

;; This works
(magicl:.+ float-tensor int-tensor)
;; This is a TYPE-ERROR condition
(magicl:.+ int-tensor float-tensor)

A solution would be to coerce/round/cast one of the arguments, but which one, and when?

Take an example of elementwise sum and the cases of 0.5 + 1 being stored in an int32-tensor. Depending on where, say, the round function is applied the first sum could be

(+ (round 0.5) 1)
;; 1
(round (+ 0.5 1))
;; 2
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