code: def test_lut_optimizer_runs_in_compilation_pipeline():
      """Test that the LUT optimization pass runs as part of the NPU compilation pipeline."""
      ifm_shape = (1, 4, 4, 4)
  
      @tf.function
      def get_graph(x):
          weight1 = tf.constant(
              np.random.uniform(size=(1, 1, 4, 4)), dtype=tf.float32
          )
          op = tf.nn.conv2d(x, weight1, (1, 1), "VALID")
          op = tf.nn.tanh(op)
          weight2 = tf.constant(
              np.random.uniform(size=(1, 1, 4, 1)), dtype=tf.float32
          )
          op = tf.nn.depthwise_conv2d(
              op, weight2, (1, 1, 1, 1), "VALID"
          )
          return tf.nn.tanh(op)
  
      mod, _ = infra.get_tflite_graph(get_graph, [ifm_shape])
      mod = partition_for_ethosu(mod)
      mod = relay_to_tir(mod)
  
      external_gv_name = mod["main"].body.op.name_hint
      prim_func = mod[external_gv_name]
  
      # Check for hints in the TIR prim func that the LUT optimization pass has ran.
      # If the module was optimized, there should be no identity operations.
      def check_identity(stmt):
          if isinstance(stmt, tvm.tir.expr.Call):
              assert stmt.args[0] != "ethosu_identity"
  
      tvm.tir.stmt_functor.post_order_visit(
          prim_func.body, check_identity
      )
  
file_path: tvm/tests/python/contrib/test_ethosu/test_lut_optimizer.py
imports: import pytest
  import tensorflow
  import numpy
  import tvm
  from tvm import relay
  from tvm.relay.backend.contrib.ethosu.codegen import LUTsOptimizer
  from tvm.relay.backend.contrib.ethosu.codegen import relay_to_tir
  from tvm.relay.op.contrib.ethosu import partition_for_ethosu
  from .None import infra
label_desc: Use image node_id 4 for calling a global function with example usage: test_lut_optimizer_runs_in_compilation_pipeline() and returns: tf