提交 7ec1396c authored 作者: James Bergstra's avatar James Bergstra

added Constant and Variable class attributes to TensorType

上级 0e59cb90
...@@ -794,6 +794,7 @@ class _tensor_py_operators: ...@@ -794,6 +794,7 @@ class _tensor_py_operators:
class TensorVariable(Variable, _tensor_py_operators): class TensorVariable(Variable, _tensor_py_operators):
"""Subclass to add the tensor operators to the basic `Variable` class.""" """Subclass to add the tensor operators to the basic `Variable` class."""
TensorType.Variable = TensorVariable
class TensorConstantSignature(tuple): class TensorConstantSignature(tuple):
"""A Signature object for comparing TensorConstant instances """A Signature object for comparing TensorConstant instances
...@@ -829,19 +830,18 @@ class TensorConstant(Constant, _tensor_py_operators): ...@@ -829,19 +830,18 @@ class TensorConstant(Constant, _tensor_py_operators):
""" """
def signature(self): def signature(self):
return TensorConstantSignature((self.type, self.data)) return TensorConstantSignature((self.type, self.data))
TensorType.Constant = TensorConstant
class TensorValue(Value, _tensor_py_operators): class TensorValue(Value, _tensor_py_operators):
"""Subclass to add the tensor operators to the basic `Value` class. """Subclass to add the tensor operators to the basic `Value` class.
To create a TensorValue, use the `value` function in this module. To create a TensorValue, use the `value` function in this module.
:note: Value is deprecated by SharedVariable
""" """
Tensor = TensorType Tensor = TensorType
TensorVariable = TensorVariable
TensorConstant = TensorConstant
TensorValue = TensorValue
#QUESTION: why are we doing this!? #QUESTION: why are we doing this!?
elemwise.as_tensor_variable = as_tensor_variable elemwise.as_tensor_variable = as_tensor_variable
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论