def sign(node, name=None): # type: (NodeInput, str) -> Node """Perform element-wise sign operation. :param node: One of: input node, array or scalar. :param name: The optional new name for ouptut node. :return: The node with mapped elements of the input tensor to -1 (if it is negative), 0 (if it is zero), or 1 (if it is positive). """ return Sign(node)
def unary_op(op_str, a): if op_str == 'Abs': return Abs(a) elif op_str == 'Acos': return Acos(a) elif op_str == 'Asin': return Asin(a) elif op_str == 'Atan': return Atan(a) elif op_str == 'Ceiling': return Ceiling(a) elif op_str == 'Cos': return Cos(a) elif op_str == 'Cosh': return Cosh(a) elif op_str == 'Floor': return Floor(a) elif op_str == 'log': return Log(a) elif op_str == 'exp': return Exp(a) elif op_str == 'negative': return Negative(a) elif op_str == 'Reverse': return Reverse(a, AxisSet({1})) elif op_str == 'Sign': return Sign(a) elif op_str == 'Sin': return Sin(a) elif op_str == 'Sinh': return Sinh(a) elif op_str == 'Sqrt': return Sqrt(a) elif op_str == 'Tan': return Tan(a) elif op_str == 'Tanh': return Tanh(a)