neural_compressor.experimental.pruning_recipes.patterns.pattern

pattern classes.

Module Contents

Classes

PATTERNS

Class that contain all registered pattern types.

PatternBase

Base class of pruning pattern.

Functions

pattern_registry(pattern_type)

Class decorator used to register all Pruning Pattern subclasses.

neural_compressor.experimental.pruning_recipes.patterns.pattern.pattern_registry(pattern_type)

Class decorator used to register all Pruning Pattern subclasses.

Parameters:
  • cls (class) – The class of register.

  • pattern_type (str) – The pattern registration name

Returns:

The class of register.

Return type:

cls

class neural_compressor.experimental.pruning_recipes.patterns.pattern.PATTERNS

Bases: object

Class that contain all registered pattern types.

patterns

A dict which stores registered Pruning Pattern subclasses.

classmethod support_pattern()

Support patterns.

class neural_compressor.experimental.pruning_recipes.patterns.pattern.PatternBase(mask_shape, is_contiguous=True)

Base class of pruning pattern.

abstract compute_sparsity(tensor)

To be implemented in subclasses.

reduce(tensor, method='abs_sum')

Reshaped tensor, support ‘abs_max’, ‘abs_sum’.

reshape(tensor)

Reshape tensor into dims+2.