mirror of
https://github.com/ROCm/jax.git
synced 2025-04-17 04:16:07 +00:00
Added a note about squared distances
This commit is contained in:
parent
3d1e419e0d
commit
06d41fbad1
@ -56,6 +56,9 @@ def main(unused_argv):
|
||||
def softplus(x):
|
||||
return np.logaddexp(x, 0.)
|
||||
|
||||
# Note, writing out the vectorized form of the identity
|
||||
# ||x-y||^2 = <x-y,x-y> = ||x||^2 + ||y||^2 - 2<x,y>
|
||||
# for computing squared distances would be more efficient (but less succinct).
|
||||
def exp_quadratic(x1, x2):
|
||||
return np.exp(-np.sum((x1 - x2)**2))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user