flytekitplugins.onnxtensorflow.TensorFlow2ONNXConfig#

class flytekitplugins.onnxtensorflow.TensorFlow2ONNXConfig(input_signature, custom_ops=None, target=None, custom_op_handlers=None, custom_rewriter=None, opset=None, extra_opset=None, shape_override=None, inputs_as_nchw=None, large_model=False)#

TensorFlow2ONNXConfig is the config used during the tensorflow to ONNX conversion.

Parameters:
  • input_signature (TensorSpec | ndarray) – The shape/dtype of the inputs to the model.

  • custom_ops (Dict[str, Any] | None) – If a model contains ops not recognized by ONNX runtime, you can tag these ops with a custom op domain so that the runtime can still open the model.

  • target (List[Any] | None) – List of workarounds applied to help certain platforms.

  • custom_op_handlers (Dict[Any, Tuple] | None) – A dictionary of custom op handlers.

  • custom_rewriter (List[Any] | None) – A list of custom graph rewriters.

  • opset (int | None) – The ONNX opset number.

  • extra_opset (List[int] | None) – The extra ONNX opset numbers to be used by, say, custom ops.

  • shape_override (Dict[str, List[Any]] | None) – Dict with inputs that override the shapes given by tensorflow.

  • inputs_as_nchw (List[str] | None) – Transpose inputs in list from nhwc to nchw.

  • large_model (bool) – Whether to use the ONNX external tensor storage format.

Methods

classmethod from_dict(kvs, *, infer_missing=False)#
Parameters:

kvs (dict | list | str | int | float | bool | None)

Return type:

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)#
Parameters:

s (str | bytes | bytearray)

Return type:

A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)#
Parameters:
Return type:

SchemaF[A]

to_dict(encode_json=False)#
Return type:

Dict[str, dict | list | str | int | float | bool | None]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)#
Parameters:
Return type:

str

Attributes

custom_op_handlers: Dict[Any, Tuple] | None = None
custom_ops: Dict[str, Any] | None = None
custom_rewriter: List[Any] | None = None
dataclass_json_config = None
extra_opset: List[int] | None = None
inputs_as_nchw: List[str] | None = None
large_model: bool = False
opset: int | None = None
shape_override: Dict[str, List[Any]] | None = None
target: List[Any] | None = None
input_signature: TensorSpec | ndarray