# sparselearning.tests

## sparselearning.tests.test_data

Try testing salient dataset features:

  1. Is it downloaded?

  2. Does the loader work

  3. Does the loader have data in your desired format?

`sparselearning.tests.test_data.``test_get_loaders`(dataset)

  Test dataloader

  Parameters

    dataset (str) – Dataset to use

`sparselearning.tests.test_data.``test_registry`(dataset)

  Test get_dataset functions

  Parameters

    dataset (str) – Dataset to use

`sparselearning.tests.test_data.``test_splitter`()

  Test data splitting using DatasetSplitter

## sparselearning.tests.test_mask_loading_saving

`sparselearning.tests.test_mask_loading_saving.``test_save_load`()

  1. Initialise

  2. Save

  3. Load

       Assert if equal

  4. Perform optim step

## sparselearning.tests.test_struct_sparse

`sparselearning.tests.test_struct_sparse.``is_channel_sparse`(mask: sparselearning.core.Masking) → bool

  Checks if the conv mask is channel-wise sparse.

  Parameters

    mask (Masking) – Masking instance

  Returns

    True if channel-wise sparse

  Return type

    bool

`sparselearning.tests.test_struct_sparse.``test_struct_init`(init_scheme: str)

  Test structured sparsity for various init schemes

  Parameters

    init_scheme (str) – Random/ER/ERK

`sparselearning.tests.test_struct_sparse.``test_struct_prune_growth`(prune_mode, growth_mode)

  Test structured sparsity across prune, growth modes. See sparselearning.funcs.prune,growth

  Parameters

    - prune_mode (str) – prune mode

    - growth_mode (str) – growth mode