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
ea8d78e4
Unverified
Commit
ea8d78e4
authored
Apr 15, 2020
by
Yen-Chen Lin
Committed by
GitHub
Apr 15, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from krrish94/patch-1
Minor bugfix in sample_pdf
parents
f913df59
581ea38d
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 @
ea8d78e4
...
...
@@ -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