code: def test_where():
      # 1D
      shape = (2 * 3 * 4,)
      N = np.prod(shape)
      X = T.arange(N)
      zeros = T.zeros(X.shape)
      ones = T.ones(X.shape)
      out = T.where(X < 2 * 3, zeros, ones)
      for i in range(N):
          if i < 2 * 3:
              assert_equal(
                  out[i],
                  0,
                  f"Unexpected result on vector for element {i}",
              )
          else:
              assert_equal(
                  out[i],
                  1,
                  f"Unexpected result on vector for element {i}",
              )
  
      # 2D
      shape = (2 * 3, 4)
      N = np.prod(shape)
      X = T.reshape(T.arange(N), shape)
      zeros = T.zeros(X.shape)
      ones = T.ones(X.shape)
      out = T.where(X < 2 * 3, zeros, ones)
      for i in range(shape[0]):
          for j in range(shape[1]):
              index = i * shape[1] + j
              if index < 2 * 3:
                  assert_equal(
                      out[i, j], 0, "Unexpected result on matrix"
                  )
              else:
                  assert_equal(
                      out[i, j], 1, "Unexpected result on matrix"
                  )
  
      # 3D
      shape = (2, 3, 4)
      N = np.prod(shape)
      X = T.reshape(T.arange(N), shape)
      zeros = T.zeros(X.shape)
      ones = T.ones(X.shape)
      out = T.where(X < 2 * 3, zeros, ones)
      for i in range(shape[0]):
          for j in range(shape[1]):
              for k in range(shape[2]):
                  index = (i * shape[1] + j) * shape[2] + k
                  if index < 2 * 3:
                      assert_equal(
                          out[i, j, k], 0, "Unexpected result on matrix"
                      )
                  else:
                      assert_equal(
                          out[i, j, k], 1, "Unexpected result on matrix"
                      )
  
      # random testing against Numpy's output
      shapes = (16, 8, 4, 2)
      for order in range(1, 5):
          shape = shapes[:order]
          tensor = T.tensor(np.random.randn(*shape))
          args = (tensor < 0, T.zeros(shape), T.ones(shape))
          result = T.where(*args)
          expected = np.where(*map(T.to_numpy, args))
          assert_array_equal(result, expected)
  
imports: from concurrent.futures import ThreadPoolExecutor
  import pytest
  from time import time
  import numpy
  from scipy.linalg import svd
  from scipy import special
  import tensorly
  from ..None import backend
  from ..testing import assert_allclose, assert_array_equal, assert_equal, assert_, assert_array_almost_equal, assert_raises
  from tensorly.tenalg.svd import SVD_FUNS, svd_interface
label_desc: Use image node_id 13 for calling a global function with example usage: test_where() without return types