docstr: Creates ir swap from proto and tests pricing method.
docstr_tok: ["Creates","ir","swap","from","proto","and","tests","pricing","method","."]
code: def test_from_proto_price_num_calibration(self):
      """Creates ir swap from proto and tests pricing method."""
      market = market_data.MarketDataDict(self._market_data_dict)
      config = american_option.AmericanOptionConfig(
          num_samples=1500,
          num_calibration_samples=500,
          num_exercise_times=10,
          seed=[1, 2],
      )
      am_option = american_option.AmericanOption.from_protos(
          [
              self._american_option_1,
              self._american_option_2,
              self._american_option_3,
          ],
          config,
      )
  
      with self.subTest("Batching"):
          self.assertLen(am_option, 2)
      price1 = am_option[0].price(market)
      expected1 = np.array([4850253.3942, 495803.5293])
      with self.subTest("PriceBatch"):
          self.assertAllClose(price1, expected1, rtol=1e-2, atol=0)
      price2 = am_option[1].price(market)
      expected2 = np.array([895160.0769])
      with self.subTest("PriceSingle"):
          self.assertAllClose(price2, expected2, rtol=1e-2, atol=0)
  
file_path: tf-quant-finance/tf_quant_finance/experimental/pricing_platform/framework/equity_instruments/american_option/american_option_impl_test.py
imports: import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 4 for calling the AmericanEquityOptionTest obj's underlying member method code with example usage: obj.test_from_proto_price_num_calibration() without return types