MCPcopy Create free account
hub / github.com/apache/tvm / test_setting_error

Function test_setting_error

tests/python/relax/test_training_trainer_numeric.py:145–166  ·  view source on GitHub ↗
(target, dev)

Source from the content-addressed store, hash-verified

143
144@tvm.testing.parametrize_targets("llvm")
145def test_setting_error(target, dev):
146 backbone = _get_backbone()
147 pred_sinfo = relax.TensorStructInfo((1, 5), "float32")
148
149 setup_trainer = SetupTrainer(
150 MSELoss(reduction="sum"),
151 SGD(0.01),
152 [pred_sinfo, pred_sinfo],
153 )
154
155 train_mod = setup_trainer(backbone)
156 ex = tvm.compile(train_mod, target)
157 vm = relax.VirtualMachine(ex, dev)
158
159 trainer = Trainer(train_mod, vm, dev, False)
160
161 dataset = _make_dataset()
162 # parameters are not inited
163 with pytest.raises(RuntimeError):
164 trainer.predict(dataset[0][0])
165 with pytest.raises(RuntimeError):
166 trainer.update(dataset[0][0], dataset[0][1])
167
168
169if __name__ == "__main__":

Callers

nothing calls this directly

Calls 9

predictMethod · 0.95
updateMethod · 0.95
SetupTrainerClass · 0.90
MSELossClass · 0.90
SGDClass · 0.90
TrainerClass · 0.90
_get_backboneFunction · 0.85
_make_datasetFunction · 0.85
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…