TensorflowCatalog Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The TensorFlowTransformer is used in following two scenarios.
- Scoring with pretrained TensorFlow model: In this mode, the transform extracts hidden layers' values from a pre-trained Tensorflow model and uses outputs as features in ML.Net pipeline.
- Retraining of TensorFlow model: In this mode, the transform retrains a TensorFlow model using the user data passed through ML.Net pipeline. Once the model is trained, it's outputs can be used as features for scoring.
public static class TensorflowCatalog
type TensorflowCatalog = class
Public Module TensorflowCatalog
- Inheritance
-
TensorflowCatalog
Remarks
The TensorFlowTransform extracts specified outputs using a pre-trained Tensorflow model. Optionally, it can further retrain TensorFlow model on user data to adjust model parameters on the user data ( also know as "Transfer Learning").
For scoring, the transform takes as inputs the pre-trained Tensorflow model, the names of the input nodes, and names of the output nodes whose values we want to extract. For retraining, the transform also requires training related parameters such as the names of optimization operation in the TensorFlow graph, the name of the learning rate operation in the graph and its value, name of the operations in the graph to compute loss and performance metric etc.
This transform requires the Microsoft.ML.TensorFlow nuget to be installed. The TensorFlowTransform has the following assumptions regarding input, output, processing of data, and retraining.
- For the input model, currently the TensorFlowTransform supports both the Frozen model format and also the SavedModel format. However, retraining of the model is only possible for the SavedModel format. Checkpoint format is currently neither supported for scoring nor for retraining due lack of TensorFlow C-API support for loading it.
- The transform supports scoring only one example at a time. However, retraining can be performed in batches.
- Advanced transfer learning/fine tuning scenarios (e.g. adding more layers into the network, changing the shape of inputs, freezing the layers which do not need to be updated during retraining process etc.) are currently not possible due to lack of support for network/graph manipulation inside the model using TensorFlow C-API.
- The name of input column(s) should match the name of input(s) in TensorFlow model.
- The name of each output column should match one of the operations in the TensorFlow graph.
- Currently, double, float, long, int, short, sbyte, ulong, uint, ushort, byte and bool are the acceptable data types for input/output.
- Upon success, the transform will introduce a new column in IDataView corresponding to each output column specified.
The inputs and outputs of a TensorFlow model can be obtained using the GetModelSchema() or summarize_graph tools.
Methods
LoadTensorFlowModel(ModelOperationsCatalog, String, Boolean) |
Load TensorFlow model into memory. This is the convenience method that allows the model to be loaded once and subsequently use it for querying schema and creation of TensorFlowEstimator using ScoreTensorFlowModel(String, String, Boolean). usage of this API requires additional NuGet dependencies on TensorFlow redist, see linked document for more information. TensorFlowModel also holds references to unmanaged resources that need to be freed either with an explicit call to Dispose() or implicitly by declaring the variable with the "using" syntax/> |
LoadTensorFlowModel(ModelOperationsCatalog, String) |
Load TensorFlow model into memory. This is the convenience method that allows the model to be loaded once and subsequently use it for querying schema and creation of TensorFlowEstimator using ScoreTensorFlowModel(String, String, Boolean). usage of this API requires additional NuGet dependencies on TensorFlow redist, see linked document for more information. TensorFlowModel also holds references to unmanaged resources that need to be freed either with an explicit call to Dispose() or implicitly by declaring the variable with the "using" syntax/> |