qkeras.qconvolutional

Functions

QMobileNetSeparableConv2D(filters, kernel_size)

Adds a quantized separableconv2d.

deconv_output_length(input_length, ...[, ...])

Determines output length of a transposed convolution given input length.

Classes

QConv1D(*args, **kwargs)

1D convolution layer (e.g. spatial convolution over images).

QConv2D(*args, **kwargs)

2D convolution layer (e.g. spatial convolution over images).

QConv2DTranspose(*args, **kwargs)

2D convolution layer (e.g. spatial convolution over images).

QDepthwiseConv2D(*args, **kwargs)

Creates quantized depthwise conv2d.

QSeparableConv1D(*args, **kwargs)

Depthwise separable 1D convolution.

QSeparableConv2D(*args, **kwargs)

Depthwise separable 2D convolution.

class qkeras.qconvolutional.QConv1D(*args, **kwargs)[source]

Bases: Conv1D

1D convolution layer (e.g. spatial convolution over images).

call(inputs)[source]
get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_prunable_weights()[source]
get_quantization_config()[source]
get_quantizers()[source]
class qkeras.qconvolutional.QConv2D(*args, **kwargs)[source]

Bases: Conv2D

2D convolution layer (e.g. spatial convolution over images).

call(inputs)[source]
convolution_op(inputs, kernel)[source]
classmethod from_config(config)[source]

Creates an operation from its config.

This method is the reverse of get_config, capable of instantiating the same operation from the config dictionary.

Note: If you override this method, you might receive a serialized dtype config, which is a dict. You can deserialize it as follows:

```python if “dtype” in config and isinstance(config[“dtype”], dict):

policy = dtype_policies.deserialize(config[“dtype”])

```

Parameters:

config – A Python dictionary, typically the output of get_config.

Returns:

An operation instance.

get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_prunable_weights()[source]
get_quantization_config()[source]
get_quantizers()[source]
class qkeras.qconvolutional.QConv2DTranspose(*args, **kwargs)[source]

Bases: Conv2DTranspose

2D convolution layer (e.g. spatial convolution over images).

call(inputs)[source]
get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_prunable_weights()[source]
get_quantizers()[source]
class qkeras.qconvolutional.QDepthwiseConv2D(*args, **kwargs)[source]

Bases: DepthwiseConv2D

Creates quantized depthwise conv2d. Copied from mobilenet.

build(input_shape)[source]
call(inputs)[source]
get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_prunable_weights()[source]
get_quantization_config()[source]
get_quantizers()[source]
qkeras.qconvolutional.QMobileNetSeparableConv2D(filters, kernel_size, strides=(1, 1), padding='VALID', dilation_rate=(1, 1), depth_multiplier=1, activation=None, use_bias=True, depthwise_initializer='he_normal', pointwise_initializer='he_normal', bias_initializer='zeros', depthwise_regularizer=None, pointwise_regularizer=None, bias_regularizer=None, activity_regularizer=None, depthwise_constraint=None, pointwise_constraint=None, bias_constraint=None, depthwise_quantizer=None, pointwise_quantizer=None, bias_quantizer=None, depthwise_activation=None, depthwise_range=None, pointwise_range=None, bias_range=None, depthwise_dropout_rate=0.0, pw_first=False, name='')[source]

Adds a quantized separableconv2d.

class qkeras.qconvolutional.QSeparableConv1D(*args, **kwargs)[source]

Bases: SeparableConv1D

Depthwise separable 1D convolution.

call(inputs)[source]
get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_prunable_weights()[source]
get_quantizers()[source]
class qkeras.qconvolutional.QSeparableConv2D(*args, **kwargs)[source]

Bases: SeparableConv2D

Depthwise separable 2D convolution.

call(inputs)[source]
get_config()[source]

Returns the config of the object.

An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.

get_prunable_weights()[source]
get_quantizers()[source]
qkeras.qconvolutional.deconv_output_length(input_length, filter_size, padding, output_padding=None, stride=0, dilation=1)[source]

Determines output length of a transposed convolution given input length.

Parameters:
  • input_length – Integer.

  • filter_size – Integer.

  • padding – one of “same”, “valid”, “full”.

  • output_padding – Integer, amount of padding along the output dimension. Can be set to None in which case the output length is inferred.

  • stride – Integer.

  • dilation – Integer.

Returns:

The output length (integer).