def round(arg, name=None): """ The output of this operation is the element wise value rounded to the nearest integer. In case of tie, where element can have exact fractional part of 0.5 this operation follows "round half-up" tie breaking strategy. This is different from the round operation of numpy which follows round half to even. Example: >>> C.eval(C.round([0.2, 1.3, 4., 5.5, 0.0])) [array([[ 0., 1., 4., 6., 0.]])] >>> C.eval(C.round([[0.6, 3.3], [1.9, 5.6]])) [array([[[ 1., 3.], [ 2., 6.]]])] >>> C.eval(C.round([-5.5, -4.2, -3., -0.7, 0])) [array([[-5., -4., -3., -1., 0.]])] >>> C.eval(C.round([[-0.6, -4.3], [1.9, -3.2]])) [array([[[-1., -4.], [ 2., -3.]]])] Args: arg: input tensor name (str): the name of the node in the network (optional) Returns: :class:`cntk.graph.ComputationNode` """ from cntk.ops.cntk2 import Round op = Round(arg, name=name) wrap_numpy_arrays(op) op.rank = op._.rank return op
def round(arg, name=None): """ The output of this operation is the element wise value rounded to the nearest integer. In case of tie, where element can have exact fractional part of 0.5 this operation follows "round half-up" tie breaking strategy. This is different from the round operation of numpy which follows round half to even. Example: >>> C.eval(C.round([0.2, 1.3, 4., 5.5, 0.0])) [array([[ 0., 1., 4., 6., 0.]])] >>> C.eval(C.round([[0.6, 3.3], [1.9, 5.6]])) [array([[[ 1., 3.], [ 2., 6.]]])] >>> C.eval(C.round([-5.5, -4.2, -3., -0.7, 0])) [array([[-5., -4., -3., -1., 0.]])] >>> C.eval(C.round([[-0.6, -4.3], [1.9, -3.2]])) [array([[[-1., -4.], [ 2., -3.]]])] Args: arg: input tensor name: the name of the node in the network (optional) Returns: :class:`cntk.graph.ComputationNode` """ from cntk.ops.cntk2 import Round op = Round(arg, name = name) wrap_numpy_arrays(op) op.rank = op._.rank return op