code: def test_triangular_solve(upper):
      b = torch.randn(5, 6)
      A = torch.randn(5, 5)
      expected = torch.triangular_solve(b, A, upper=upper).solution
      actual = torch.linalg.solve_triangular(A, b, upper=upper)
      assert_close(actual, expected)
      A = A.triu() if upper else A.tril()
      assert_close(A @ actual, b)
  
imports: import pytest
  import torch
  from pyro.ops.linalg import rinverse
  from tests.common import assert_close, assert_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_triangular_solve(upper) without return types