code: def __init__(
      self,
      max_feature_lengths: Dict[str, int],
      device: Optional[torch.device] = None,
  ) -> None:
      super().__init__()
      self.max_feature_lengths = max_feature_lengths
      for length in self.max_feature_lengths.values():
          if length <= 0:
              raise
  
      self.position_weights: nn.ParameterDict = nn.ParameterDict()
      # needed since nn.ParameterDict isn't torchscriptable (get_items)
      self.position_weights_dict: Dict[str, nn.Parameter] = {}
  
      for key, length in max_feature_lengths.items():
          self.position_weights[key] = nn.Parameter(
              torch.empty([length], device=device)
          )
  
          self.position_weights_dict[key] = self.position_weights[key]
  
      self.reset_parameters()
  
imports: import abc
  from typing import Dict, Optional
  import torch
  from torch import nn
  from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
label_desc: Use image node_id 1 to create a new PositionWeightedModuleCollection object from inherited base classes: FeatureProcessorsCollection with example: obj = PositionWeightedModuleCollection(max_feature_lengths, device)