-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Add FunctionSchema based Operator Registry #13789
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
a78bf9b to
351422f
Compare
351422f to
37098b7
Compare
37098b7 to
4b70030
Compare
4b70030 to
a7baf0e
Compare
caffe2/core/operator.cc
Outdated
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.
caffe2/core/operator.cc
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator.h
Outdated
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.
caffe2/core/operator.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator.h
Outdated
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.
caffe2/core/operator.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator_test.cc
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator_test.cc
Outdated
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.
a7baf0e to
e011b44
Compare
e011b44 to
6e6bfce
Compare
6e6bfce to
de701fe
Compare
de701fe to
a3afba5
Compare
a3afba5 to
0f69172
Compare
0f69172 to
a77e29f
Compare
caffe2/core/operator.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator_test.cc
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
caffe2/core/operator.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
a77e29f to
bfce273
Compare
bfce273 to
7019f64
Compare
7019f64 to
c04fedc
Compare
c04fedc to
fd6420d
Compare
fd6420d to
2dbaeff
Compare
2dbaeff to
c7c150a
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.
Can you add more tests, especially if the op uses the new API to change output size?
caffe2/core/operator.h
Outdated
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.
this is not sufficient:
- you assume the output is already tensor - what if it's not?
- this is not the api we'd be calling - instead majority of places call
OutputTensor(int idx, at::IntList dims, at::TensorOptions options)below which avoids reinitialization/dtype change in-place and instead creates new tensor input
in both cases we'd need to change ivalue in-place, i.e. we need a pointer to ivalue for this case
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.
makes sense -- updated
c7c150a to
e55d4e9
Compare
e55d4e9 to
c9df117
Compare
caffe2/core/operator.h
Outdated
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.
what about non-Tensor Output() version above? at least add an option to claim that it's not a "legacy operator"
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.
Ping?
caffe2/core/operator.h
Outdated
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.
.get is redundant?
caffe2/core/operator_test.cc
Outdated
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.
for a better test - don't initialize the IValue at all
caffe2/core/operator.h
Outdated
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.
if IValue wasn't holding tensor - should we reset it to the tensor type? as semantically it's "assignment"
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.
?
caffe2/core/operator.h
Outdated
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.
if you move it inside the if and use tensor variable - you can save one refcount bump
c9df117 to
c8dadd3
Compare
caffe2/core/blob.h
Outdated
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.
to keep the original behavior, we are changing this to tensor.raw_mutable_data(options.dtype()); see Line 48 of blob.h
c8dadd3 to
85a77c1
Compare
85a77c1 to
dc2f168
Compare
dc2f168 to
c66f814
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.
Please fix mine and Jerry's comments. Otherwise looks great!
caffe2/core/operator.h
Outdated
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.
Ping?
caffe2/core/operator.h
Outdated
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.
?
caffe2/core/operator.h
Outdated
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'd move this wrapping inside the if still to save refcount (otherwise you still bump one when you look up tensor above (or you can get device from at::Tensor directly
c66f814 to
9680f2f
Compare
Summary: Pull Request resolved: pytorch#13789 This enables creation of operators with FunctionSchema and IValue Reviewed By: smessmer Differential Revision: D13008791 fbshipit-source-id: 2b558611be75d26e17c3c2d9f2e0158201b96c33
9680f2f to
6860fda
Compare
Summary: Pull Request resolved: pytorch/pytorch#13789 This enables creation of operators with FunctionSchema and IValue Reviewed By: smessmer Differential Revision: D13008791 fbshipit-source-id: 151efc88ac315f4a0ab0171a99774caaf767ef1e
Summary: This enables creation of operators with FunctionSchema and IValue
Differential Revision: D13008791