Esempio n. 1
0
 lambda left: np.log2(left),
 "sig":
 lambda left: 1. / (1. + np.exp(-left)),
 "sig2":
 lambda left: 1. / (1. + np.exp2(-left)),
 "tanh":
 lambda left: np.tanh(left),
 "tanh2":
 lambda left: (np.exp2(2. * left) - 1.) / (np.exp2(2. * left) + 1.),
 "transpose":
 lambda left: np.transpose(left),
 "rint":
 lambda left: np.rint(left),
 # binary ops
 "add":
 lambda left, right: math_cpu.add(left, right),
 "sub":
 lambda left, right: math_cpu.sub(left, right),
 "mul":
 lambda left, right: math_cpu.mul(left, right),
 "div":
 lambda left, right: math_cpu.div(left, right),
 "eq":
 lambda left, right: left == right,
 "ne":
 lambda left, right: left != right,
 "lt":
 lambda left, right: left < right,
 "le":
 lambda left, right: left <= right,
 "gt":
Esempio n. 2
0
 "sgn": lambda left: np.sign(left),
 "sqrt": lambda left: math_cpu.sqrt(left),
 "sqr": lambda left: math_cpu.square(left),
 "exp": lambda left: math_cpu.exp(left),
 "log": lambda left: math_cpu.log(left),
 "safelog": lambda left: math_cpu.safelog(left),
 "exp2": lambda left: np.exp2(left),
 "log2": lambda left: np.log2(left),
 "sig": lambda left: 1. / (1. + np.exp(-left)),
 "sig2": lambda left: 1. / (1. + np.exp2(-left)),
 "tanh": lambda left: np.tanh(left),
 "tanh2": lambda left: (np.exp2(2. * left) - 1.) / (np.exp2(2. * left) + 1.),
 "transpose": lambda left: np.transpose(left),
 "rint": lambda left: np.rint(left),
 # binary ops
 "add": lambda left, right: math_cpu.add(left, right),
 "sub": lambda left, right: math_cpu.sub(left, right),
 "mul": lambda left, right: math_cpu.mul(left, right),
 "div": lambda left, right: math_cpu.div(left, right),
 "eq": lambda left, right: left == right,
 "ne": lambda left, right: left != right,
 "lt": lambda left, right: left < right,
 "le": lambda left, right: left <= right,
 "gt": lambda left, right: left > right,
 "ge": lambda left, right: left >= right,
 "pow": lambda left, right: np.power(left, right),
 "minimum": lambda left, right: np.minimum(left, right),
 "maximum": lambda left, right: np.maximum(left, right),
 "dot": lambda left, right: np.dot(left, right),
 # reduction ops
 "sum": lambda op_dict, left: math_cpu.sum(left, axis=op_dict['axis'], keepdims=True),