code: def test_magnitude_pruner_incompatible_block_size(simple_module):
      """
      Test MagnitudePruner init failure when block_size is incompatibe with the number of channels
      in the block sparsity dimension
      """
      # block size greater than half the number of channels
      with pytest.raises(ValueError):
          config = MagnitudePrunerConfig.from_dict(
              {
                  "global_config": {
                      "scheduler": {"update_steps": [0, 1]},
                      "block_size": 4,
                  }
              },
          )
          pruner = MagnitudePruner(simple_module, config)
          pruner.prepare(inplace=True)
      # block size greater than half the number of channels
      config.global_config.block_size = 4
      with pytest.raises(ValueError):
          pruner = MagnitudePruner(simple_module, config)
          pruner.prepare(inplace=True)
  
imports: import copy
  from collections import OrderedDict
  import numpy
  import pytest
  import torch
  from coremltools.optimize.torch.pruning import MagnitudePruner, MagnitudePrunerConfig, ModuleMagnitudePrunerConfig
  from coremltools.optimize.torch.pruning._utils import n_m_mask
label_desc: Use image node_id 9 for calling a global function with example usage: test_magnitude_pruner_incompatible_block_size(simple_module) without return types