class_docstr: Test basic functionality of opset version handling in pymil
class_docstr_tok: ["Test","basic","functionality","of","opset","version","handling","in","pymil"]
docstr: `mb.program` API should detect potential non compatible ops in the program, and error out early
  In this example, `pixel_unshuffle` is an iO16 op, and `topk` has iOS13 and iOS16 version.
  If the builder version is not set, it is picking up the iOS13 version of topk, which would
  potentially create an invalid program.
  In this case, `mb.program` should error out, and tell the user to set `opset_version=target.iOS16`
docstr_tok: ["`","mb.program","`","API","should","detect","potential","non","compatible","ops","in","the","program",",","and","error","out","early","In","this","example",",","`","pixel_unshuffle","`","is","an","iO16","op",",","and","`","topk","`","has","iOS13","and","iOS16","version",".","If","the","builder","version","is","not","set",",","it","is","picking","up","the","iOS13","version","of","topk",",","which","would","potentially","create","an","invalid","program",".","In","this","case",",","`","mb.program","`","should","error","out",",","and","tell","the","user","to","set","`","opset_version=target.iOS16","`"]
code: def test_bulid_non_compatible_program_early_error_out():
      """
      `mb.program` API should detect potential non compatible ops in the program, and error out early
      In this example, `pixel_unshuffle` is an iO16 op, and `topk` has iOS13 and iOS16 version.
      If the builder version is not set, it is picking up the iOS13 version of topk, which would
      potentially create an invalid program.
      In this case, `mb.program` should error out, and tell the user to set `opset_version=target.iOS16`
      """
      expected_err_str = "Op topk with an out of date version coremltools.target.iOS13 is detected. Please use @mb.program\(input_specs=..., opset_version=coremltools.target.iOS16\)"
      with pytest.raises(ValueError, match=expected_err_str):
          get_simple_topk_pixel_unshuffle_program()
  
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 7 for calling the TestMILProgramVersionHandling obj's underlying member method code with example usage: obj.test_bulid_non_compatible_program_early_error_out() without return types