class_docstr: Test basic functionality of opset version handling in pymil
class_docstr_tok: ["Test","basic","functionality","of","opset","version","handling","in","pymil"]
code: def test_nested_block_opset_version_selection():
      # pick up the oldest version (iOS13) topk by default
      prog = get_simple_nested_block_program()
      main_func = prog.functions["main"]
      topk_ops = main_func.find_ops(op_type="topk")
      assert all(
          [topk.opset_version == ct.target.iOS13 for topk in topk_ops]
      )
  
      # pick up iOS16 version topk
      prog = get_simple_nested_block_program(
          opset_version=ct.target.iOS16
      )
      main_func = prog.functions["main"]
      topk_ops = main_func.find_ops(op_type="topk")
      assert all(
          [topk.opset_version == ct.target.iOS16 for topk in topk_ops]
      )
  
imports: import numpy
  import pytest
  import coremltools
  from coremltools import _logger
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, Program, types
  from coremltools.converters.mil.mil.passes.tests.test_passes import CONSTEXPR_FUNCS
label_desc: Use image node_id 3 for calling the TestMILProgramVersionHandling obj's underlying member method code with example usage: obj.test_nested_block_opset_version_selection() without return types