MCPcopy
hub / github.com/dmlc/dgl / test_serialize_deserialize_subcolumn

Function test_serialize_deserialize_subcolumn

tests/python/common/test_frame.py:76–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74
75
76def test_serialize_deserialize_subcolumn():
77 data = F.copy_to(
78 F.tensor(
79 [
80 [1.0, 1.0, 1.0, 1.0],
81 [0.0, 2.0, 9.0, 0.0],
82 [3.0, 2.0, 1.0, 0.0],
83 [1.0, 1.0, 1.0, 1.0],
84 [0.0, 2.0, 4.0, 0.0],
85 ]
86 ),
87 F.ctx(),
88 )
89 original = Column(data)
90
91 # subcolumn from cpu context
92 i1 = F.tensor([0, 2, 1, 3], dtype=F.int64)
93 l1 = original.subcolumn(i1)
94
95 serial = pickle.dumps(l1)
96 new = pickle.loads(serial)
97
98 assert F.array_equal(new.data, l1.data)
99
100
101def test_serialize_deserialize_dtype():

Callers

nothing calls this directly

Calls 4

subcolumnMethod · 0.95
ColumnClass · 0.90
copy_toMethod · 0.45
ctxMethod · 0.45

Tested by

no test coverage detected