Example #1
0
    def export(self,
               export_dir,
               signature_fn=None,
               input_fn=None,
               default_batch_size=1,
               exports_to_keep=None):
        """Exports inference graph into given dir.

    Args:
      export_dir: A string containing a directory to write the exported graph
        and checkpoints.
      signature_fn: Function that returns a default signature and a named
        signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s
        for features and `Tensor` or `dict` of `Tensor`s for predictions.
      input_fn: Function that given `Tensor` of `Example` strings, parses it
        into features that are then passed to the model.
      default_batch_size: Default batch size of the `Example` placeholder.
      exports_to_keep: Number of exports to keep.
    """
        # pylint: disable=protected-access
        export._export_estimator(estimator=self,
                                 export_dir=export_dir,
                                 signature_fn=signature_fn,
                                 input_fn=input_fn,
                                 default_batch_size=default_batch_size,
                                 exports_to_keep=exports_to_keep)
Example #2
0
    def export(
            self,
            export_dir,
            input_fn=export._default_input_fn,  # pylint: disable=protected-access
            input_feature_key=None,
            use_deprecated_input_fn=True,
            signature_fn=None,
            prediction_key=None,
            default_batch_size=1,
            exports_to_keep=None):
        """Exports inference graph into given dir.

    Args:
      export_dir: A string containing a directory to write the exported graph
        and checkpoints.
      input_fn: If `use_deprecated_input_fn` is true, then a function that given
        `Tensor` of `Example` strings, parses it into features that are then
        passed to the model. Otherwise, a function that takes no argument and
        returns a tuple of (features, targets), where features is a dict of
        string key to `Tensor` and targets is a `Tensor` that's currently not
        used (and so can be `None`).
      input_feature_key: Only used if `use_deprecated_input_fn` is false. String
        key into the features dict returned by `input_fn` that corresponds to
        the raw `Example` strings `Tensor` that the exported model will take as
        input.
      use_deprecated_input_fn: Determines the signature format of `input_fn`.
      signature_fn: Function that returns a default signature and a named
        signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s
        for features and `Tensor` or `dict` of `Tensor`s for predictions.
      prediction_key: The key for a tensor in the `predictions` dict (output
        from the `model_fn`) to use as the `predictions` input to the
        `signature_fn`. Optional. If `None`, predictions will pass to
        `signature_fn` without filtering.
      default_batch_size: Default batch size of the `Example` placeholder.
      exports_to_keep: Number of exports to keep.
    """
        # pylint: disable=protected-access
        export._export_estimator(
            estimator=self,
            export_dir=export_dir,
            signature_fn=signature_fn,
            prediction_key=prediction_key,
            input_fn=input_fn,
            input_feature_key=input_feature_key,
            use_deprecated_input_fn=use_deprecated_input_fn,
            default_batch_size=default_batch_size,
            exports_to_keep=exports_to_keep)
Example #3
0
  def export(self,
             export_dir,
             input_fn=export._default_input_fn,  # pylint: disable=protected-access
             input_feature_key=None,
             use_deprecated_input_fn=True,
             signature_fn=None,
             prediction_key=None,
             default_batch_size=1,
             exports_to_keep=None):
    """Exports inference graph into given dir.

    Args:
      export_dir: A string containing a directory to write the exported graph
        and checkpoints.
      input_fn: If `use_deprecated_input_fn` is true, then a function that given
        `Tensor` of `Example` strings, parses it into features that are then
        passed to the model. Otherwise, a function that takes no argument and
        returns a tuple of (features, targets), where features is a dict of
        string key to `Tensor` and targets is a `Tensor` that's currently not
        used (and so can be `None`).
      input_feature_key: Only used if `use_deprecated_input_fn` is false. String
        key into the features dict returned by `input_fn` that corresponds to
        the raw `Example` strings `Tensor` that the exported model will take as
        input.
      use_deprecated_input_fn: Determines the signature format of `input_fn`.
      signature_fn: Function that returns a default signature and a named
        signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s
        for features and `Tensor` or `dict` of `Tensor`s for predictions.
      prediction_key: The key for a tensor in the `predictions` dict (output
        from the `model_fn`) to use as the `predictions` input to the
        `signature_fn`. Optional. If `None`, predictions will pass to
        `signature_fn` without filtering.
      default_batch_size: Default batch size of the `Example` placeholder.
      exports_to_keep: Number of exports to keep.
    """
    # pylint: disable=protected-access
    export._export_estimator(estimator=self,
                             export_dir=export_dir,
                             signature_fn=signature_fn,
                             prediction_key=prediction_key,
                             input_fn=input_fn,
                             input_feature_key=input_feature_key,
                             use_deprecated_input_fn=use_deprecated_input_fn,
                             default_batch_size=default_batch_size,
                             exports_to_keep=exports_to_keep)
Example #4
0
  def export(self, export_dir, signature_fn=None, input_fn=None,
             default_batch_size=1, exports_to_keep=None):
    """Exports inference graph into given dir.

    Args:
      export_dir: A string containing a directory to write the exported graph
        and checkpoints.
      signature_fn: Function that returns a default signature and a named
        signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s
        for features and `Tensor` or `dict` of `Tensor`s for predictions.
      input_fn: Function that given `Tensor` of `Example` strings, parses it
        into features that are then passed to the model.
      default_batch_size: Default batch size of the `Example` placeholder.
      exports_to_keep: Number of exports to keep.
    """
    # pylint: disable=protected-access
    export._export_estimator(estimator=self,
                             export_dir=export_dir,
                             signature_fn=signature_fn,
                             input_fn=input_fn,
                             default_batch_size=default_batch_size,
                             exports_to_keep=exports_to_keep)