code: def remove_function(pf, renamed):
      proto_network = pf.owner()
      input_name = None
      need_grad = False
      for pv_name in pf.inputs:
          pv = (
              proto_network.variables[pv_name]
              if pv_name in proto_network.variables
              else proto_network.parameters[pv_name]
          )
          parent = pv.parent
          required = filter(
              lambda k: proto_network.functions[k] != pf, pv.required
          )
          input_name = pv_name
          need_grad = pv.need_grad
          break
  
      for pv_name in pf.outputs:
          pv = proto_network.variables[pv_name]
          pv.parent = parent
          if len(pv.required) > 0:
              for r in pv.required:
                  r_func = proto_network.functions[r]
                  index = r_func.inputs.index(pv.name)
                  r_func.inputs[index] = input_name
  
              pv.required += required
              if pv_name in proto_network.outputs:
                  index = proto_network.outputs.index(pv_name)
                  proto_network.outputs[index] = input_name
              renamed[pv.name] = input_name
              pv.name = input_name
              pv.need_grad = need_grad
              proto_network.variables[pv.name] = pv
              logger.info(
                  f"[upper bound] proto_variable:{pv_name} is deleted, output name: {input_name} is kept."
              )
              del proto_network.variables[pv_name]
          else:
              if parent is not None:
                  r_func = proto_network.functions[parent]
                  index = r_func.outputs.index(input_name)
                  r_func.outputs[index] = pv.name
              # Re-check input variable
              for f_name in required:
                  u_func = proto_network.functions[f_name]
                  index = u_func.inputs.index(input_name)
                  u_func.inputs[index] = pv.name
              pv.need_grad = need_grad
              pv.required += required
              renamed[input_name] = pv.name
              del proto_network.variables[input_name]
              logger.info(
                  f"[lower bound] proto_variable:{input_name} is deleted, output name: {pv.name} is kept."
              )
          break
  
      del proto_network.functions[pf.name]
      logger.info(f"proto_function:{pf.name} is deleted.")
  
imports: from nnabla.logger import logger
label_desc: Use image node_id 1 for calling a global function with example usage: remove_function(pf, renamed) without return types