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)
def negative(node, name=None): # type: (NodeInput, str) -> Node """Return node which applies f(x) = -x to the input node elementwise.""" return Negative(node)