code: def run_binary_promote_test(self, fns, input_shape, x_inplace=False):
      type_pairs = it.product(DTYPES, DTYPES)
      for fn, (xtype, ytype) in it.product(fns, type_pairs):
          x = torch.randn(input_shape, dtype=xtype).requires_grad_()
          x_leaf = x
          if x_inplace:
              # We need a non-leaf to call in place on
              x = x.clone()
          y = torch.randn(input_shape, dtype=ytype)
          out = fn(x, y)
          if x_inplace:
              # In place: always match xtype
              self.assertEqual(out.type(), x.type())
          else:
              # Out of place: match widest type
              if xtype == torch.float or ytype == torch.float:
                  self.assertEqual(out.type(), FLOAT)
              else:
                  self.assertEqual(out.type(), HALF)
          out.float().sum().backward()
          self.assertEqual(x_leaf.grad.dtype, xtype)
  
file_path: apex/tests/L0/run_amp/test_promotion.py
imports: import unittest
  import itertools
  from apex import amp
  import torch
  from torch import nn
  import torch.nn.functional
  from utils import common_init, HALF, FLOAT, DTYPES
label_desc: Use image node_id 3 for calling the TestPromotion obj's underlying member method code with example usage: obj.run_binary_promote_test(fns, input_shape, x_inplace) without return types