class_docstr: Adds position weights to id list features.
  
  Args:
      `max_length`, a.k.a truncation size, specifies the maximum number of ids
      each sample has. For each feature, its position weight parameter size is
      `max_length`.
class_docstr_tok: ["Adds","position","weights","to","id","list","features",".","Args",":","`","max_length","`",",","a.k.a","truncation","size",",","specifies","the","maximum","number","of","ids","each","sample","has",".","For","each","feature",",","its","position","weight","parameter","size","is","`","max_length","`","."]
docstr: Args:
      features (JaggedTensor]): feature representation
  
  Returns:
      JaggedTensor: same as input features with `weights` field being populated.
docstr_tok: ["Args",":","features","(","JaggedTensor","]",")",":","feature","representation","Returns",":","JaggedTensor",":","same","as","input","features","with","`","weights","`","field","being","populated","."]
code: def forward(
      self,
      features: JaggedTensor,
  ) -> JaggedTensor:
      """
      Args:
          features (JaggedTensor]): feature representation
  
      Returns:
          JaggedTensor: same as input features with `weights` field being populated.
      """
  
      seq = torch.ops.fbgemm.offsets_range(
          features.offsets().long(), torch.numel(features.values())
      )
      weighted_features = JaggedTensor(
          values=features.values(),
          lengths=features.lengths(),
          offsets=features.offsets(),
          weights=torch.gather(self.position_weight, dim=0, index=seq),
      )
      return weighted_features
  
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 3 for calling the PositionWeightedModule obj's underlying member method code with example usage: obj.forward(features) and returns: weighted_features