class_docstr: # Special thanks to @raoyongming for the help to this function
class_docstr_tok: ["#","Special","thanks","to","@","raoyongming","for","the","help","to","this","function"]
code: def forward(ctx, input_x, fold):
      # not support higher order gradient
      # input = input.detach_()
      ctx.fold_ = fold
      n, t, _, h, w = input_x.size()
      buffer = input_x.data.new(n, t, fold, h, w).zero_()
      buffer[:, :-1] = input_x.data[:, 1:, :fold]
      input_x.data[:, :, :fold] = buffer
      buffer.zero_()
      buffer[:, 1:] = input_x.data[:, :-1, fold : 2 * fold]
      input_x.data[:, :, fold : 2 * fold] = buffer
      return input_x
  
file_path: towhee/towhee/models/tsm/temporal_shift.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  import torchvision
label_desc: Use image node_id 1 for calling the InplaceShift obj's underlying member method code with example usage: obj.forward(ctx, input_x, fold) and returns: input_x