File size: 1,343 Bytes
94dc344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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.

# pyre-unsafe

from abc import ABC, abstractmethod
from typing import Optional

from pytorch3d.implicitron.models.renderer.base import ImplicitronRayBundle

from pytorch3d.implicitron.tools.config import ReplaceableBase
from pytorch3d.renderer.cameras import CamerasBase


class ImplicitFunctionBase(ABC, ReplaceableBase):
    @abstractmethod
    def forward(
        self,
        *,
        ray_bundle: ImplicitronRayBundle,
        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