code: def export() -> None:
      optional = np.array([1, 2, 3, 4]).astype(np.float32)
      tensor_type_proto = onnx.helper.make_tensor_type_proto(
          elem_type=onnx.TensorProto.FLOAT,
          shape=[
              4,
          ],
      )
      optional_type_proto = onnx.helper.make_optional_type_proto(
          tensor_type_proto
      )
  
      # OptionalHasElement takes a tensor or optional as input
      for input_type_protos in [tensor_type_proto, optional_type_proto]:
          node = onnx.helper.make_node(
              "OptionalHasElement",
              inputs=["optional_input"],
              outputs=["output"],
          )
          output = optional_has_element_reference_implementation(
              optional
          )
          test_name = "test_optional_has_element_" + (
              "optional_input"
              if input_type_protos == optional_type_proto
              else "tensor_input"
          )
          expect(
              node,
              inputs=[optional],
              outputs=[output],
              input_type_protos=[optional_type_proto],
              name=test_name,
          )
  
file_path: onnx/onnx/backend/test/case/node/optionalhaselement.py
imports: from typing import Optional
  import numpy
  import onnx
  from onnx.backend.test.case.base import Base
  from onnx.backend.test.case.node import expect
label_desc: Use image node_id 1 for calling the OptionalHasElement obj's underlying member method code with example usage: obj.export() without return types