MCPcopy Create free account
hub / github.com/apache/tvm-ffi / test_structural_key_basic

Function test_structural_key_basic

tests/python/test_structural.py:25–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def test_structural_key_basic() -> None:
26 k1 = tvm_ffi.StructuralKey({"a": [1, 2], "b": [3, {"c": 4}]})
27 k2 = tvm_ffi.StructuralKey({"b": [3, {"c": 4}], "a": [1, 2]})
28 k3 = tvm_ffi.StructuralKey({"a": [1, 2], "b": [3, {"c": 5}]})
29
30 assert tvm_ffi.structural_hash(k1.key) == k1.__hash__()
31 assert tvm_ffi.structural_hash(k2.key) == k2.__hash__()
32
33 assert k1 == k2
34 assert k1 != k3
35 assert hash(k1) == hash(k2)
36 assert tvm_ffi.structural_equal(k1.key, k2.key)
37 assert not tvm_ffi.structural_equal(k1.key, k3.key)
38
39
40def test_structural_helpers() -> None:

Callers

nothing calls this directly

Calls 3

__hash__Method · 0.95
hashClass · 0.85
StructuralKeyMethod · 0.80

Tested by

no test coverage detected