Is passing data through a neural network a unit test?

I’m writing a library that uses deep neural networks through PyTorch. I need to make sure that the large network architectures we’ve implemented keep working.

I’ve implemented this as simple tests: create an input, create a network, pass the input through the network, check that the output has the right shape. Each one of these tests takes several seconds to run, and we have multiple architectures to test.

It’s crucial that these tests don’t break. That would completely break multiple systems that rely on this library. But these tests are 10 times slower than most other tests.

Should these tests be part of the unit test suite, that is run regularly, or should we consider them as integration tests and keep them in a separate suite that runs less often?

Source: Python Questions

LEAVE A COMMENT