qkeras.qmac
Classes
|
Quantized scale and shift layer. |
- class qkeras.qmac.QScaleShift(*args, **kwargs)[source]
Bases:
LayerQuantized scale and shift layer.
output = scale * x + bias where scale and bias are each of shape (1,).
- QScaleShift is similar to the special case in QDepthwiseConv2D
where kernel_size=(1,1). However there are several differences:
There is no concept of padding and striding in QScaleShift since
it’s not a conv layer;
QDepthwiseConv2D expected min_ndim=4 for input shape; while QScaleShift
input could be any shape;
In QDepthwiseConv2D each output channel has its own weight value;
while QScaleShift share the same weight across the entire input tensor.
Since it’s not a Conv operation, hardware implementation for
QScaleShift and QDWConv2D is fundamentally different. Therefore it makes sense to separate them as two different types of layers.