-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[REFACTOR] Replace TensorObj and TensorValue with NDArray #4643
Conversation
81f9b83
to
1e61991
Compare
|
||
@register_relay_node | ||
class TupleValue(Value): | ||
class TupleValue(NodeBase): |
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.
Shouldn't this be Object? or the equivalent Object base class, seems wrong to inherit from node. cc @tqchen
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 noticed this as well. It is from here:
and used as the base by Value
and RelayNode before so I just kept it.
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.
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.
Let us inherit from Object for now, and have a subsequent PR to cleanup the python side.
Also seems we might be able to use Array(or ADT, see discussion here https://discuss.tvm.ai/t/discuss-runtime-array-containers-array-adt-string/4582) for this after @wweic 's PR lands
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.
Yes, I tried it, but it looked to me that we have to merge nodebase to object first before I can use object directly as there are fields not implemented in object, like getattr, etc. Should I use nodebase first then we can refactor them together?
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 just added a commit to replace NodeBase with Object
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.
Mostly looks good, one question about Python wrapper code.
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.
Thanks! Just a naming suggestion
@wweic I am trying to only refactor tensors in the PR. The other ones may need to be either unified between VM and interpreter or changed. We will need another PR for this. |
Make senses. I expect it will need more changes. |
6e1610d
to
4f47e16
Compare
@jroesch can you take another look? Should we merge? |
@zhiics please do a rebase |
4f47e16
to
5d55be4
Compare
@tqchen Done. |
still need to wait for @jroesch 's approval |
* replace TensorObj and TensorValue with NDArray * NodeBase to Object in Python * rebase
* replace TensorObj and TensorValue with NDArray * NodeBase to Object in Python * rebase
* replace TensorObj and TensorValue with NDArray * NodeBase to Object in Python * rebase
This PR removes the TensorObj in VM and TensorValue in interpreter. Instead, we use NDArray directly since it has been migrated to the unified object protocol, #4599
Update: NodeBase is also replaced by Object in this PR.