code: def _from_grads(
      cls,
      loss,
      sess,
      inputs,
      labels,
      grads,
      variables,
      dataset,
      optim_method=None,
      clip_norm=None,
      clip_value=None,
      metrics=None,
      tensor_with_value=None,
      session_config=None,
      model_dir=None,
      updates=None,
      train_op=None,
  ):
      graph = loss.graph
      if metrics is None:
          metrics = {}
  
      tf_model = TFModel.create(
          loss,
          sess,
          inputs,
          labels,
          [],
          grads,
          variables,
          graph,
          tensor_with_value,
          session_config,
          metrics,
          updates,
          model_dir=None,
          train_op=train_op,
      )
      return cls(
          tf_model,
          optim_method,
          sess=sess,
          dataset=dataset,
          clip_norm=clip_norm,
          clip_value=clip_value,
          model_dir=model_dir,
      )
  
imports: import json
  import logging
  import os
  import sys
  import tempfile
  from bigdl.nn.criterion import Criterion
  from bigdl.nn.layer import Layer
  from bigdl.optim.optimizer import MaxEpoch, EveryEpoch
  from bigdl.util.common import to_list, JavaValue
  from zoo.common.utils import callZooFunc
  from zoo.feature.common import FeatureSet
  from zoo.pipeline.api.keras.engine.topology import to_bigdl_metric, Loss, OptimMethod
  from zoo.pipeline.api.net.utils import find_placeholders, to_bigdl_optim_method, find_tensors
  from zoo.pipeline.estimator import Estimator
  from zoo.util import nest
  from zoo.util.triggers import EveryEpoch
  from zoo.util.triggers import ZooTrigger
  from zoo.tfpark.tf_dataset import TFNdarrayDataset, check_data_compatible
  from zoo.tfpark.tf_dataset import _standarize_feature_label_dataset
label_desc: Use image node_id 8 for calling the TFOptimizer obj's underlying member method code with example usage: obj._from_grads(cls, loss, sess, inputs, labels, grads, variables, dataset, optim_method, clip_norm, clip_value, metrics, tensor_with_value, session_config, model_dir, updates, train_op) and returns: cls