class_docstr: Base class for aggregating features.
  
  Typically, the aggregated features and their masks are output by `ViewSampler`
  which samples feature tensors extracted from a set of source images.
  
  Settings:
      exclude_target_view: If `True`/`False`, enables/disables pooling
          from target view to itself.
      exclude_target_view_mask_features: If `True`,
          mask the features from the target view before aggregation
      concatenate_output: If `True`,
          concatenate the aggregated features into a single tensor,
          otherwise return a dictionary mapping feature names to tensors.
class_docstr_tok: ["Base","class","for","aggregating","features",".","Typically",",","the","aggregated","features","and","their","masks","are","output","by","`","ViewSampler","`","which","samples","feature","tensors","extracted","from","a","set","of","source","images",".","Settings",":","exclude_target_view",":","If","`","True","`","\/","`","False","`",",","enables\/disables","pooling","from","target","view","to","itself",".","exclude_target_view_mask_features",":","If","`","True","`",",","mask","the","features","from","the","target","view","before","aggregation","concatenate_output",":","If","`","True","`",",","concatenate","the","aggregated","features","into","a","single","tensor",",","otherwise","return","a","dictionary","mapping","feature","names","to","tensors","."]
docstr: Args:
      feats_sampled: A `dict` of sampled feature tensors `{f_i: t_i}`,
          where each `t_i` is a tensor of shape
          `(minibatch, n_source_views, n_samples, dim_i)`.
      masks_sampled: A binary mask represented as a tensor of shape
          `(minibatch, n_source_views, n_samples, 1)` denoting valid
          sampled features.
      camera: A batch of `n_source_views` `CamerasBase` objects corresponding
          to the source view cameras.
      pts: A tensor of shape `(minibatch, n_samples, 3)` denoting the
          3D points whose 2D projections to source views were sampled in
          order to generate `feats_sampled` and `masks_sampled`.
  
  Returns:
      feats_aggregated: If `concatenate_output==True`, a tensor
          of shape `(minibatch, reduce_dim, n_samples, sum(dim_1, ... dim_N))`
          containing the concatenation of the aggregated features `feats_sampled`.
          `reduce_dim` depends on the specific feature aggregator
          implementation and typically equals 1 or `n_source_views`.
          If `concatenate_output==False`, the aggregator does not concatenate
          the aggregated features and returns a dictionary of per-feature
          aggregations `{f_i: t_i_aggregated}` instead. Each `t_i_aggregated`
          is of shape `(minibatch, reduce_dim, n_samples, aggr_dim_i)`.
docstr_tok: ["Args",":","feats_sampled",":","A","`","dict","`","of","sampled","feature","tensors","`","{","f_i",":","t_i","}","`",",","where","each","`","t_i","`","is","a","tensor","of","shape","`","(","minibatch",",","n_source_views",",","n_samples",",","dim_i",")","`",".","masks_sampled",":","A","binary","mask","represented","as","a","tensor","of","shape","`","(","minibatch",",","n_source_views",",","n_samples",",","1",")","`","denoting","valid","sampled","features",".","camera",":","A","batch","of","`","n_source_views","`","`","CamerasBase","`","objects","corresponding","to","the","source","view","cameras",".","pts",":","A","tensor","of","shape","`","(","minibatch",",","n_samples",",","3",")","`","denoting","the","3D","points","whose","2D","projections","to","source","views","were","sampled","in","order","to","generate","`","feats_sampled","`","and","`","masks_sampled","`",".","Returns",":","feats_aggregated",":","If","`","concatenate_output==True","`",",","a","tensor","of","shape","`","(","minibatch",",","reduce_dim",",","n_samples",",","sum","(","dim_1",",","...","dim_N",")",")","`","containing","the","concatenation","of","the","aggregated","features","`","feats_sampled","`",".","`","reduce_dim","`","depends","on","the","specific","feature","aggregator","implementation","and","typically","equals","1","or","`","n_source_views","`",".","If","`","concatenate_output==False","`",",","the","aggregator","does","not","concatenate","the","aggregated","features","and","returns","a","dictionary","of","per-feature","aggregations","`","{","f_i",":","t_i_aggregated","}","`","instead",".","Each","`","t_i_aggregated","`","is","of","shape","`","(","minibatch",",","reduce_dim",",","n_samples",",","aggr_dim_i",")","`","."]
code: def forward(
      self,
      feats_sampled: Dict[str, torch.Tensor],
      masks_sampled: torch.Tensor,
      camera: Optional[CamerasBase] = None,
      pts: Optional[torch.Tensor] = None,
      **kwargs,
  ) -> Union[torch.Tensor, Dict[str, torch.Tensor]]:
      """
      Args:
          feats_sampled: A `dict` of sampled feature tensors `{f_i: t_i}`,
              where each `t_i` is a tensor of shape
              `(minibatch, n_source_views, n_samples, dim_i)`.
          masks_sampled: A binary mask represented as a tensor of shape
              `(minibatch, n_source_views, n_samples, 1)` denoting valid
              sampled features.
          camera: A batch of `n_source_views` `CamerasBase` objects corresponding
              to the source view cameras.
          pts: A tensor of shape `(minibatch, n_samples, 3)` denoting the
              3D points whose 2D projections to source views were sampled in
              order to generate `feats_sampled` and `masks_sampled`.
  
      Returns:
          feats_aggregated: If `concatenate_output==True`, a tensor
              of shape `(minibatch, reduce_dim, n_samples, sum(dim_1, ... dim_N))`
              containing the concatenation of the aggregated features `feats_sampled`.
              `reduce_dim` depends on the specific feature aggregator
              implementation and typically equals 1 or `n_source_views`.
              If `concatenate_output==False`, the aggregator does not concatenate
              the aggregated features and returns a dictionary of per-feature
              aggregations `{f_i: t_i_aggregated}` instead. Each `t_i_aggregated`
              is of shape `(minibatch, reduce_dim, n_samples, aggr_dim_i)`.
      """
      raise NotImplementedError()
  
imports: from abc import ABC, abstractmethod
  from enum import Enum
  from typing import Dict, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn.functional
  from pytorch3d.implicitron.models.view_pooler.view_sampler import cameras_points_cartesian_product
  from pytorch3d.implicitron.tools.config import registry, ReplaceableBase
  from pytorch3d.ops import wmean
  from pytorch3d.renderer.cameras import CamerasBase
label_desc: Use image node_id 1 for calling the FeatureAggregatorBase obj's underlying member method code with example usage: obj.forward(feats_sampled, masks_sampled, camera, pts) without return types