MCPcopy Create free account
hub / github.com/Newmu/dcgan_code / cosine

Function cosine

lib/ops.py:20–24  ·  view source on GitHub ↗
(x, y)

Source from the content-addressed store, hash-verified

18 return T.sqrt(T.sum(T.sqr(x), axis=axis, keepdims=keepdims) + e)
19
20def cosine(x, y):
21 d = T.dot(x, y.T)
22 d /= l2norm(x).dimshuffle(0, 'x')
23 d /= l2norm(y).dimshuffle('x', 0)
24 return d
25
26def euclidean(x, y, e=1e-8):
27 xx = T.sqr(T.sqrt((x*x).sum(axis=1) + e))

Callers 1

metrics.pyFile · 0.90

Calls 1

l2normFunction · 0.85

Tested by

no test coverage detected