Layer Attributes Filters

In order to create LayerFilterParams which needed to filter layers by their attributes, one may use the next filters to check if a layer configuration holds the created LayerFilterParams:

Attribute Filters

class model_compression_toolkit.target_platform.AttributeFilter(attr, value, op)

Wrap a key, value and an operation to filter a layer’s configuration according to. If the layer’s configuration has the key, and its’ value matches when applying the operator, the configuration matches the AttributeFilter.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.


class model_compression_toolkit.target_platform.Eq(attr, value)

Filter configurations such that it matches configurations that have an attribute with a value that equals to the value that Eq holds.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.


class model_compression_toolkit.target_platform.NotEq(attr, value)

Filter configurations such that it matches configurations that have an attribute with a value that is not equal to the value that NotEq holds.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.


class model_compression_toolkit.target_platform.Greater(attr, value)

Filter configurations such that it matches configurations that have an attribute with a value that is greater than the value that Greater holds.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.


class model_compression_toolkit.target_platform.GreaterEq(attr, value)

Filter configurations such that it matches configurations that have an attribute with a value that is greater or equal than the value that GreaterEq holds.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.


class model_compression_toolkit.target_platform.Smaller(attr, value)

Filter configurations such that it matches configurations that have an attribute with a value that is smaller than the value that Smaller holds.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.


class model_compression_toolkit.target_platform.SmallerEq(attr, value)

Filter configurations such that it matches configurations that have an attribute with a value that is smaller or equal than the value that SmallerEq holds.

Parameters:
  • attr (str) – Attribute to filter a layer’s configuration according to.

  • value (Any) – Value to filter to filter a layer’s configuration according to.

  • op (Callable) – Operator to check if when applied on a layer’s configuration value it holds with regard to the filter’s value field.