code: def test_ndarray_map2():
      a = 2.0
      b = 3.0
      x = np.array([a, b])
      y = np.array([b, a])
      row_vec = np.array([[1, 2]])
      cube1 = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
      cube2 = np.array([[[9, 10], [11, 12]], [[13, 14], [15, 16]]])
      empty = np.array([], np.int32).reshape((0, 2, 2))
  
      na = hl.nd.array(a)
      nx = hl.nd.array(x)
      ny = hl.nd.array(y)
      nrow_vec = hl.nd.array(row_vec)
      ncube1 = hl.nd.array(cube1)
      ncube2 = hl.nd.array(cube2)
      nempty = hl.nd.array(empty)
  
      assert_ndarrays_eq(
          # with lists/numerics
          (na + b, np.array(a + b)),
          (b + na, np.array(a + b)),
          (nx + y, x + y),
          (ncube1 + cube2, cube1 + cube2),
          (na + na, np.array(a + a)),
          (nx + ny, x + y),
          (ncube1 + ncube2, cube1 + cube2),
          (nx.map2(y, lambda c, d: c + d), x + y),
          (ncube1.map2(cube2, lambda c, d: c + d), cube1 + cube2),
          # Broadcasting
          (ncube1 + na, cube1 + a),
          (na + ncube1, a + cube1),
          (na + nempty, a + empty),
          (ncube1 + ny, cube1 + y),
          (ny + ncube1, y + cube1),
          (ny + nempty, y + empty),
          (nrow_vec + ncube1, row_vec + cube1),
          (ncube1 + nrow_vec, cube1 + row_vec),
          (nrow_vec + nempty, row_vec + empty),
          (ncube1.map2(na, lambda c, d: c + d), cube1 + a),
          (nrow_vec.map2(ncube1, lambda c, d: c + d), row_vec + cube1),
          # Subtraction
          (na - na, np.array(a - a)),
          (nx - nx, x - x),
          (ncube1 - ncube2, cube1 - cube2),
          # Broadcasting
          (ncube1 - na, cube1 - a),
          (na - ncube1, a - cube1),
          (ncube1 - ny, cube1 - y),
          (ny - ncube1, y - cube1),
          (ncube1 - nrow_vec, cube1 - row_vec),
          (nrow_vec - ncube1, row_vec - cube1),
          # Multiplication
          (na * na, np.array(a * a)),
          (nx * nx, x * x),
          (nx * na, x * a),
          (na * nx, a * x),
          (ncube1 * ncube2, cube1 * cube2),
          # Broadcasting
          (ncube1 * na, cube1 * a),
          (na * ncube1, a * cube1),
          (ncube1 * ny, cube1 * y),
          (ny * ncube1, y * cube1),
          (ncube1 * nrow_vec, cube1 * row_vec),
          (nrow_vec * ncube1, row_vec * cube1),
          # Floor div
          (na // na, np.array(a // a)),
          (nx // nx, x // x),
          (nx // na, x // a),
          (na // nx, a // x),
          (ncube1 // ncube2, cube1 // cube2),
          # Broadcasting
          (ncube1 // na, cube1 // a),
          (na // ncube1, a // cube1),
          (ncube1 // ny, cube1 // y),
          (ny // ncube1, y // cube1),
          (ncube1 // nrow_vec, cube1 // row_vec),
          (nrow_vec // ncube1, row_vec // cube1),
      )
  
      # Division
      assert_ndarrays_almost_eq(
          (na / na, np.array(a / a)),
          (nx / nx, x / x),
          (nx / na, x / a),
          (na / nx, a / x),
          (ncube1 / ncube2, cube1 / cube2),
          # Broadcasting
          (ncube1 / na, cube1 / a),
          (na / ncube1, a / cube1),
          (ncube1 / ny, cube1 / y),
          (ny / ncube1, y / cube1),
          (ncube1 / nrow_vec, cube1 / row_vec),
          (nrow_vec / ncube1, row_vec / cube1),
      )
  
      # Missingness tests
      missing = hl.missing(hl.tndarray(hl.tfloat64, 2))
      present = hl.nd.array(np.arange(10).reshape(5, 2))
  
      assert hl.eval(missing + missing) is None
      assert hl.eval(missing + present) is None
      assert hl.eval(present + missing) is None
  
imports: import math
  import numpy
  import re
  from ..helpers import *
  import pytest
  from hail.utils.java import FatalError, HailUserError
label_desc: Use image node_id 12 for calling a global function with example usage: test_ndarray_map2() without return types