code: def get_optimal_block_config(
      npu_op: vapi.NpuOperation, accel_config: vapi.NpuAccelerator
  ) -> vapi.NpuShape3D:
      """
      "The NPU's unit of work is known as a block. It will fetch block(s) from Input
      Feature Map (IFM) and a compute block for Output Feature Map (OFM).
      Therefore, we need to pick an optimal block configuration considering bandwidth
      to bring IFM blocks and the number of OFM block computes need to happen
      to cover the OFM as indicated by the npu op.
      For the case when cascader is enabled, the logic of choosing the optimal configuration block
      from TVM will be used in other cases, the Vela's logic will be used except
      the cases when dev_force_block_config option is specified.
  
      Parameters
      ----------
      npu_op : ethosu.vela.api.NpuOperation
          The NPU operation and its params
      accel_config : ethosu.vela.api.NpuAccelerator
          The NPU accelerator config
  
      Returns
      -------
      ethosu.vela.api.NpuShape3D :
          The optimal block config for the operator
      """
      options = tvm.transform.PassContext.current().config.get(
          "relay.ext.ethos-u.options", None
      )
      if options and options.dev_force_block_config:
          block_config = [
              int(v) for v in options.dev_force_block_config.split("x")
          ]
          return vapi.NpuShape3D(
              height=block_config[0],
              width=block_config[1],
              depth=block_config[2],
          )
      elif options and options.enable_cascader:
          all_valid_block_configs = vapi.npu_find_block_configs(
              npu_op, accel_config
          )
          return _get_optimal_block_config(all_valid_block_configs)
      else:
          return _find_block_config_with_vela(npu_op, accel_config)
  
imports: import logging
  import math
  from typing import List, Optional, Tuple
  import numpy
  from ethosu.vela import api
  from ethosu.vela.architecture_allocator import find_block_config
  from ethosu.vela.architecture_features import Accelerator, create_default_arch
  from ethosu.vela.operation import NpuBlockType
  from ethosu.vela.register_command_stream_generator import resampling_mode_map
  from ethosu.vela.register_command_stream_util import to_kernel
  from ethosu.vela.shape4d import Shape4D
  import tvm
  from tvm.relay.backend.contrib.ethosu import tir_to_cs_translator
  from tvm.relay.backend.contrib.ethosu import util
label_desc: Use image node_id 1 for calling a global function with example usage: get_optimal_block_config(npu_op, accel_config) and returns: vapi, _get_optimal_block_config, _find_block_config_with_vela