code: def turn_smpl_gradient_off(dp_mask):
      assert dp_mask is not None
      grad_mask = np.ones([24, 3])
      idx2name = densepose_idx_to_name()
      visible = [
          idx2name[i] for i in range(1, 25) if i in np.unique(dp_mask)
      ]
      if "Upper Leg Left" not in visible:
          grad_mask[1] = 0
      if "Upper Leg Right" not in visible:
          grad_mask[2] = 0
      if "Lower Leg Left" not in visible:
          grad_mask[4] = 0
      if "Lower Leg Right" not in visible:
          grad_mask[5] = 0
      if "Left Foot" not in visible:
          grad_mask[7] = 0
          grad_mask[10] = 0
      if "Right Foot" not in visible:
          grad_mask[8] = 0
          grad_mask[11] = 0
      if "Upper Arm Left" not in visible:
          grad_mask[16] = 0
      if "Upper Arm Right" not in visible:
          grad_mask[17] = 0
      if "Lower Arm Left" not in visible:
          grad_mask[18] = 0
      if "Lower Arm Right" not in visible:
          grad_mask[19] = 0
      if "Left Hand" not in visible:
          grad_mask[20] = 0
          grad_mask[22] = 0
      if "Right Hand" not in visible:
          grad_mask[21] = 0
          grad_mask[23] = 0
      if "Head" not in visible:
          grad_mask[12] = 0
          grad_mask[15] = 0
      return grad_mask.reshape(-1)
  
imports: import os
  import math
  import time
  import random
  import tqdm
  import torch
  import torch.nn.functional
  import numpy
  import torchvision.utils
  import igl
  import lpips
  from utils import utils, render_utils, ray_utils
  from trainers import tensorboard_helper
  from options import options
  from cameras.captures import ResizedPinholeCapture
  from cameras.pinhole_camera import PinholeCamera
  from models.vanilla import weight_reset
  from utils.constant import HARD_SURFACE_OFFSET, PATCH_SIZE, PATCH_SIZE_SQUARED, CANONICAL_ZOOM_FACTOR, CANONICAL_CAMERA_DIST
label_desc: Use image node_id 3 for calling a global function with example usage: turn_smpl_gradient_off(dp_mask) and returns: grad_mask