-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Some warning removals #635
Conversation
4fda79e
to
1c50923
Compare
# The following cast removes the following warning: | ||
# =destroy(storage.raw_buffer) can raise an unlisted exception: Exception | ||
{.cast(raises: []).}: | ||
`=destroy`(storage.raw_buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, interesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Courtesy of @beef, who I should have mentioned on the commit message :)
proc `+`*[T: SomeNumber|Complex[float32]|Complex[float64]](a, b: Tensor[T]): Tensor[T] {.noinit.} = | ||
## Tensor addition | ||
#echo "+++++ SAME ++++++" | ||
map2_inline(a, b, x + y) | ||
|
||
proc `+`*[T, K: SomeNumber](a: Tensor[Complex[T]], b: Tensor[K]): Tensor[Complex[T]] {.noinit.} = | ||
## Tensor addition | ||
echo "+++++ COMPLEX ++++++" | ||
when T is K: | ||
echo "T is K" | ||
map2_inline(a, b, x + y) | ||
elif T is float64: | ||
echo "T is float64" | ||
map2_inline(a, b, x + float64(y)) | ||
else: | ||
{.error: "Tensor addition not supported for tensors of types " & $T & " and " & $K} | ||
|
||
proc `+`*[T, K: SomeNumber](a: Tensor[K], b: Tensor[Complex[T]]): Tensor[Complex[T]] {.noinit.} = | ||
## Tensor addition | ||
echo "+++++++++++2" | ||
when T is K: | ||
echo "T is K" | ||
map2_inline(a, b, x + y) | ||
elif T is float64: | ||
echo "T is float64" | ||
map2_inline(a, b, float64(x) + y) | ||
else: | ||
{.error: "Complex tensor addition only supported for tensors of the same type."} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is part of this PR by accident?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, sorry about that. I'll remove this spurious change and update the PR.
I'm pretty sure I added some of these "useless" import things (like the Given that doc generation is still partially broken, I'd merge it for now. Then do another pass soon to fix the doc generation soon. Maybe at this point we can attempt again to simplify the doc generation logic... |
9758437
to
be4eabb
Compare
…eprecated" warning from tensor\datatypes.nim Note that there is still another similar warning left in: \laser\primitives\matrix_multiplication\gemm_tiling.nim(321, 3)
In particular: - Warning: imported and not used: 'datatypes' - Warning: imported and not used: 'complex' Warning: imported and not used: 'math'
Removed from `examples\ex06_shakespeare_generator.nim`.
…r is deprecated` warning We cannot really fix that warning because it is due to the fact that (as for 2.0.2) nim creates a var destructor when `new X, T` is called. Since we cannot fix it we simply disable it.
This also removes a few unnecessary imports of the complex and math modules (which are automatically exported by arraymancer). The test touches a lot funtions but the changes are minimal and simple (basically changing things like `import unittest, os` into `import std / [unittest, os]` and so on).
This warning only happens with devel. The fix is to make sequninit.nim "used" when newSeqUninit is not needed.
be4eabb
to
5f82fe2
Compare
Let's see if the docgen will really break. Thanks! |
Yeah, the docgen is now broken again: https://github.com/mratsim/Arraymancer/actions/runs/8387852728/job/22970876430 with:
|
This PR removes many warnings and some unnecessary hints. Some of this is similar to a draft PR that @mratsim opened a few months ago, so there is some overlap with his work.
Note that one of the warnings could not really be fixed so I just disabled it. This is explained in the code and in the corresponding commit message.