Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nerfacc
Commits
e0a0db1e
Commit
e0a0db1e
authored
Sep 13, 2022
by
Ruilong Li
Browse files
get rid of scatter max
parent
b73fa67b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
nerfacc/occupancy_field.py
nerfacc/occupancy_field.py
+4
-2
requirements.txt
requirements.txt
+2
-1
No files found.
nerfacc/occupancy_field.py
View file @
e0a0db1e
...
@@ -2,7 +2,8 @@ from typing import Callable, List, Tuple, Union
...
@@ -2,7 +2,8 @@ from typing import Callable, List, Tuple, Union
import
torch
import
torch
from
torch
import
nn
from
torch
import
nn
from
torch_scatter
import
scatter_max
# from torch_scatter import scatter_max
def
meshgrid3d
(
res
:
Tuple
[
int
,
int
,
int
],
device
:
torch
.
device
=
"cpu"
):
def
meshgrid3d
(
res
:
Tuple
[
int
,
int
,
int
],
device
:
torch
.
device
=
"cpu"
):
...
@@ -146,7 +147,8 @@ class OccupancyField(nn.Module):
...
@@ -146,7 +147,8 @@ class OccupancyField(nn.Module):
bb_min
,
bb_max
=
torch
.
split
(
self
.
aabb
,
[
self
.
num_dim
,
self
.
num_dim
],
dim
=
0
)
bb_min
,
bb_max
=
torch
.
split
(
self
.
aabb
,
[
self
.
num_dim
,
self
.
num_dim
],
dim
=
0
)
x
=
x
*
(
bb_max
-
bb_min
)
+
bb_min
x
=
x
*
(
bb_max
-
bb_min
)
+
bb_min
tmp_occ
=
self
.
occ_eval_fn
(
x
).
squeeze
(
-
1
)
tmp_occ
=
self
.
occ_eval_fn
(
x
).
squeeze
(
-
1
)
tmp_occ_grid
,
_
=
scatter_max
(
tmp_occ
,
indices
,
dim
=
0
,
out
=
tmp_occ_grid
)
tmp_occ_grid
[
indices
]
=
tmp_occ
# tmp_occ_grid, _ = scatter_max(tmp_occ, indices, dim=0, out=tmp_occ_grid)
# ema update
# ema update
ema_mask
=
(
self
.
occ_grid
>=
0
)
&
(
tmp_occ_grid
>=
0
)
ema_mask
=
(
self
.
occ_grid
>=
0
)
&
(
tmp_occ_grid
>=
0
)
...
...
requirements.txt
View file @
e0a0db1e
ninja
ninja
pybind11
pybind11
torch
torch
# torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cu102.html
\ No newline at end of file
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