class_docstr: Performs TFJS conversion.
class_docstr_tok: ["Performs","TFJS","conversion","."]
docstr: Rewrites the provided model.
  
  Args:
    original_model: A `ModelDescription` specifying the original model to be
      rewritten.
    rewritten_model: A `ModelDescription` specifying the format and location
      of the rewritten model.
  
  Raises:
    ValueError: If the model could not be sucessfully rewritten.
docstr_tok: ["Rewrites","the","provided","model",".","Args",":","original_model",":","A","`","ModelDescription","`","specifying","the","original","model","to","be","rewritten",".","rewritten_model",":","A","`","ModelDescription","`","specifying","the","format","and","location","of","the","rewritten","model",".","Raises",":","ValueError",":","If","the","model","could","not","be","sucessfully","rewritten","."]
code: def _rewrite(
      self,
      original_model: rewriter.ModelDescription,
      rewritten_model: rewriter.ModelDescription,
  ):
      """Rewrites the provided model.
  
      Args:
        original_model: A `ModelDescription` specifying the original model to be
          rewritten.
        rewritten_model: A `ModelDescription` specifying the format and location
          of the rewritten model.
  
      Raises:
        ValueError: If the model could not be sucessfully rewritten.
      """
      if rewritten_model.model_type not in [
          rewriter.ModelType.TFJS_MODEL,
          rewriter.ModelType.ANY_MODEL,
      ]:
          raise ValueError(
              "TFJSConverter can only convert to the TFJS format."
          )
  
      _convert_tfjs_model(
          _ensure_str(original_model.path),
          _ensure_str(rewritten_model.path),
      )
  
file_path: tfx/tfx/components/trainer/rewriting/tfjs_rewriter.py
imports: from tensorflowjs.converters import converter
  from tfx.components.trainer.rewriting import rewriter
label_desc: Use image node_id 4 for calling the TFJSRewriter obj's underlying member method code with example usage: obj._rewrite(original_model, rewritten_model) without return types