| 7 | |
| 8 | |
| 9 | class TestFastAI(unittest.TestCase): |
| 10 | # Basic import |
| 11 | def test_basic(self): |
| 12 | import fastai |
| 13 | import fastcore |
| 14 | import fastprogress |
| 15 | import fastdownload |
| 16 | |
| 17 | def test_has_version(self): |
| 18 | self.assertGreater(len(fastai.__version__), 2) |
| 19 | |
| 20 | # based on https://github.com/fastai/fastai/blob/master/tests/test_torch_core.py#L17 |
| 21 | def test_torch_tensor(self): |
| 22 | a = tensor([1, 2, 3]) |
| 23 | b = torch.tensor([1, 2, 3]) |
| 24 | |
| 25 | self.assertTrue(torch.all(a == b)) |
| 26 | |
| 27 | @p100_exempt |
| 28 | def test_tabular(self): |
| 29 | dls = TabularDataLoaders.from_csv( |
| 30 | "/input/tests/data/train.csv", |
| 31 | cont_names=["pixel" + str(i) for i in range(784)], |
| 32 | y_names="label", |
| 33 | procs=[FillMissing, Categorify, Normalize], |
| 34 | ) |
| 35 | learn = tabular_learner(dls, layers=[200, 100]) |
| 36 | with learn.no_bar(): |
| 37 | learn.fit_one_cycle(n_epoch=1) |
| 38 | |
| 39 | self.assertGreater(learn.smooth_loss, 0) |
nothing calls this directly
no outgoing calls
no test coverage detected