code: def _initialize_instrument_weights(float_times, fixed_times, dtype):
      """Function to compute default initial weights for optimization."""
      weights = tf.ones(len(float_times), dtype=dtype)
      one = tf.ones([], dtype=dtype)
      float_times_last = tf.stack([times[-1] for times in float_times])
      fixed_times_last = tf.stack([times[-1] for times in fixed_times])
      weights = tf.maximum(
          tf.math.divide_no_nan(one, float_times_last),
          tf.math.divide_no_nan(one, fixed_times_last),
      )
      weights = tf.minimum(one, weights)
      return tf.unstack(weights, name="instrument_weights")
  
file_path: tf-quant-finance/tf_quant_finance/rates/swap_curve_fit.py
imports: from typing import List, Callable, Any
  import tensorflow.compat.v2
  from tf_quant_finance import types
  from tf_quant_finance import utils
  from tf_quant_finance.math import make_val_and_grad_fn
  from tf_quant_finance.math import optimizer
  from tf_quant_finance.math.interpolation import linear
  from tf_quant_finance.rates import swap_curve_common
label_desc: Use image node_id 4 for calling a global function with example usage: _initialize_instrument_weights(float_times, fixed_times, dtype) and returns: tf