mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-03 12:22:49 +08:00
Summary: Currently some implicit functions in implicitron take a raybundle, others take ray_points_world. raybundle is what they really need. However, the raybundle is going to become a bit more flexible later, as it will contain different numbers of rays for each camera. Reviewed By: bottler Differential Revision: D39173751 fbshipit-source-id: ebc038e426d22e831e67a18ba64655d8a61e1eb9
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
# 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.
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Optional
|
|
|
|
from pytorch3d.implicitron.tools.config import ReplaceableBase
|
|
from pytorch3d.renderer.cameras import CamerasBase
|
|
from pytorch3d.renderer.implicit import RayBundle
|
|
|
|
|
|
class ImplicitFunctionBase(ABC, ReplaceableBase):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
@abstractmethod
|
|
def forward(
|
|
self,
|
|
*,
|
|
ray_bundle: RayBundle,
|
|
fun_viewpool=None,
|
|
camera: Optional[CamerasBase] = None,
|
|
global_code=None,
|
|
**kwargs,
|
|
):
|
|
raise NotImplementedError()
|
|
|
|
@staticmethod
|
|
def allows_multiple_passes() -> bool:
|
|
"""
|
|
Returns True if this implicit function allows
|
|
multiple passes.
|
|
"""
|
|
return False
|
|
|
|
@staticmethod
|
|
def requires_pooling_without_aggregation() -> bool:
|
|
"""
|
|
Returns True if this implicit function needs
|
|
pooling without aggregation.
|
|
"""
|
|
return False
|
|
|
|
def on_bind_args(self) -> None:
|
|
"""
|
|
Called when the custom args are fixed in the main model forward pass.
|
|
"""
|
|
pass
|