code: def weighted_moments(
      x, axes, frequency_weights, keepdims=False, name=None
  ):
      fw_x_prod = frequency_weights * x
      fw_x_prod = ivy.array(fw_x_prod)
      weighted_input_sum = ivy.sum(
          fw_x_prod, axis=axes, keepdims=True
      ).astype(fw_x_prod.dtype)
  
      broadcasted_weights = frequency_weights + ivy.zeros_like(x)
      broadcasted_weights = ivy.array(broadcasted_weights)
      sum_of_weights = ivy.sum(
          broadcasted_weights, axis=axes, keepdims=True
      ).astype(broadcasted_weights.dtype)
  
      divisor = ivy.reciprocal(sum_of_weights)
  
      weighted_input_sum, divisor = check_tensorflow_casting(
          weighted_input_sum, divisor
      )
      weighted_mean = ivy.multiply(weighted_input_sum, divisor)
  
      x, weighted_mean = check_tensorflow_casting(x, weighted_mean)
      squared_difference = ivy.square(ivy.subtract(x, weighted_mean))
      if isinstance(squared_difference, complex):
          squared_difference = (
              squared_difference.real - squared_difference.imag * 1j
          )
  
      fw_sq_diff_prod = frequency_weights * squared_difference
      fw_sq_diff_prod = ivy.array(fw_sq_diff_prod)
      weighted_distsq = ivy.sum(
          fw_sq_diff_prod, axis=axes, keepdims=True
      ).astype(fw_sq_diff_prod.dtype)
  
      weighted_distsq, divisor = check_tensorflow_casting(
          weighted_distsq, divisor
      )
      weighted_variance = ivy.multiply(weighted_distsq, divisor)
  
      if not keepdims:
          weighted_mean = ivy.squeeze(weighted_mean, axis=axes)
          weighted_variance = ivy.squeeze(weighted_variance, axis=axes)
      return weighted_mean, weighted_variance
  
imports: import ivy
  from ivy.functional.frontends.tensorflow.func_wrapper import to_ivy_arrays_and_back
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from ivy.functional.frontends.tensorflow import check_tensorflow_casting
label_desc: Use image node_id 43 for calling a global function with example usage: weighted_moments(x, axes, frequency_weights, keepdims, name) and returns: weighted_mean,  weighted_variance