Elementwise
Elementwise ops operate on a per element basis. They don't change the shape of the tensor.
Unary Ops (math)¤
exp
¤
exp()
Elementwise e ** x.
Source code in stackgrad/tensor.py
313 314 315 | |
recip
¤
recip()
Source code in stackgrad/tensor.py
320 321 | |
abs
¤
abs()
Source code in stackgrad/tensor.py
332 333 | |
clamp
¤
clamp(min_val=None, max_val=None)
Source code in stackgrad/tensor.py
335 336 337 338 339 340 341 | |
cast
¤
cast(dtype)
Convert to dtype ("float32", "bfloat16", ...); the gradient comes back in the old dtype.
Source code in stackgrad/tensor.py
309 310 311 | |
Unary Ops (activation)¤
relu
¤
relu()
Source code in stackgrad/tensor.py
326 327 | |
sigmoid
¤
sigmoid()
Source code in stackgrad/tensor.py
323 324 | |
tanh
¤
tanh()
Source code in stackgrad/tensor.py
329 330 | |
Ternary Ops¤
where
¤
where(cond, x, y)
Elementwise x if cond else y. cond is a mask and gets no gradient.
Source code in stackgrad/tensor.py
408 409 410 411 412 413 | |