docstr: The conventional implementation of convolutions.
  Unfolding the input by having a window shifting to the right.
docstr_tok: ["The","conventional","implementation","of","convolutions",".","Unfolding","the","input","by","having","a","window","shifting","to","the","right","."]
code: def _forward_unfolded(
      self, x, incremental_state: Optional[Dict[str, Tensor]] = None
  ):
      """The conventional implementation of convolutions.
      Unfolding the input by having a window shifting to the right."""
      T, B, C = x.size()
      K, H = self.kernel_size, self.num_heads
      R = C // H
      assert R * H == C == self.input_size
  
      weight = self.weight.view(H, K)
      if incremental_state is not None:
          input_buffer = self._get_input_buffer(incremental_state)
          if input_buffer is not None:
              x_unfold = torch.cat(
                  [input_buffer, x.unsqueeze(3)], dim=3
              )
          else:
              # First decoder step
              x_unfold = x.unsqueeze(3).clone()
          if self.kernel_size > 1:
              self._set_input_buffer(
                  incremental_state,
                  x_unfold[:, :, :, -self.kernel_size + 1 :],
              )
          x_unfold = x_unfold.view(T * B * H, R, -1)
      else:
          # unfold the input: T x B x C --> T' x B x C x K
          x_unfold = unfold1d(x, self.kernel_size, self.padding_l, 0.0)
          x_unfold = x_unfold.view(T * B * H, R, K)
  
      if incremental_state is not None:
          weight = weight[:, -(x_unfold.size(2)) :]
          K = weight.size(1)
  
      weight = (
          weight.view(1, H, K)
          .expand(T * B, H, K)
          .contiguous()
          .view(T * B * H, K, 1)
      )
  
      output = torch.bmm(x_unfold, weight)  # T*B*H x R x 1
      output = output.view(T, B, C)
      return output
  
file_path: pytext/pytext/models/seq_models/light_conv.py
imports: from typing import Dict, Optional
  import torch.jit
  import torch.nn
  from pytext.config import ConfigBase
  from torch import Tensor
  from .base import PyTextIncrementalDecoderComponent
  from .utils import unfold1d
label_desc: Use image node_id 5 for calling the LightweightConv obj's underlying member method code with example usage: obj._forward_unfolded(x, incremental_state) and returns: output