remove torchsearchsorted dependency
This commit is contained in:
parent
58a12a9e81
commit
56033b32f5
3 changed files with 5 additions and 7 deletions
|
@ -14,9 +14,6 @@ This project is a faithful PyTorch implementation of [NeRF](http://www.matthewta
|
||||||
git clone https://github.com/yenchenlin/nerf-pytorch.git
|
git clone https://github.com/yenchenlin/nerf-pytorch.git
|
||||||
cd nerf-pytorch
|
cd nerf-pytorch
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
cd torchsearchsorted
|
|
||||||
pip install .
|
|
||||||
cd ../
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
torch>=1.4.0
|
torch>=1.7.0
|
||||||
torchvision>=0.2.1
|
torchvision>=0.2.1
|
||||||
imageio
|
imageio
|
||||||
imageio-ffmpeg
|
imageio-ffmpeg
|
||||||
matplotlib
|
matplotlib
|
||||||
configargparse
|
configargparse
|
||||||
tensorboard==1.14.0
|
tensorboard==1.15.0
|
||||||
tqdm
|
tqdm
|
||||||
opencv-python
|
opencv-python
|
||||||
|
|
|
@ -5,7 +5,7 @@ import torch.nn.functional as F
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
# TODO: remove this dependency
|
# TODO: remove this dependency
|
||||||
from torchsearchsorted import searchsorted
|
#from torchsearchsorted import searchsorted
|
||||||
|
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
@ -232,7 +232,8 @@ def sample_pdf(bins, weights, N_samples, det=False, pytest=False):
|
||||||
|
|
||||||
# Invert CDF
|
# Invert CDF
|
||||||
u = u.contiguous()
|
u = u.contiguous()
|
||||||
inds = searchsorted(cdf, u, side='right')
|
# inds = searchsorted(cdf, u, side='right')
|
||||||
|
inds = torch.searchsorted(cdf, u, right=True)
|
||||||
below = torch.max(torch.zeros_like(inds-1), inds-1)
|
below = torch.max(torch.zeros_like(inds-1), inds-1)
|
||||||
above = torch.min((cdf.shape[-1]-1) * torch.ones_like(inds), inds)
|
above = torch.min((cdf.shape[-1]-1) * torch.ones_like(inds), inds)
|
||||||
inds_g = torch.stack([below, above], -1) # (batch, N_samples, 2)
|
inds_g = torch.stack([below, above], -1) # (batch, N_samples, 2)
|
||||||
|
|
Loading…
Reference in a new issue