check_sparse_tensor_invariants
class torch.sparse.check_sparse_tensor_invariants(enable=True)
A tool to control checking sparse tensor invariants.
The following options exists to manage sparsr tensor invariants
   checking in sparse tensor construction:


Using a context manager:
 with torch.sparse.check_sparse_tensor_invariants():
     run_my_model()



Using a procedural approach:
 prev_checks_enabled = torch.sparse.check_sparse_tensor_invariants.is_enabled()
 torch.sparse.check_sparse_tensor_invariants.enable()

 run_my_model()

 if not prev_checks_enabled:
     torch.sparse.check_sparse_tensor_invariants.disable()



Using function decoration:
 @torch.sparse.check_sparse_tensor_invariants()
 def run_my_model():
     ...

 run_my_model()



Using "check_invariants" keyword argument in sparse tensor
      constructor call. For example:

