code: def calc_length(
      lengths,
      all_paddings,
      kernel_size,
      stride,
      ceil_mode,
      repeat_num=1,
  ):
      """Calculates the output length of a Tensor passed through a convolution or max pooling layer"""
      add_pad: float = all_paddings - kernel_size
      one: float = 1.0
      for i in range(repeat_num):
          lengths = (
              torch.div(lengths.to(dtype=torch.float) + add_pad, stride)
              + one
          )
          if ceil_mode:
              lengths = torch.ceil(lengths)
          else:
              lengths = torch.floor(lengths)
      return lengths.to(dtype=torch.int)
  
imports: import math
  import torch
  import torch.nn
  from torch.nn import LayerNorm
  from nemo.collections.asr.parts.submodules.causal_convs import CausalConv1D, CausalConv2D
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: calc_length(lengths, all_paddings, kernel_size, stride, ceil_mode, repeat_num) and returns: lengths