code: def _train_tasks(
      batch,
      inner_batch_fn,
      outer_batch_fn,
      inner_cost_fn,
      outer_cost_fn,
      variables,
      inner_grad_steps,
      inner_learning_rate,
      inner_optimization_step,
      order,
      average_across_steps,
      batched,
      inner_v,
      keep_innver_v,
      outer_v,
      keep_outer_v,
      return_inner_v,
      num_tasks,
      stop_gradients,
  ):
      if batched:
          return _train_tasks_batched(
              batch,
              inner_batch_fn,
              outer_batch_fn,
              inner_cost_fn,
              outer_cost_fn,
              variables,
              inner_grad_steps,
              inner_learning_rate,
              inner_optimization_step,
              order,
              average_across_steps,
              inner_v,
              keep_innver_v,
              outer_v,
              keep_outer_v,
              return_inner_v,
              num_tasks,
              stop_gradients,
          )
      return _train_tasks_with_for_loop(
          batch,
          inner_batch_fn,
          outer_batch_fn,
          inner_cost_fn,
          outer_cost_fn,
          variables,
          inner_grad_steps,
          inner_learning_rate,
          inner_optimization_step,
          order,
          average_across_steps,
          inner_v,
          keep_innver_v,
          outer_v,
          keep_outer_v,
          return_inner_v,
          num_tasks,
          stop_gradients,
      )
  
file_path: ivy/ivy/functional/ivy/meta.py
imports: import ivy
  from ivy.func_wrapper import handle_array_function
  from ivy.functional.ivy.gradients import gradient_descent_update
  from ivy.utils.exceptions import handle_exceptions
  from typing import Optional, Union, Callable, Tuple, Any
label_desc: Use image node_id 5 for calling a global function with example usage: _train_tasks(batch, inner_batch_fn, outer_batch_fn, inner_cost_fn, outer_cost_fn, variables, inner_grad_steps, inner_learning_rate, inner_optimization_step, order, average_across_steps, batched, inner_v, keep_innver_v, outer_v, keep_outer_v, return_inner_v, num_tasks, stop_gradients) and returns: _train_tasks_with_for_loop, _train_tasks_batched