class_docstr: Canonical Polyadic (CP/CANDECOMP/PARAFAC) Factorization factorizes the 3d grid into three
  vectors (x, y, z). For n_components=n, the 3d grid is a sum of the two outer products
  (call it ⊗) of each vector type (x, y, z):
  
  3d_grid = x0 ⊗ y0 ⊗ z0 + x1 ⊗ y1 ⊗ z1 + ... + xn ⊗ yn ⊗ zn
  
  These tensors are passed in a object of CPFactorizedVoxelGridValues (here obj) as
  obj.vector_components_x, obj.vector_components_y, obj.vector_components_z. Their shapes are
  `(n_components, r)` where `r` is the relevant resolution.
  
  Each element of this sum has an extra dimension, which gets matrix-multiplied by an
  appropriate "basis matrix" of shape (n_grids, n_components, n_features). This multiplication
  brings us to the desired "n_features" dimensionality. If basis_matrix=False the elements
  of different components are summed together to create (n_grids, n_components, 1) tensor.
  With some notation abuse, ignoring the interpolation operation, simplifying and denoting
  n_features as F, n_components as C and n_grids as G:
  
  3d_grid = (x ⊗ y ⊗ z) @ basis # GWHDC x GCF -> GWHDF
  
  The basis feature vectors are passed as obj.basis_matrix.
  
  Members:
      n_components: number of vector triplets, higher number gives better approximation.
      basis_matrix: how to transform components. If matrix_reduction=True result
          matrix of shape (n_grids, n_points_total, n_components) is batch matrix multiplied
          by the basis_matrix of shape (n_grids, n_components, n_features). If
          matrix_reduction=False, the result tensor of (n_grids, n_points_total, n_components)
          is summed along the rows to get (n_grids, n_points_total, 1), which is then viewed
          to return to starting shape (n_grids, ..., 1).
class_docstr_tok: ["Canonical","Polyadic","(","CP\/CANDECOMP\/PARAFAC",")","Factorization","factorizes","the","3d","grid","into","three","vectors","(","x",",","y",",","z",")",".","For","n_components=n",",","the","3d","grid","is","a","sum","of","the","two","outer","products","(","call","it","\u2297",")","of","each","vector","type","(","x",",","y",",","z",")",":","3d_grid","=","x0","\u2297","y0","\u2297","z0","+","x1","\u2297","y1","\u2297","z1","+","...","+","xn","\u2297","yn","\u2297","zn","These","tensors","are","passed","in","a","object","of","CPFactorizedVoxelGridValues","(","here","obj",")","as","obj.vector_components_x",",","obj.vector_components_y",",","obj.vector_components_z",".","Their","shapes","are","`","(","n_components",",","r",")","`","where","`","r","`","is","the","relevant","resolution",".","Each","element","of","this","sum","has","an","extra","dimension",",","which","gets","matrix-multiplied","by","an","appropriate","``","basis","matrix","''","of","shape","(","n_grids",",","n_components",",","n_features",")",".","This","multiplication","brings","us","to","the","desired","``","n_features","''","dimensionality",".","If","basis_matrix=False","the","elements","of","different","components","are","summed","together","to","create","(","n_grids",",","n_components",",","1",")","tensor",".","With","some","notation","abuse",",","ignoring","the","interpolation","operation",",","simplifying","and","denoting","n_features","as","F",",","n_components","as","C","and","n_grids","as","G",":","3d_grid","=","(","x","\u2297","y","\u2297","z",")","@","basis","#","GWHDC","x","GCF","-",">","GWHDF","The","basis","feature","vectors","are","passed","as","obj.basis_matrix",".","Members",":","n_components",":","number","of","vector","triplets",",","higher","number","gives","better","approximation",".","basis_matrix",":","how","to","transform","components",".","If","matrix_reduction=True","result","matrix","of","shape","(","n_grids",",","n_points_total",",","n_components",")","is","batch","matrix","multiplied","by","the","basis_matrix","of","shape","(","n_grids",",","n_components",",","n_features",")",".","If","matrix_reduction=False",",","the","result","tensor","of","(","n_grids",",","n_points_total",",","n_components",")","is","summed","along","the","rows","to","get","(","n_grids",",","n_points_total",",","1",")",",","which","is","then","viewed","to","return","to","starting","shape","(","n_grids",",","...",",","1",")","."]
code: def get_shapes(self, epoch: int) -> Dict[str, Tuple[int, int]]:
      if self.basis_matrix is False and self.n_features != 1:
          raise ValueError(
              "Cannot set basis_matrix=False and n_features to != 1"
          )
  
      width, height, depth = self.get_resolution(epoch=epoch)
      shape_dict = {
          "vector_components_x": (self.n_components, width),
          "vector_components_y": (self.n_components, height),
          "vector_components_z": (self.n_components, depth),
      }
      if self.basis_matrix:
          shape_dict["basis_matrix"] = (
              self.n_components,
              self.n_features,
          )
      return shape_dict
  
imports: import logging
  import warnings
  from collections.abc import Mapping
  from dataclasses import dataclass, field
  from distutils.version import LooseVersion
  from typing import Any, Callable, ClassVar, Dict, Iterator, List, Optional, Tuple, Type
  import torch
  from omegaconf import DictConfig
  from pytorch3d.implicitron.tools.config import Configurable, registry, ReplaceableBase, run_auto_creation
  from pytorch3d.structures.volumes import VolumeLocator
  from .utils import interpolate_line, interpolate_plane, interpolate_volume
label_desc: Use image node_id 2 for calling the CPFactorizedVoxelGrid obj's underlying member method code with example usage: obj.get_shapes(epoch) and returns: shape_dict