code: def tensor_repr(fra_data, dtype=None):
      """Creates a tensor representation of the FRA."""
      dtype = dtype or tf.float64
      res = dict()
      res["fixing_date"] = tf.convert_to_tensor(
          fra_data["fixing_date"], dtype=tf.int32
      )
      res["fixed_rate"] = tf.convert_to_tensor(
          fra_data["fixed_rate"], dtype=dtype
      )
      config = fra_data["config"]
      res["config"] = config
      res["batch_names"] = fra_data["batch_names"]
      currency_list = cashflow_streams.to_list(fra_data["currency"])
      discount_curve_type = []
      for currency in currency_list:
          if config is not None:
              if currency in config.discounting_curve:
                  discount_curve = config.discounting_curve[currency]
                  discount_curve_type.append(discount_curve)
              else:
                  risk_free = curve_types_lib.RiskFreeCurve(
                      currency=currency
                  )
                  discount_curve_type.append(risk_free)
          else:
              # Default discounting is the risk free curve
              risk_free = curve_types_lib.RiskFreeCurve(
                  currency=currency
              )
              discount_curve_type.append(risk_free)
      discount_curve_type, mask = cashflow_streams.process_curve_types(
          discount_curve_type
      )
      res["discount_curve_mask"] = tf.convert_to_tensor(
          mask, dtype=tf.int32
      )
      res["discount_curve_type"] = discount_curve_type
      # Get reset frequency
      reset_frequency = tf.convert_to_tensor(
          fra_data["rate_term"][1], tf.int32
      )
      res["rate_term"] = {
          "type": fra_data["rate_term"][0],
          "frequency": reset_frequency,
      }
      rate_index = cashflow_streams.to_list(fra_data["rate_index"])
      rate_index_curves = []
      for currency, r_ind in zip(currency_list, rate_index):
          rate_index_curves.append(
              curve_types_lib.RateIndexCurve(
                  currency=currency, index=r_ind
              )
          )
      [
          rate_index_curves,
          reference_mask,
      ] = cashflow_streams.process_curve_types(rate_index_curves)
      res["reference_mask"] = tf.convert_to_tensor(
          reference_mask, tf.int32
      )
      res["rate_index_curves"] = rate_index_curves
      # Extract unique rate indices
      res["rate_index"] = [curve.index for curve in rate_index_curves]
      res["notional_amount"] = tf.convert_to_tensor(
          fra_data["notional_amount"], dtype=dtype
      )
      res["settlement_days"] = tf.convert_to_tensor(
          fra_data["settlement_days"],
          dtype=tf.int32,
          name="settlement_days",
      )
      res["calendar"] = fra_data["calendar"]
      # Extract unique currencies
      res["currency"] = [
          curve.currency for curve in discount_curve_type
      ]
      res["daycount_convention"] = fra_data["daycount_convention"]
      res["business_day_convention"] = fra_data[
          "business_day_convention"
      ]
      res["short_position"] = tf.convert_to_tensor(
          fra_data["short_position"], dtype=tf.bool
      )
      return res
  
imports: from typing import Any, List, Dict, Tuple
  import tensorflow.compat.v2
  from tf_quant_finance.experimental.pricing_platform.framework import utils
  from tf_quant_finance.experimental.pricing_platform.framework.core import business_days
  from tf_quant_finance.experimental.pricing_platform.framework.core import currencies
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import daycount_conventions
  from tf_quant_finance.experimental.pricing_platform.framework.core import rate_indices
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import cashflow_streams
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments.interest_rate_swap import proto_utils
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import forward_rate_agreement_pb2
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import period_pb2
label_desc: Use image node_id 7 for calling a global function with example usage: tensor_repr(fra_data, dtype) and returns: res