code: def test_unsupported_op_attribute_provide_functions(
      self,
  ):  # type: () -> None
      def convert_flatten(builder, node, graph, err):
          params = NeuralNetwork_pb2.CustomLayerParams()
          params.className = node.op_type
          params.description = (
              "Custom layer that corresponds to the ONNX op {}".format(
                  node.op_type,
              )
          )
          params.parameters["axis"].intValue = node.attrs["axis"]
  
          builder.add_custom(
              name=node.name,
              input_names=node.inputs,
              output_names=node.outputs,
              custom_proto_spec=params,
          )
  
      def test_conversion(onnx_model, add_custom_layers=False):
          coreml_model = convert(
              onnx_model,
              add_custom_layers=add_custom_layers,
              custom_conversion_functions={"Flatten": convert_flatten},
          )
  
          spec = coreml_model.get_spec()
          layers = spec.neuralNetwork.layers
          self.assertIsNotNone(layers[0].custom)
          self.assertEqual("Flatten", layers[0].custom.className)
          self.assertEqual(
              3, layers[0].custom.parameters["axis"].intValue
          )
  
      onnx_model = _make_model_flatten_axis3()
      # Test with add_custom_layers True
      convert(
          onnx_model,
          add_custom_layers=True,
          custom_conversion_functions={"Flatten": convert_flatten},
      )
  
      # Test with add_custom_layers False
      convert(
          onnx_model,
          add_custom_layers=False,
          custom_conversion_functions={"Flatten": convert_flatten},
      )
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_tests/test_custom_layers.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import unittest
  from coremltools._deps import _HAS_ONNX, MSG_ONNX_NOT_FOUND
  from coremltools.proto import NeuralNetwork_pb2
label_desc: Use image node_id 5 for calling the CustomLayerTest obj's underlying member method code with example usage: obj.test_unsupported_op_attribute_provide_functions() without return types