-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Lang] Support ti.zero(x) and ti.one(x) for making zero/one value for the same type with x #1857
Conversation
… the same type with x
Codecov Report
@@ Coverage Diff @@
## master #1857 +/- ##
==========================================
+ Coverage 44.06% 44.21% +0.15%
==========================================
Files 44 44
Lines 6089 6111 +22
Branches 1089 1092 +3
==========================================
+ Hits 2683 2702 +19
- Misses 3237 3240 +3
Partials 169 169
Continue to review full report at Codecov.
|
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.
LGTM + nits!
tests/python/test_lang.py
Outdated
@@ -131,3 +132,29 @@ def test(): | |||
print(i) | |||
|
|||
test() | |||
|
|||
|
|||
@ti.test(require=ti.extension.data64) |
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.
IIUC, this applies to all the test cases, so platforms like Metal cannot be covered, even for 32-bit types? If so, could you split this into two cases, one for 64-bit and the other for non-64?
if ti.core.is_integral(dt): | ||
x = int(x) | ||
assert func(x) == 0 # intentionally not using ti.approx here | ||
|
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.
nit: Test for ti.Matrix
as well?
Related issue = http://www.jlhub.com/julia/manual/en/function/zero
[Click here for the format server]
Yeah it's still using
x * 0
since we seems can't get the data type of an expr from python-scope.. maybe iapr, let's set up the API here imutating the Julia zero/one.