added skeleton code and basic documentation for ElementDivide

This commit is contained in:
William Darling 2016-04-07 17:02:37 +02:00 коммит произвёл jeanfad
Родитель e3d651af9c
Коммит 89ba97bca9
2 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -93,6 +93,18 @@ class ComputationNode(object):
# NOTE supported in Python 3.5
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):
return Abs(self)

Просмотреть файл

@ -12,7 +12,7 @@ from cntk.ops.cntk1 import Times, Plus
def plus(left_operand, right_operand, name=None):
"""
tensor addition opearation
tensor addition operation
Args:
left_operand: Left 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):
"""
tensor times opearation
tensor times operation
Args:
left_operand: Left 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)
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)