Commit cf9860a8 authored by Simon Ding's avatar Simon Ding
Browse files

Adding new pointwise functionality

parent dee5dfec
Pipeline #91879 passed with stages
in 11 minutes and 8 seconds
......@@ -110,6 +110,14 @@ def _softplus_helper(v):
return fv, dfv
def exponentiate(v, base):
return np.power(base, v)
def _exponentiate_helper(v, base):
return (np.power(base, v), np.log(base) * np.power(base, v))
ptw_dict = {
"sqrt": (np.sqrt, _sqrt_helper),
"sin": (np.sin, lambda v: (np.sin(v), np.cos(v))),
......@@ -131,5 +139,6 @@ ptw_dict = {
"sign": (np.sign, _sign_helper),
"power": (np.power, _power_helper),
"clip": (np.clip, _clip_helper),
"softplus": (softplus, _softplus_helper)
"softplus": (softplus, _softplus_helper),
"exponentiate": (exponentiate, _exponentiate_helper)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment