<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/dtype_policies/dtype_policy.py#L452-L536) |

Quantized dtype policy for AWQ quantization.

Inherits From: [`QuantizedDTypePolicy`](https://www.tensorflow.org/api_docs/python/tf/keras/dtype_policies/QuantizedDTypePolicy), [`DTypePolicy`](https://www.tensorflow.org/api_docs/python/tf/keras/DTypePolicy)

    tf.keras.dtype_policies.AWQDTypePolicy(
        mode, source_name=None
    )

This policy helps propagate quantization settings for AWQ
when loading an AWQ quantized model in Keras format.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `mode` | The quantization mode. This should be a string in the format `"awq/<weight_bits>/<group_size>"`. <br /> - `"awq"`: The identifier for the quantization algorithm. - `<weight_bits>`: Number of bits to quantize weights to. AWQ presently only supports 4-bit quantization. - `<group_size>`: The group size for quantization. Supported values are -1 (for per-channel quantization) or any positive integer. Example: `"awq/4/128"`. |
| `source_name` | The source dtype policy name, e.g. "float32". |

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `compute_dtype` | The compute dtype of this policy. <br /> This is the dtype layers will do their computations in. Typically layers output tensors with the compute dtype as well. Note that even if the compute dtype is float16 or bfloat16, hardware devices may not do individual adds, multiplies, and other fundamental operations in float16 or bfloat16, but instead may do some of them in float32 for numeric stability. The compute dtype is the dtype of the inputs and outputs of the ops that the layer executes. Internally, many ops will do certain internal calculations in float32 or some other device-internal intermediate format with higher precision than float16/bfloat16, to increase numeric stability. |
| `name` | Returns the name of this policy. |
| `quantization_mode` | The quantization mode of this policy. |
| `variable_dtype` | The variable dtype of this policy. <br /> This is the dtype layers will create their variables in, unless a layer explicitly chooses a different dtype. If this is different than [`DTypePolicy.compute_dtype`](https://www.tensorflow.org/api_docs/python/tf/keras/DTypePolicy#compute_dtype), Layers will cast variables to the compute dtype to avoid type errors. Variable regularizers are run in the variable dtype, not the compute dtype. |

<br />

## Methods

### `convert_input`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/dtype_policies/dtype_policy.py#L150-L175)

    convert_input(
        x, autocast, dtype
    )

Converts the input dtype based on `autocast` and `dtype`.

Note that `x` can be a tensor, symbolic tensor or numpy array, and this
method will keep integer inputs untouched and only apply casting to
floats.

### `from_config`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/dtype_policies/dtype_policy.py#L180-L182)

    @classmethod
    from_config(
        config
    )

### `get_config`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/dtype_policies/dtype_policy.py#L531-L536)

    get_config()

### `__eq__`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/dtype_policies/dtype_policy.py#L523-L529)

    __eq__(
        other
    )

Return self==value.