code: def transform_3d_v2(
      inputs,
      rot_y,
      rot_x,
      shift,
      is_reverse,
      rot_z=None,
      use_new_rot=False,
      is_mpi=False,
  ):
      shift = (
          torch.FloatTensor([0.0, 0.0, shift])
          .type_as(inputs)
          .view(1, 1, 3)
      )
      shift = shift.expand_as(inputs)
      if is_reverse:
          outputs = inputs - shift
      else:
          root3d = (
              inputs[:, 13:14].clone()
              if inputs.shape[1] == 17
              else inputs[:, 12:13]
          )
          outputs = inputs - root3d
      if use_new_rot:
          rot_y_mat = get_rotation_y_v2(rot_y, is_mpi=is_mpi)
      else:
          rot_y_mat = get_rotation_y(rot_y)
      rot_x_mat = get_rotation_x(rot_x)
      if rot_z is None:
          rot_mat = (
              rot_x_mat.bmm(rot_y_mat)
              if not is_reverse
              else rot_y_mat.bmm(rot_x_mat)
          )
      else:
          rot_z_mat = get_rotation_z(rot_z)
          rot_mat = (
              rot_z_mat.bmm(rot_x_mat).bmm(rot_y_mat)
              if not is_reverse
              else rot_y_mat.bmm(rot_x_mat).bmm(rot_z_mat)
          )
      # N x 3 x 3 , ((N x J x 3) -> (N x 3 x J)) -> N x 3 x J
      outputs = rot_mat.bmm(outputs.permute(0, 2, 1))
      outputs = outputs.permute(0, 2, 1)
      # add the shift instead of the root
      if not is_reverse:
          outputs += shift
      return outputs
  
imports: import os
  import torch
  import torch.optim
  import numpy
  from sklearn.metrics import auc
label_desc: Use image node_id 11 for calling a global function with example usage: transform_3d_v2(inputs, rot_y, rot_x, shift, is_reverse, rot_z, use_new_rot, is_mpi) and returns: outputs