class_docstr: Dynamic lightweight convolution taking T x B x C inputs
  Args:
      input_size: # of channels of the input
      kernel_size: convolution channels
      padding_l: padding to the left when using "same" padding
      num_heads: number of heads used. The weight is of shape (num_heads, 1, kernel_size)
      weight_dropout: the drop rate of the DropConnect to drop the weight
      weight_softmax: normalize the weight with softmax before the convolution
      renorm_padding: re-normalize the filters to ignore the padded part (only the non-padding parts sum up to 1)
      bias: use bias
      conv_bias: bias of the convolution
      query_size: specified when feeding a different input as the query
      in_proj: project the input and generate the filter together
  
  Shape:
      Input: TxBxC, i.e. (timesteps, batch_size, input_size)
      Output: TxBxC, i.e. (timesteps, batch_size, input_size)
  
  Attributes:
      weight: the learnable weights of the module of shape
          `(num_heads, 1, kernel_size)`
      bias:   the learnable bias of the module of shape `(input_size)`
class_docstr_tok: ["Dynamic","lightweight","convolution","taking","T","x","B","x","C","inputs","Args",":","input_size",":","#","of","channels","of","the","input","kernel_size",":","convolution","channels","padding_l",":","padding","to","the","left","when","using","``","same","''","padding","num_heads",":","number","of","heads","used",".","The","weight","is","of","shape","(","num_heads",",","1",",","kernel_size",")","weight_dropout",":","the","drop","rate","of","the","DropConnect","to","drop","the","weight","weight_softmax",":","normalize","the","weight","with","softmax","before","the","convolution","renorm_padding",":","re-normalize","the","filters","to","ignore","the","padded","part","(","only","the","non-padding","parts","sum","up","to","1",")","bias",":","use","bias","conv_bias",":","bias","of","the","convolution","query_size",":","specified","when","feeding","a","different","input","as","the","query","in_proj",":","project","the","input","and","generate","the","filter","together","Shape",":","Input",":","TxBxC",",","i.e",".","(","timesteps",",","batch_size",",","input_size",")","Output",":","TxBxC",",","i.e",".","(","timesteps",",","batch_size",",","input_size",")","Attributes",":","weight",":","the","learnable","weights","of","the","module","of","shape","`","(","num_heads",",","1",",","kernel_size",")","`","bias",":","the","learnable","bias","of","the","module","of","shape","`","(","input_size",")","`"]
docstr: Turn the convolution filters into band matrices and do matrix multiplication.
  This is faster when the sequence is short, but less memory efficient.
  This is not used in the decoder during inference.
docstr_tok: ["Turn","the","convolution","filters","into","band","matrices","and","do","matrix","multiplication",".","This","is","faster","when","the","sequence","is","short",",","but","less","memory","efficient",".","This","is","not","used","in","the","decoder","during","inference","."]
code: def _forward_expanded(self, x, incremental_stat, query):
      """Turn the convolution filters into band matrices and do matrix multiplication.
      This is faster when the sequence is short, but less memory efficient.
      This is not used in the decoder during inference.
      """
      T, B, C = x.size()
      K, H = self.kernel_size, self.num_heads
      R = C // H
      assert R * H == C == self.input_size
      if self.in_proj:
          proj = self.weight_linear(x)
          x = proj.narrow(2, 0, self.input_size).contiguous()
          weight = (
              proj.narrow(2, self.input_size, H * K)
              .contiguous()
              .view(T * B * H, -1)
          )
      else:
          weight = self.weight_linear(query).view(T * B * H, -1)
  
      if not self.renorm_padding:
          if self.weight_softmax:
              weight = F.softmax(weight, dim=1)
          weight = self.weight_dropout_module(weight, inplace=False)
      weight = weight.narrow(1, 0, K).contiguous()
      weight = weight.view(T, B * H, K).transpose(0, 1)
  
      x = x.view(T, B * H, R).transpose(0, 1)
      if self.weight_softmax and self.renorm_padding:
          # turn the convolution filters into band matrices
          weight_expanded = weight.new(B * H, T, T + K - 1).fill_(
              float("-inf")
          )
          weight_expanded.as_strided(
              (B * H, T, K), (T * (T + K - 1), T + K, 1)
          ).copy_(weight)
          weight_expanded = weight_expanded.narrow(2, self.padding_l, T)
          # normalize the weight over valid positions like self-attention
          weight_expanded = F.softmax(weight_expanded, dim=2)
          weight_expanded = self.weight_dropout_module(
              weight_expanded, inplace=False
          )
      else:
          P = self.padding_l
          # For efficiency, we cut the kernel size and reduce the padding when the kernel is larger than the length
          if K > T and P == K - 1:
              weight = weight.narrow(2, K - T, T)
              K, P = T, T - 1
          # turn the convolution filters into band matrices
          weight_expanded = weight.new_zeros(
              B * H, T, T + K - 1, requires_grad=False
          )
          weight_expanded.as_strided(
              (B * H, T, K), (T * (T + K - 1), T + K, 1)
          ).copy_(weight)
          weight_expanded = weight_expanded.narrow(
              2, P, T
          )  # B*H x T x T
      output = torch.bmm(weight_expanded, x)
      output = output.transpose(0, 1).contiguous().view(T, B, C)
      return output
  
imports: from typing import Dict, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import utils
  from fairseq.incremental_decoding_utils import FairseqIncrementalState, with_incremental_state
  from fairseq.modules.fairseq_dropout import FairseqDropout
  from torch import Tensor
  from .unfold import unfold1d
label_desc: Use image node_id 6 for calling the DynamicConv1dTBC obj's underlying member method code with example usage: obj._forward_expanded(x, incremental_stat, query) and returns: output