Skip to content

Commit

Permalink
tensor add storage method (#10311)
Browse files Browse the repository at this point in the history
对齐 torch 给tensor添加 storage 方法

---------

Co-authored-by: oneflow-ci-bot <[email protected]>
  • Loading branch information
Ldpe2G and oneflow-ci-bot authored Aug 9, 2023
1 parent 1ada508 commit f950a9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/oneflow/framework/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ def _conj_physical(self):
return flow._C.conj_physical(self)


def _storage(self):
return self


@property
def _layout(self):
return flow.strided
Expand Down Expand Up @@ -610,6 +614,7 @@ def RegisterMethods():
Tensor.conj = _conj
Tensor.conj_physical = _conj_physical
Tensor.layout = _layout
Tensor.storage = _storage


def register_tensor_op(op_name):
Expand Down

0 comments on commit f950a9a

Please sign in to comment.