-
Notifications
You must be signed in to change notification settings - Fork 25.3k
[JIT] Add operator is, not, is not to script #13336
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
Conversation
torch/csrc/jit/register_prim_ops.cpp
Outdated
[](Node* node) { | ||
return [=](Stack& stack) { | ||
push(stack, !pop(stack).toInt()); | ||
return 0; | ||
}; | ||
}), | ||
Operator( | ||
"aten::__not__(float self) -> bool", |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/register_prim_ops.cpp
Outdated
"aten::__not__(float self) -> bool", | ||
[](Node* node) { | ||
return [=](Stack& stack) { | ||
push(stack, !pop(stack).toInt()); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/register_prim_ops.cpp
Outdated
[](Node* node) { | ||
return [=](Stack& stack) { | ||
push(stack, !pop(stack).toInt()); | ||
return 0; | ||
}; | ||
}), | ||
Operator( | ||
"aten::__not__(float self) -> bool", |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -53,6 +53,8 @@ namespace script { | |||
_(TK_WHILE, "while", "while") \ | |||
_(TK_EXPR_STMT, "expression statement", "") \ | |||
_(TK_RETURN, "return", "return") \ | |||
_(TK_IS, "is", "is") \ | |||
_(TK_ISNOT, "is not", "is not") \ |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
aten/src/ATen/core/ivalue.h
Outdated
@@ -623,4 +626,27 @@ inline optional<T> IValue::toOptional() { | |||
return this->to<T>(); | |||
} | |||
|
|||
inline bool IValue::isSameIdentity(IValue& rhs) { | |||
// we choose to not use memcmp for payload check due to potenntial random padding characters on union type |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
8ce6fbb
to
a26efa8
Compare
The error is happening because of py2 and py3 semantic difference for tuple: in py2:
while in py3:
So is/(is not) op is different on tuples between py2 and py3. My current implementation is following python3 semantic, I am going to remove the tuple test case for now. CC @zdevito |
32460c5
to
af3f147
Compare
|
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.
@wanchaol has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
@wanchaol has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: As titled, this PR is a part of tasks to unblock exporting the standard library. Pull Request resolved: pytorch/pytorch#13336 Differential Revision: D12888912 Pulled By: wanchaol fbshipit-source-id: 6213a17a75a593ae45999994fd9562f29b7d42df
As titled, this PR is a part of tasks to unblock exporting the standard library.