docstr: Add train op to the SavedModel.
  
  Note that this functionality is in development, and liable to be
  moved elsewhere.
  
  Args:
    train_op: Op or group of ops that are used for training. These are stored
      as a collection with key TRAIN_OP_KEY, but not executed.
  
  Raises:
    TypeError if Train op is not of type `Operation`.
docstr_tok: ["Add","train","op","to","the","SavedModel",".","Note","that","this","functionality","is","in","development",",","and","liable","to","be","moved","elsewhere",".","Args",":","train_op",":","Op","or","group","of","ops","that","are","used","for","training",".","These","are","stored","as","a","collection","with","key","TRAIN_OP_KEY",",","but","not","executed",".","Raises",":","TypeError","if","Train","op","is","not","of","type","`","Operation","`","."]
code: def _add_train_op(self, train_op):
      """Add train op to the SavedModel.
  
      Note that this functionality is in development, and liable to be
      moved elsewhere.
  
      Args:
        train_op: Op or group of ops that are used for training. These are stored
          as a collection with key TRAIN_OP_KEY, but not executed.
  
      Raises:
        TypeError if Train op is not of type `Operation`.
      """
      if train_op is not None:
          if not isinstance(train_op, tensor.Tensor) and not isinstance(
              train_op, ops.Operation
          ):
              raise TypeError(
                  f"`train_op` {train_op} needs to be a Tensor or Op."
              )
          ops.add_to_collection(constants.TRAIN_OP_KEY, train_op)
  
imports: import functools
  import os
  from google.protobuf.any_pb2 import Any
  from tensorflow.core.framework import types_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saved_model_pb2
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model import fingerprinting_utils
  from tensorflow.python.saved_model import path_helpers
  from tensorflow.python.saved_model import signature_def_utils
  from tensorflow.python.saved_model.pywrap_saved_model import constants
  from tensorflow.python.saved_model.pywrap_saved_model import metrics
  from tensorflow.python.training import saver
  from tensorflow.python.util import compat
  from tensorflow.python.util.deprecation import deprecated_args
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 5 for calling the SavedModelBuilder obj's underlying member method code with example usage: obj._add_train_op(train_op) without return types