提交 774c4a91 authored 作者: sentient07's avatar sentient07

Adding __props__ to all the Ops that has __init__

上级 f66ea7e8
...@@ -781,6 +781,7 @@ class Op(utils.object2, PureOp, CLinkerOp): ...@@ -781,6 +781,7 @@ class Op(utils.object2, PureOp, CLinkerOp):
Convenience class to bundle `PureOp` and `CLinkerOp`. Convenience class to bundle `PureOp` and `CLinkerOp`.
""" """
def prepare_node(self, node, storage_map, compute_map, impl): def prepare_node(self, node, storage_map, compute_map, impl):
""" """
Make any special modifications that the Op needs before doing Make any special modifications that the Op needs before doing
......
...@@ -853,6 +853,8 @@ class ScalarOp(Op): ...@@ -853,6 +853,8 @@ class ScalarOp(Op):
nin = -1 nin = -1
nout = 1 nout = 1
__props__ = ("output_types_preference", "name")
def __init__(self, output_types_preference=None, name=None): def __init__(self, output_types_preference=None, name=None):
self.name = name self.name = name
if output_types_preference is not None: if output_types_preference is not None:
......
...@@ -476,6 +476,7 @@ second dimension ...@@ -476,6 +476,7 @@ second dimension
| Elemwise(log)(rand(3, 4, 5)) | Elemwise(log)(rand(3, 4, 5))
""" """
__props__ = ("scalar_op", "inplace_pattern", "name", "nfunc_spec", "openmp")
def __init__(self, scalar_op, inplace_pattern=None, name=None, def __init__(self, scalar_op, inplace_pattern=None, name=None,
nfunc_spec=None, openmp=None): nfunc_spec=None, openmp=None):
...@@ -1334,6 +1335,8 @@ class CAReduce(Op): ...@@ -1334,6 +1335,8 @@ class CAReduce(Op):
""" """
__props__ = ("scalar_op", "axis")
def __init__(self, scalar_op, axis=None): def __init__(self, scalar_op, axis=None):
if scalar_op.nin not in [-1, 2] or scalar_op.nout != 1: if scalar_op.nin not in [-1, 2] or scalar_op.nout != 1:
raise NotImplementedError(( raise NotImplementedError((
...@@ -1714,6 +1717,7 @@ class All(CAReduce): ...@@ -1714,6 +1717,7 @@ class All(CAReduce):
Equivalent to `CAReduce(scalar.and\_, axis=axis)`. Equivalent to `CAReduce(scalar.and\_, axis=axis)`.
""" """
__props__ = ("axis")
def __init__(self, axis=None): def __init__(self, axis=None):
CAReduce.__init__(self, scalar.and_, axis) CAReduce.__init__(self, scalar.and_, axis)
...@@ -1746,6 +1750,7 @@ class Any(CAReduce): ...@@ -1746,6 +1750,7 @@ class Any(CAReduce):
Equivalent to `CAReduce(scalar.or\_, axis=axis)`. Equivalent to `CAReduce(scalar.or\_, axis=axis)`.
""" """
__props__ = ("axis")
def __init__(self, axis=None): def __init__(self, axis=None):
CAReduce.__init__(self, scalar.or_, axis) CAReduce.__init__(self, scalar.or_, axis)
...@@ -1823,6 +1828,7 @@ class CAReduceDtype(CAReduce): ...@@ -1823,6 +1828,7 @@ class CAReduceDtype(CAReduce):
* for complex dtypes, we use at least complex128. * for complex dtypes, we use at least complex128.
""" """
__props__ = ("scalar_op", "axis", "dtype", "acc_dtype")
def __init__(self, scalar_op, axis=None, dtype=None, acc_dtype=None): def __init__(self, scalar_op, axis=None, dtype=None, acc_dtype=None):
CAReduce.__init__(self, scalar_op, axis=axis) CAReduce.__init__(self, scalar_op, axis=axis)
...@@ -1981,6 +1987,8 @@ class Sum(CAReduceDtype): ...@@ -1981,6 +1987,8 @@ class Sum(CAReduceDtype):
""" """
__props__ = ("axis", "dtype", "acc_dtype")
def __init__(self, axis=None, dtype=None, acc_dtype=None): def __init__(self, axis=None, dtype=None, acc_dtype=None):
CAReduceDtype.__init__(self, scalar.add, axis=axis, CAReduceDtype.__init__(self, scalar.add, axis=axis,
dtype=dtype, acc_dtype=acc_dtype) dtype=dtype, acc_dtype=acc_dtype)
...@@ -2029,6 +2037,7 @@ class Prod(CAReduceDtype): ...@@ -2029,6 +2037,7 @@ class Prod(CAReduceDtype):
input. input.
""" """
__props__ = ("axis", "dtype", "acc_dtype")
def __init__(self, axis=None, dtype=None, acc_dtype=None, def __init__(self, axis=None, dtype=None, acc_dtype=None,
no_zeros_in_input=False): no_zeros_in_input=False):
...@@ -2211,6 +2220,9 @@ mul_without_zeros = MulWithoutZeros(scalar.upcast_out, ...@@ -2211,6 +2220,9 @@ mul_without_zeros = MulWithoutZeros(scalar.upcast_out,
class ProdWithoutZeros(CAReduceDtype): class ProdWithoutZeros(CAReduceDtype):
__props__ = ("axis", "dtype", "acc_dtype")
def __init__(self, axis=None, dtype=None, acc_dtype=None): def __init__(self, axis=None, dtype=None, acc_dtype=None):
CAReduceDtype.__init__(self, mul_without_zeros, axis=axis, CAReduceDtype.__init__(self, mul_without_zeros, axis=axis,
dtype=dtype, acc_dtype=acc_dtype) dtype=dtype, acc_dtype=acc_dtype)
......
...@@ -2246,6 +2246,8 @@ AllocDimshuffleGradTester2 = makeBroadcastTester( ...@@ -2246,6 +2246,8 @@ AllocDimshuffleGradTester2 = makeBroadcastTester(
class ApplyDefaultTestOp(theano.Op): class ApplyDefaultTestOp(theano.Op):
__props__ = ("id")
def __init__(self, id): def __init__(self, id):
self.default_output = id self.default_output = id
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论