(x, y)
| 218 | batch_size = data.shape[0] |
| 219 | |
| 220 | def get_cosine(x, y): |
| 221 | ndim = len(x.shape) |
| 222 | axis = tuple(range(1, ndim)) |
| 223 | up = (x * y).sum(axis=axis) |
| 224 | down = norm(x, axis=axis) * norm(y, axis=axis) |
| 225 | sim = up / down |
| 226 | return sim.mean(axis=0) |
| 227 | |
| 228 | def search(mod, inputs, outputs, where): |
| 229 |