Package org.tribuo.interop.tensorflow


package org.tribuo.interop.tensorflow
Provides an interface to TensorFlow, allowing the training of non-sequential models using any supported Tribuo output type. Sequential model support is found in org.tribuo.interop.tensorflow.sequence.

Tribuo's TensorFlow support operates in Graph mode, as in v0.3.1 that is the only way to access gradients. The set of supported gradients is determined by TensorFlow, and not all gradients are available in TensorFlow Java in v0.3.1. Unsupported gradients will trigger an exception when the train method is called.

Models can store their trained parameters in two ways, either inside the Tribuo serialized model file (using TensorFlowTrainer.TFModelFormat.TRIBUO_NATIVE) or as a TensorFlow checkpoint folder on disk (using TensorFlowTrainer.TFModelFormat.CHECKPOINT). The choice is made at training time, as they result in slightly different TF graph structures.

Similarly there are two supported kinds of ExternalModel for TensorFlow, TensorFlowSavedModelExternalModel which loads a SavedModelBundle and always reads from that path, and TensorFlowFrozenExternalModel which loads a TensorFlow v1 frozen graph and stores the graph inside the Tribuo serialized object.

There are two main interfaces for interacting with TensorFlow Tensors, FeatureConverter and OutputConverter, with provide conversions to and from Tribuo's features and outputs respectively. There are implementations of a dense feature transformation and one for images as 3d arrays, along with output converters for Label Regressor, and MultiLabel. The loss function and output transformation used is controlled by the OutputConverter, if a different one is desired then users are recommended to implement that interface separately.

N.B. TensorFlow support is experimental and may change without a major version bump.