-
Notifications
You must be signed in to change notification settings - Fork 722
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
list indexing use scalar tensor #7597
Conversation
Flowingsun007
commented
Feb 25, 2022
•
edited
Loading
edited
- 解决了此问题: https://stackoverflow.com/questions/36805774/python-using-a-class-as-a-list-index
- 去掉了python/oneflow/test/modules下的test_util.py,移动至oneflow.test_utils目录下,可以被所有地方全局使用
y = np.arange(num) | ||
for i in range(num): | ||
x = flow.tensor(i, dtype=dtype) | ||
test_case.assertTrue(np.allclose(i, y[x])) |
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.
这里是不是可以直接 test_case.assertEqual
以及 y 可以是一个随机 list,这里判断 y[i] 和 y[x] 的相等性
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.
已修改
…Oneflow-Inc/oneflow into use_scalar_tensor_as_list_index
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
CI failed when running job: cpu-misc. PR label automerge has been removed |
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
Speed stats:
|
CI failed when running job: cuda-speed-test. PR label automerge has been removed |
Speed stats:
|
Speed stats:
|
* list indexing use scalar tensor * refine * refine