added skeleton code and basic documentation for ElementDivide
This commit is contained in:
Родитель
e3d651af9c
Коммит
89ba97bca9
|
@ -93,6 +93,18 @@ class ComputationNode(object):
|
||||||
# NOTE supported in Python 3.5
|
# NOTE supported in Python 3.5
|
||||||
return Times(other, self)
|
return Times(other, self)
|
||||||
|
|
||||||
|
def __div__(self, other):
|
||||||
|
if not isinstance(other, ComputationNode):
|
||||||
|
# TODO: in case of non-scalars we have to pull in a reader
|
||||||
|
other = constant(other)
|
||||||
|
return ElementDivide(self, other)
|
||||||
|
|
||||||
|
def __rdiv__(self, other):
|
||||||
|
if not isinstance(other, ComputationNode):
|
||||||
|
# TODO: in case of non-scalars we have to pull in a reader
|
||||||
|
other = constant(other)
|
||||||
|
return ElementDivide(other, self)
|
||||||
|
|
||||||
def __abs__(self):
|
def __abs__(self):
|
||||||
return Abs(self)
|
return Abs(self)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from cntk.ops.cntk1 import Times, Plus
|
||||||
|
|
||||||
def plus(left_operand, right_operand, name=None):
|
def plus(left_operand, right_operand, name=None):
|
||||||
"""
|
"""
|
||||||
tensor addition opearation
|
tensor addition operation
|
||||||
Args:
|
Args:
|
||||||
left_operand: Left side tensor
|
left_operand: Left side tensor
|
||||||
right_operand: Right side tensor
|
right_operand: Right side tensor
|
||||||
|
@ -25,7 +25,7 @@ def plus(left_operand, right_operand, name=None):
|
||||||
|
|
||||||
def times(left_operand, right_operand, name=None):
|
def times(left_operand, right_operand, name=None):
|
||||||
"""
|
"""
|
||||||
tensor times opearation
|
tensor times operation
|
||||||
Args:
|
Args:
|
||||||
left_operand: Left side tensor
|
left_operand: Left side tensor
|
||||||
right_operand: Right side tensor
|
right_operand: Right side tensor
|
||||||
|
@ -36,4 +36,15 @@ def times(left_operand, right_operand, name=None):
|
||||||
|
|
||||||
return Times(left_operand, right_operand, var_name = name)
|
return Times(left_operand, right_operand, var_name = name)
|
||||||
|
|
||||||
|
def element_divide(left_operand, right_operand, name=None):
|
||||||
|
"""
|
||||||
|
element-wise division operation
|
||||||
|
Args:
|
||||||
|
left_operand: Left side tensor
|
||||||
|
right_operand: Right side tensor
|
||||||
|
var_name: the name of the node in the network
|
||||||
|
Returns:
|
||||||
|
ElementDivide node
|
||||||
|
"""
|
||||||
|
|
||||||
|
return ElementDivide(left_operand, right_operand, var_name = name)
|
Загрузка…
Ссылка в новой задаче