docstr: Load tensorflow keras model weights in this estimator.
  
  :param filepath: keras model weights save path.
  :param by_name: Boolean, whether to load weights by name or by topological
         order. Only topological loading is supported for weight files in
         TensorFlow format.
docstr_tok: ["Load","tensorflow","keras","model","weights","in","this","estimator",".",":","param","filepath",":","keras","model","weights","save","path",".",":","param","by_name",":","Boolean",",","whether","to","load","weights","by","name","or","by","topological","order",".","Only","topological","loading","is","supported","for","weight","files","in","TensorFlow","format","."]
code: def load_weights(self, filepath: str, by_name: bool = False) -> None:
      """
      Load tensorflow keras model weights in this estimator.
  
      :param filepath: keras model weights save path.
      :param by_name: Boolean, whether to load weights by name or by topological
             order. Only topological loading is supported for weight files in
             TensorFlow format.
      """
      model = self.get_model(set_weights=False)
      if is_file(filepath):
          # h5 format
          if is_local_path(filepath):
              model.load_weights(filepath, by_name)
          else:
              file_name = os.path.basename(filepath)
              temp_dir = tempfile.mkdtemp()
              temp_path = os.path.join(temp_dir, file_name)
              try:
                  get_remote_file_to_local(filepath, temp_path)
                  model.load_weights(temp_path, by_name)
              finally:
                  shutil.rmtree(temp_dir)
      else:
          # tensorflow format
          if is_local_path(filepath):
              model.load_weights(filepath, by_name)
          else:
              temp_dir = tempfile.mkdtemp()
              try:
                  prefix = os.path.basename(filepath)
                  get_remote_files_with_prefix_to_local(
                      filepath, temp_dir
                  )
                  model.load_weights(
                      os.path.join(temp_dir, prefix), by_name
                  )
              finally:
                  shutil.rmtree(temp_dir)
      self.model_weights = model.get_weights()
  
imports: import os
  import types
  import logging
  import tempfile
  import shutil
  from bigdl.dllib.utils.common import get_node_and_core_number
  from bigdl.dllib.utils.file_utils import is_local_path
  from bigdl.dllib.utils.utils import get_node_ip
  from bigdl.orca.data.file import is_file, exists, get_remote_file_to_local, get_remote_files_with_prefix_to_local, put_local_file_to_remote, put_local_files_with_prefix_to_remote
  from bigdl.orca.learn.tf2.spark_runner import SparkRunner
  from bigdl.orca.learn.utils import find_free_port, find_ip_and_free_port
  from bigdl.orca.learn.utils import maybe_dataframe_to_xshards, dataframe_to_xshards, convert_predict_xshards_to_dataframe, make_data_creator, load_model, save_model, process_xshards_of_pandas_dataframe, add_predict_to_pd_xshards, update_predict_xshards
  from bigdl.orca.learn.log_monitor import start_log_server, stop_log_server
  from bigdl.orca import OrcaContext
  from bigdl.orca.data.shard import SparkXShards
  from bigdl.dllib.utils.log4Error import invalidInputError
  from pyspark.sql.dataframe import DataFrame
  from typing import TYPE_CHECKING, Any, Dict, List, Callable, Union, Optional
label_desc: Use image node_id 7 for calling the SparkTFEstimator obj's underlying member method code with example usage: obj.load_weights(filepath, by_name) without return types