class_docstr: Custom override of `torch.nn.AdaptiveAvgPool1d` to use `LightwoodAutocast()` and handle dimensions in the way we need to.
class_docstr_tok: ["Custom","override","of","`","torch.nn.AdaptiveAvgPool1d","`","to","use","`","LightwoodAutocast","(",")","`","and","handle","dimensions","in","the","way","we","need","to","."]
code: def forward(self, input):
      with LightwoodAutocast():
          n, c, _, _ = input.size()
          input = input.view(n, c, 1).permute(0, 2, 1)
          pooled = torch.nn.functional.adaptive_avg_pool1d(
              input, self.output_size
          )
          _, _, c = pooled.size()
          pooled = pooled.permute(0, 2, 1)
          return pooled.view(n, c)
  
file_path: lightwood/lightwood/encoder/image/helpers/img_to_vec.py
imports: import torch
  import torch.nn
  from lightwood.helpers.device import get_device_from_name
  from lightwood.helpers.torch import LightwoodAutocast
  from lightwood.helpers.log import log
label_desc: Use image node_id 1 for calling the ChannelPoolAdaptiveAvg1d obj's underlying member method code with example usage: obj.forward(input) and returns: pooled