提交 412d1f0c 编写于 作者: M Megvii Engine Team

fix(mge/tensor): implement abtract method to fix lint errors

GitOrigin-RevId: d53f2eac6afc24f6b14b922f1d55f4821659ee98
上级 0e8b81c2
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
# Unless required by applicable law or agreed to in writing, # Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an # software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from typing import Union
import collections
import numpy as np import numpy as np
...@@ -53,7 +51,7 @@ class Tensor(_Tensor, ArrayMethodMixin): ...@@ -53,7 +51,7 @@ class Tensor(_Tensor, ArrayMethodMixin):
return obj return obj
@property @property
def shape(self): def shape(self) -> Union[tuple, "Tensor"]:
shape = super().shape shape = super().shape
if shape == () or not use_symbolic_shape(): if shape == () or not use_symbolic_shape():
return shape return shape
...@@ -63,6 +61,16 @@ class Tensor(_Tensor, ArrayMethodMixin): ...@@ -63,6 +61,16 @@ class Tensor(_Tensor, ArrayMethodMixin):
def _tuple_shape(self): def _tuple_shape(self):
return super().shape return super().shape
@property
def dtype(self) -> np.dtype:
return super().dtype
def numpy(self) -> np.ndarray:
return super().numpy()
def _reset(self, other):
super()._reset(other)
def __repr__(self): def __repr__(self):
piece = "Tensor(" piece = "Tensor("
with np.printoptions(precision=4, suppress=True): with np.printoptions(precision=4, suppress=True):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册