Skip to content

TFJS Graph Converter v1.6.0

Compare
Choose a tag to compare
@patlevin patlevin released this 25 Mar 13:56
· 19 commits to master since this release

Feature Release

This release addresses Issue #36 and allows generating more compatible converted models.
The change includes a slight update of the API. The compat_mode argument has been
changed from a bool to a CompatMode-enum.

This allows for future compatibility modes without changing function signatures.

The update is available on pypi and can
be installed via pip install tfjs-graph-converter==1.6.0

API Changes

The CompatMode enumeration can be used to control the operations included in converted
models. It replaces the compat_mode Boolean switch used in the following functions:

  • load_graph_model_and_signature(..., compat_mode: CompatMode = CompatMode.NONE)
  • load_graph_model(..., compat_mode: CompatMode = CompatMode.NONE)
  • graph_model_to_frozen_graph(..., compat_mode: CompatMode = CompatMode.NONE)
  • graph_model_to_saved_model(..., compat_mode: CompatMode = CompatMode.NONE)
  • graph_models_to_saved_model(..., compat_mode: CompatMode = CompatMode.NONE)

New Compatibility Modes

The CompatMode enumeration currently features the following members:

  • CompatMode.NONE: the default; uses all supported native TF operations (including fused operations)
  • CompatMode.TFJS: harmonises weight types for compatibility with older TFJS versions
  • CompatMode.TFLITE: limits model operations to those natively supported by TFLite

Changed Command Line Options

The --compat_mode switch has changed to require a mode option. The following options are supported:

  • none: the default; uses CompatMode.NONE for converting
  • tfjs: use CompatMode.TFJS for converting
  • tflite: use CompatMode.TFLITE for converting

Notes

Existing programs that don't use the compat_mode argument don't require any changes.
Programs using the compat_mode=True need to be updated to use CompatMode.TFJS instead.

Many thanks to jvuillaumier for making me aware of the issue
and for the kind words.