| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # All rights reserved. | |
| # | |
| # This source code is licensed under the CC-by-NC license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| import torch | |
| from torch import Tensor | |
| def get_nearest_times(time_grid: Tensor, t_discretization: Tensor) -> Tensor: | |
| distances = torch.cdist( | |
| time_grid.unsqueeze(1), | |
| t_discretization.unsqueeze(1), | |
| compute_mode="donot_use_mm_for_euclid_dist", | |
| ) | |
| nearest_indices = distances.argmin(dim=1) | |
| return t_discretization[nearest_indices] | |
Xet Storage Details
- Size:
- 577 Bytes
- Xet hash:
- 0da5373accb3b27d4f14f9f4ba9f904cd217ae76ca50d3aebe77c56c0654b157
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.