-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Cannot match type float64 vs float32 #3855
Comments
i don't know how to deal with it , float32 is right , but float64 is error |
I think there's some bug within import tvm
a = np.log(3).astype('float64')
print(a.dtype) # float64
a_ir = tvm.convert(a)
print(a_ir.dtype) # float32 |
After some tracing, I find that the type inference here is not correct: It's either float32 or int32 |
@sxjscience The general principle is to make sure we are consistent with numpy. can you try to send a PR to correct this? |
i think you must give the dtype, if i only give a number, tvm think dtype is none |
thanks . tvm.convert() has bug, i think i should use tvm.const(), rather than a number |
if tvm want to be better, i think tvm should make user easy to use it, or give a tips, lol |
thx @sxjscience |
Why do you mix |
Xingjian's fix helps us with numpy ndarray types, but think about it: the solution, duck typing, is interesting that now we assume that we just assume we know it (i mean we just assume A general approach when we implement an ordinary compiler is that we just leave it blank and infer it in later passes, for example, let's just implement a unification-based type solver in this level of IR, which, @sxjscience welcome to contribute if you have time. |
Another solution is that you just document it out...I don’t think implementing a general type solver would be worth your effort... |
@junrushao1994 |
It doesn’t explain the overuse of np.log given math.log exists... |
because if input is int, output must be int, so i need log(2) astype int or float , now i have relsove this problem, but thx your help |
my code :
the error is :
Traceback (most recent call last):
The text was updated successfully, but these errors were encountered: