Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nerf-pytorch
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songxinkai
nerf-pytorch
Commits
581ea38d
Unverified
Commit
581ea38d
authored
Apr 14, 2020
by
Krishna Murthy
Committed by
GitHub
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor bugfix in sample_pdf
parent
f913df59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
run_nerf_helpers.py
+2
-3
No files found.
run_nerf_helpers.py
View file @
581ea38d
...
...
@@ -225,7 +225,7 @@ def sample_pdf(bins, weights, N_samples, det=False, pytest=False):
u
=
u
.
contiguous
()
inds
=
searchsorted
(
cdf
,
u
,
side
=
'right'
)
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)
# cdf_g = tf.gather(cdf, inds_g, axis=-1, batch_dims=len(inds_g.shape)-2)
...
...
@@ -239,4 +239,4 @@ def sample_pdf(bins, weights, N_samples, det=False, pytest=False):
t
=
(
u
-
cdf_g
[
...
,
0
])
/
denom
samples
=
bins_g
[
...
,
0
]
+
t
*
(
bins_g
[
...
,
1
]
-
bins_g
[
...
,
0
])
return
samples
\ No newline at end of file
return
samples
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment