in Synthesis_incorporation/value_search/value_search.py [0:0]
def _contains_sparse(benchmark: benchmark_module.Benchmark) -> bool:
"""Returns whether the benchmark involves SparseTensors."""
# TODO(kshi): These heuristics are okay, but we should let the user choose if
# they want to.
for example in benchmark.examples:
if isinstance(example.output, torch.Tensor):
if example.output.is_sparse:
return True
for input_object in _user_inputs(example.inputs):
if isinstance(input_object, torch.Tensor):
if input_object.is_sparse:
return True
return "sparse" in benchmark.description.lower()