code: def sample_inputs_linalg_solve_triangular(
      op_info, device, dtype, requires_grad=False, **kwargs
  ):
      make_arg = partial(make_tensor, dtype=dtype, device=device)
      bs = (1, 2, 0)
      ns = (3, 0)
      ks = (1, 3, 0)
  
      for b, n, k, (left, upper, uni) in product(
          bs, ns, ks, product((True, False), repeat=3)
      ):
          if b == 1:
              A = make_arg((n, n)) if left else make_arg((k, k))
              B = make_arg((n, k))
          else:
              A = make_arg((b, n, n)) if left else make_arg((b, k, k))
              B = make_arg((b, n, k))
          if uni:
              # Not really necessary, but writing it for consistency
              A.diagonal(0, -2, -1).fill_(1.0)
          else:
              d = A.diagonal(0, -2, -1)
              d[d.abs() < 1e-6] = 1.0
          if upper:
              A.triu_()
          else:
              A.tril_()
          kwargs = {"upper": upper, "left": left, "unitriangular": uni}
          if requires_grad:
              for grad_A, grad_B in product((True, False), repeat=2):
                  # Either A or B needs to have a gradient
                  if not grad_A and not grad_B:
                      continue
                  yield SampleInput(
                      A.clone().requires_grad_(grad_A),
                      args=(B.clone().requires_grad_(grad_B),),
                      kwargs=kwargs,
                  )
          else:
              yield SampleInput(A, args=(B,), kwargs=kwargs)
  
imports: import itertools
  import random
  import unittest
  from functools import partial
  from itertools import chain, product
  from typing import Iterable, List, Tuple
  import numpy
  from numpy import inf
  import torch
  from torch.testing import make_tensor
  from torch.testing._internal.common_cuda import _get_magma_version, _get_torch_cuda_version, with_tf32_off
  from torch.testing._internal.common_device_type import has_cusolver, skipCPUIfNoLapack, skipCUDAIf, skipCUDAIfNoCusolver, skipCUDAIfNoMagma, skipCUDAIfNoMagmaAndNoCusolver, skipCUDAIfNoMagmaAndNoLinalgsolver, skipCUDAIfRocm, tol, toleranceOverride
  from torch.testing._internal.common_dtype import all_types_and_complex, all_types_and_complex_and, floating_and_complex_types, floating_and_complex_types_and, get_all_complex_dtypes
  from torch.testing._internal.common_utils import GRADCHECK_NONDET_TOL, IS_MACOS, make_fullrank_matrices_with_distinct_singular_values, skipIfSlowGradcheckEnv, slowTest, TEST_WITH_ROCM
  from torch.testing._internal.opinfo.core import clone_sample, DecorateInfo, ErrorInput, gradcheck_wrapper_hermitian_input, L, M, OpInfo, ReductionOpInfo, S, SampleInput
  from torch.testing._internal.opinfo.refs import PythonRefInfo, ReductionPythonRefInfo
label_desc: Use image node_id 34 for calling a global function with example usage: sample_inputs_linalg_solve_triangular(op_info, device, dtype, requires_grad) without return types