class_docstr: Collapses a tensor to 2D, applies a module, and (re-)expands the tensor.
  An n-dimensional tensor of shape (s_1, s_2, ..., s_n) is first collapsed to
  a tensor with shape (s_1*s_2*...*s_n-1, s_n). The module is called with
  this as input producing (s_1*s_2*...*s_n-1, s_n') --- note that the final
  dimension can change. This is expanded to (s_1, s_2, ..., s_n-1, s_n') and
  returned.
  Args:
      module (torch.nn.Module): Module to apply. Must accept a 2D tensor as
          input and produce a 2D tensor as output, optionally changing the
          size of the last dimension.
class_docstr_tok: ["Collapses","a","tensor","to","2D",",","applies","a","module",",","and","(","re-",")","expands","the","tensor",".","An","n-dimensional","tensor","of","shape","(","s_1",",","s_2",",","...",",","s_n",")","is","first","collapsed","to","a","tensor","with","shape","(","s_1","*","s_2","*","...","*","s_n-1",",","s_n",")",".","The","module","is","called","with","this","as","input","producing","(","s_1","*","s_2","*","...","*","s_n-1",",","s_n","'",")","--","-","note","that","the","final","dimension","can","change",".","This","is","expanded","to","(","s_1",",","s_2",",","...",",","s_n-1",",","s_n","'",")","and","returned",".","Args",":","module","(","torch.nn.Module",")",":","Module","to","apply",".","Must","accept","a","2D","tensor","as","input","and","produce","a","2D","tensor","as","output",",","optionally","changing","the","size","of","the","last","dimension","."]
code: def __init__(self, module: torch.nn.Module):
      super().__init__()
      self.module = module
  
imports: import math
  from typing import List, Optional, Tuple, Union
  import numpy
  import torch
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new OverLastDim object from inherited base classes: torch.nn with example: obj = OverLastDim(module)