code: def test_lc_custom():
      model = LinearChain
      vals, _ = model._rand()
  
      struct = LinearChain(LogSemiring)
      marginals = struct.marginals(vals)
      s = struct.sum(vals)
  
      struct = LinearChain(CheckpointSemiring(LogSemiring, 1))
      marginals2 = struct.marginals(vals)
      s2 = struct.sum(vals)
      assert torch.isclose(s, s2).all()
      assert torch.isclose(marginals, marginals2).all()
  
      struct = LinearChain(CheckpointShardSemiring(LogSemiring, 1))
      marginals2 = struct.marginals(vals)
      s2 = struct.sum(vals)
      assert torch.isclose(s, s2).all()
      assert torch.isclose(marginals, marginals2).all()
  
imports: from torch_struct import CKY, CKY_CRF, DepTree, LinearChain, SemiMarkov, Alignment, deptree_nonproj, deptree_part
  from torch_struct import LogSemiring, CheckpointSemiring, CheckpointShardSemiring, KMaxSemiring, SparseMaxSemiring, MaxSemiring, StdSemiring, EntropySemiring
  from .extensions import LinearChainTest, SemiMarkovTest, DepTreeTest, CKYTest, CKY_CRFTest, test_lookup
  import torch
  from hypothesis import given
  from hypothesis.strategies import integers, data, sampled_from
  import pytest
  from hypothesis import settings
label_desc: Use image node_id 16 for calling a global function with example usage: test_lc_custom() without return types