-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Added replacable decoding functions which will be applied after the voxel grid to get color and density Reviewed By: bottler Differential Revision: D38829763 fbshipit-source-id: f21ce206c1c19548206ea2ce97d7ebea3de30a23
- Loading branch information
1 parent
24f5f4a
commit e7c609f
Showing
3 changed files
with
148 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
|
||
import unittest | ||
|
||
import torch | ||
|
||
from pytorch3d.implicitron.models.implicit_function.decoding_functions import ( | ||
IdentityDecoder, | ||
MLPDecoder, | ||
) | ||
from pytorch3d.implicitron.tools.config import expand_args_fields | ||
|
||
from tests.common_testing import TestCaseMixin | ||
|
||
|
||
class TestVoxelGrids(TestCaseMixin, unittest.TestCase): | ||
def setUp(self): | ||
torch.manual_seed(42) | ||
expand_args_fields(IdentityDecoder) | ||
expand_args_fields(MLPDecoder) | ||
|
||
def test_identity_function(self, in_shape=(33, 4, 1), n_tests=2): | ||
""" | ||
Test that identity function returns its input | ||
""" | ||
func = IdentityDecoder() | ||
for _ in range(n_tests): | ||
_in = torch.randn(in_shape) | ||
assert torch.allclose(func(_in), _in) |