code: def test_triangular_inv(batch_shape, n):
      import torch
  
      L = torch.randn(batch_shape + (n, n)).tril_()
      L.diagonal(dim1=-2, dim2=-1).abs_().add_(0.2)
      U = L.transpose(-1, -2)
      eye = ops.new_eye(L, L.shape[:-1])
  
      actual = ops.triangular_inv(L, upper=False)
      assert_close(L @ actual, eye, atol=1e-5, rtol=None)
      assert_close(actual @ L, eye, atol=1e-5, rtol=None)
  
      actual = ops.triangular_inv(U, upper=True)
      assert_close(U @ actual, eye, atol=1e-5, rtol=None)
      assert_close(actual @ U, eye, atol=1e-5, rtol=None)
  
imports: import pytest
  import funsor.ops
  from funsor.testing import assert_close, requires_backend
label_desc: Use image node_id 2 for calling a global function with example usage: test_triangular_inv(batch_shape, n) without return types