class_docstr: Implementation of magnitude-based weight pruning.
class_docstr_tok: ["Implementation","of","magnitude-based","weight","pruning","."]
code: def _validate_block(self):
      if self._block_size != [1, 1]:
          for weight, _, _ in self._pruning_vars:
              if weight.get_shape().ndims != 2:
                  raise ValueError(
                      "Block Sparsity can only be used for layers which "
                      "have 2-dimensional weights."
                  )
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import compat
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_utils
label_desc: Use image node_id 2 for calling the Pruning obj's underlying member method code with example usage: obj._validate_block() without return types