提交 403d94df authored 作者: james@mackie's avatar james@mackie

removed underscore on _TensorOp

上级 e3a00698
...@@ -20,11 +20,11 @@ def _wrap_as_tensor(x): ...@@ -20,11 +20,11 @@ def _wrap_as_tensor(x):
else: else:
return Tensor(data=x, constant=True) return Tensor(data=x, constant=True)
# _TensorOp is a convenient base class, permitting to factor the code for the # TensorOp is a convenient base class, permitting to factor the code for the
# Ops in this file. # Ops in this file.
# It is not necessary to inherit from TensorOp to make an Op that manipulates # It is not necessary to inherit from TensorOp to make an Op that manipulates
# Tensors. # Tensors.
class _TensorOp(Op, gradient.SelfGrad): class TensorOp(Op, gradient.SelfGrad):
nin = -1 nin = -1
nout = 1 nout = 1
...@@ -78,10 +78,10 @@ class _TensorOp(Op, gradient.SelfGrad): ...@@ -78,10 +78,10 @@ class _TensorOp(Op, gradient.SelfGrad):
class UnaryTensorOp(_TensorOp): class UnaryTensorOp(TensorOp):
nin = 1 nin = 1
class BinaryTensorOp(_TensorOp): class BinaryTensorOp(TensorOp):
nin = 2 nin = 2
...@@ -138,7 +138,7 @@ def assert_tensor_scalar(x, a): ...@@ -138,7 +138,7 @@ def assert_tensor_scalar(x, a):
class Elemwise(_TensorOp): class Elemwise(TensorOp):
@staticmethod @staticmethod
def extract_name(name): def extract_name(name):
...@@ -220,7 +220,7 @@ class TensorScalarOp(Elemwise): ...@@ -220,7 +220,7 @@ class TensorScalarOp(Elemwise):
## Dot ## ## Dot ##
######### #########
class Dot(_TensorOp): class Dot(TensorOp):
@staticmethod @staticmethod
def _output_shape(xshape, yshape): def _output_shape(xshape, yshape):
# This describes the logic to calculate numpy.dot(x, y).shape # This describes the logic to calculate numpy.dot(x, y).shape
...@@ -463,7 +463,7 @@ class Fill(Elemwise): ...@@ -463,7 +463,7 @@ class Fill(Elemwise):
#### Unary Operations #### #### Unary Operations ####
########################## ##########################
class Transpose(_TensorOp, Viewer): class Transpose(TensorOp, Viewer):
def view_map(self): def view_map(self):
return {self.out: [self.inputs[0]]} return {self.out: [self.inputs[0]]}
def impl(self, x): def impl(self, x):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论