forked from facebookresearch/aepsych
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to Use Vectorized Operations and Transition from NumPy to Py…
…Torch Tensors (facebookresearch#406) Summary: This PR partially solves facebookresearch#365, with changes as follows: - **Grid Generation and Meshgrid Handling (`dim_grid` and `get_lse_interval`)**: Transitioned from `np.mgrid` to `torch.meshgrid` and `torch.linspace`, simplifying setup and ensuring full compatibility with PyTorch, reducing conversion steps. - **Interpolation (`interpolate_monotonic`)**: Switched from `np.searchsorted` to `torch.searchsorted` and used `torch.where` for interpolation, enabling efficient, single-pass processing and maintaining overall consistency. - **Probability and Quantile Calculations (`get_lse_interval`)**: Updated to use `torch.distributions.Normal`, `torch.median`, and `torch.quantile`. - **Generalized Vectorization (`get_jnd_1d` and `get_jnd_multid`)**: Functions are now fully vectorized using PyTorch’s capabilities, avoiding element-wise iteration. Pull Request resolved: facebookresearch#406 Reviewed By: crasanders Differential Revision: D64563850 Pulled By: JasonKChow fbshipit-source-id: 867b86b6822eb3380a2f1e0535849b3ea44a5a05
- Loading branch information
1 parent
bbda7fe
commit a3d3a33
Showing
4 changed files
with
13,700 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.