class_docstr: Encodes sequences with relative positional information as described in
  :cite:t:`https://doi.org/10.48550/arxiv.2104.09864`.
class_docstr_tok: ["Encodes","sequences","with","relative","positional","information","as","described","in",":","cite",":","t",":","`","https",":","\/\/doi.org\/10.48550\/arxiv.2104.09864","`","."]
docstr: Reset the non-persistent buffers of the module.
docstr_tok: ["Reset","the","non-persistent","buffers","of","the","module","."]
code: def reset_non_persistent_buffers(self) -> None:
      """Reset the non-persistent buffers of the module."""
      device = self.freqs.device
  
      assert self.max_seq_len is not None
  
      # As of PyTorch 2.0, `torch.polar` does not support meta device, but we
      # do not want to lose benefit of lazy initialization.
      if device == META:
          return
  
      # (S)
      steps = torch.arange(
          self.max_seq_len, device=device, dtype=torch.float32
      )
  
      # (E / 2)
      indices = torch.arange(
          0,
          self.encoding_dim,
          step=2,
          device=device,
          dtype=torch.float32,
      )
  
      freqs = 1.0 / (10000.0 ** (indices / self.encoding_dim))
  
      # (S) x (E / 2) -> (S, E / 2)
      freqs = torch.outer(steps, freqs)
  
      # (S, E / 2)
      torch.polar(torch.ones_like(freqs), freqs, out=self.freqs)
  
imports: import math
  from abc import ABC, abstractmethod
  from typing import Optional, final
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.functional import embedding
  from torch.nn.parameter import Parameter
  from fairseq2.nn.incremental_state import IncrementalStateBag
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.typing import META, DataType, Device, finaloverride
label_desc: Use image node_id 3 for calling the RotaryEncoder obj's underlying member method code with example usage: obj.reset_non_persistent_buffers() without return types