MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_tuple_no_subscript

Method test_tuple_no_subscript

test/test_fx.py:1174–1190  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1172 self.assertEqual(traced_scripted(torch.rand(4)), 2)
1173
1174 def test_tuple_no_subscript(self):
1175 def foo(x : Tuple):
1176 return x[0]
1177
1178 traced = torch.fx.symbolic_trace(foo)
1179 x = (torch.randn(5, 3),)
1180 torch.testing.assert_close(traced(x), x[0])
1181
1182 bio = io.BytesIO()
1183
1184 torch.save(traced, bio)
1185
1186 bio.seek(0)
1187
1188 loaded = torch.load(bio)
1189
1190 torch.testing.assert_close(loaded(x), x[0])
1191
1192 def test_torch_fx_len(self):
1193 class FXLenTest(torch.nn.Module):

Callers

nothing calls this directly

Calls 4

seekMethod · 0.80
randnMethod · 0.45
saveMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected