class_docstr: Represents a batch of Interest Rate Swaps (IRS).
  
  An Interest rate swap (IRS) is a contract between two counterparties for an
  exchange of a series of payments over a period of time. The payments are made
  periodically (for example quarterly or semi-annually) where the last payment
  is made at the maturity (or termination) of the contract. In the case of
  fixed-for-floating IRS, one counterparty pays a fixed rate while the other
  counterparty's payments are linked to a floating index, most commonly the
  LIBOR rate. On the other hand, in the case of interest rate basis swap, the
  payments of both counterparties are linked to a floating index. Typically, the
  floating rate is observed (or fixed) at the beginning of each period while the
  payments are made at the end of each period [1].
  
  For example, consider a vanilla swap with the starting date T_0 and maturity
  date T_n and equally spaced coupon payment dates T_1, T_2, ..., T_n such that
  
  T_0 < T_1 < T_2 < ... < T_n and dt_i = T_(i+1) - T_i    (A)
  
  The floating rate is fixed on T_0, T_1, ..., T_(n-1) and both the fixed and
  floating payments are made on T_1, T_2, ..., T_n (payment dates).
  
  The InterestRateSwap class can be used to create and price multiple IRS
  simultaneously. The class supports vanilla fixed-for-floating swaps as
  well as basis swaps. However all IRS within an IRS object must be priced using
  a common reference and discount curve.
  
  #### Example (non batch):
  The following example illustrates the construction of an IRS instrument and
  calculating its price.
  
  ```python
  DayCountConventions = daycount_conventions.DayCountConventions
  BusinessDayConvention = business_days.BusinessDayConvention
  RateIndex = instrument_protos.rate_indices.RateIndex
  Currency = currencies.Currency
  
  swap = ir_swap.InterestRateSwap(
      effective_date=date_pb2.Date(year=2020, month=2, day=2),
      maturity_date=date_pb2.Date(year=2023, month=2, day=2),
      currency=Currency.USD(),
      pay_leg=ir_swap.SwapLeg(
          fixed_leg=ir_swap.FixedLeg(
              currency=Currency.USD(),
              coupon_frequency=period_pb2.Period(type="MONTH", amount=6),
              notional_amount=decimal_pb2.Decimal(units=10000),
              fixed_rate=decimal_pb2.Decimal(nanos=31340000),
              daycount_convention=DayCountConventions.ACTUAL_365(),
              business_day_convention=BusinessDayConvention.
                MODIFIED_FOLLOWING(),
              settlement_days=0)),
      receive_leg=ir_swap.SwapLeg(
          floating_leg=ir_swap.FloatingLeg(
              currency=Currency.USD(),
              coupon_frequency=period_pb2.Period(type="MONTH", amount=3),
              reset_frequency=period_pb2.Period(type="MONTH", amount=3),
              notional_amount=decimal_pb2.Decimal(units=10000),
              floating_rate_type=RateIndex(type="LIBOR_3M"),
              daycount_convention=DayCountConventions.ACTUAL_365(),
              business_day_convention=BusinessDayConvention.
                MODIFIED_FOLLOWING(),
              settlement_days=0)))
    dates = [[2021, 2, 8], [2022, 2, 8], [2023, 2, 8], [2025, 2, 8],
             [2027, 2, 8], [2030, 2, 8], [2050, 2, 8]]
    discounts = [0.97197441, 0.94022746, 0.91074031, 0.85495089, 0.8013675,
                 0.72494879, 0.37602059]
    libor_3m_config = {
        "interpolation_method": interpolation_method.InterpolationMethod.LINEAR
    }
    self._market_data_dict = {
        "rates": {
            "USD": {
                "risk_free_curve": {
                    "dates": dates,
                    "discounts": discounts,
                },
                "LIBOR_3M": {
                    "dates": dates,
                    "discounts": discounts,
                    "config": libor_3m_config,
                }
            }
        },
        "reference_date": [(2020, 6, 24)],
    }
  market = market_data.MarketDataDict(market_data_dict)
  swaps = interest_rate_swap.InterestRateSwap.from_protos([swap])
  swaps[0].price(market)
  # Expected: [-69.42497649]
  ```
  
  #### References:
  [1]: Leif B.G. Andersen and Vladimir V. Piterbarg. Interest Rate Modeling,
      Volume I: Foundations and Vanilla Models. Chapter 5. 2010.
docstr: Creates a dictionary to initialize InterestRateSwap.
  
  The output dictionary is such that the instruments can be initialized
  as follows:
  ```
  initializer = create_constructor_args(proto_list, config)
  swaps = [InterestRateSwap(**data) for data in initializer.values()]
  ```
  
  The keys of the output dictionary are unique identifiers of the batched
  instruments. This is useful for identifying an existing graph that could be
  reused for the instruments without the need of rebuilding the graph.
  
  Args:
    proto_list: A list of protos for which the initialization arguments are
      constructed.
    config: An instance of `InterestRateSwapConfig`.
  
  Returns:
    A possibly nested dictionary such that each value provides initialization
    arguments for the InterestRateSwap.
docstr_tok: ["Creates","a","dictionary","to","initialize","InterestRateSwap",".","The","output","dictionary","is","such","that","the","instruments","can","be","initialized","as","follows",":","``","`","initializer","=","create_constructor_args","(","proto_list",",","config",")","swaps","=","[","InterestRateSwap","(","*","*","data",")","for","data","in","initializer.values","(",")","]","``","`","The","keys","of","the","output","dictionary","are","unique","identifiers","of","the","batched","instruments",".","This","is","useful","for","identifying","an","existing","graph","that","could","be","reused","for","the","instruments","without","the","need","of","rebuilding","the","graph",".","Args",":","proto_list",":","A","list","of","protos","for","which","the","initialization","arguments","are","constructed",".","config",":","An","instance","of","`","InterestRateSwapConfig","`",".","Returns",":","A","possibly","nested","dictionary","such","that","each","value","provides","initialization","arguments","for","the","InterestRateSwap","."]
code: def create_constructor_args(
      cls,
      proto_list: List[ir_swap.InterestRateSwap],
      config: InterestRateSwapConfig = None,
  ) -> Dict[str, Any]:
      """Creates a dictionary to initialize InterestRateSwap.
  
      The output dictionary is such that the instruments can be initialized
      as follows:
      ```
      initializer = create_constructor_args(proto_list, config)
      swaps = [InterestRateSwap(**data) for data in initializer.values()]
      ```
  
      The keys of the output dictionary are unique identifiers of the batched
      instruments. This is useful for identifying an existing graph that could be
      reused for the instruments without the need of rebuilding the graph.
  
      Args:
        proto_list: A list of protos for which the initialization arguments are
          constructed.
        config: An instance of `InterestRateSwapConfig`.
  
      Returns:
        A possibly nested dictionary such that each value provides initialization
        arguments for the InterestRateSwap.
      """
      swap_data = proto_utils.from_protos_v2(proto_list, config)
      res = {}
      for key in swap_data:
          tensor_repr = proto_utils.tensor_repr(swap_data[key])
          res[key] = tensor_repr
      return res
  
imports: import copy
  from typing import List, Dict, Optional, Union, Any
  import dataclasses
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance import math
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import instrument
  from tf_quant_finance.experimental.pricing_platform.framework.core import processed_market_data
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import cashflow_streams
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import coupon_specs
  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 interest_rate_swap_pb2
label_desc: Use image node_id 2 for calling the InterestRateSwap obj's underlying member method code with example usage: obj.create_constructor_args(cls, proto_list, config) and returns: res