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

Method test_repr

test/test_modules.py:199–212  ·  view source on GitHub ↗
(self, device, dtype, module_info, training)

Source from the content-addressed store, hash-verified

197
198 @modules(module_db)
199 def test_repr(self, device, dtype, module_info, training):
200 # Test module can be represented with repr and str without errors.
201 module_cls = module_info.module_cls
202 module_inputs = module_info.module_inputs_func(module_info, device=device, dtype=dtype,
203 requires_grad=False, training=training)
204 for module_input in module_inputs:
205 args, kwargs = module_input.constructor_input.args, module_input.constructor_input.kwargs
206 m = module_cls(*args, **kwargs)
207 m.to(device).to(dtype)
208 m.train(training)
209
210 # Check that these methods do not raise errors
211 m.__repr__()
212 str(m)
213
214 @modules(module_db)
215 def test_pickle(self, device, dtype, module_info, training):

Callers

nothing calls this directly

Calls 3

toMethod · 0.45
trainMethod · 0.45
__repr__Method · 0.45

Tested by

no test coverage detected