bitorch.models.quicknet.QuickNet

class bitorch.models.quicknet.QuickNet(input_shape: List[int], section_filters: Optional[List[int]] = None, section_blocks: Optional[List[int]] = None, num_classes: int = 0)[source]

QuickNet model from “Larq Compute Engine: Design, Benchmark, and Deploy State-of-the-Art Binarized Neural Networks” paper.

Methods

__init__

Initializes internal Module state, shared by both nn.Module and ScriptModule.

clip_weights

Clips weights in quantized convolution layer in Residual Blocks

on_train_batch_end

Is used with the pytorch lighting on_train_batch_end callback

Attributes

name

__init__(input_shape: List[int], section_filters: Optional[List[int]] = None, section_blocks: Optional[List[int]] = None, num_classes: int = 0) None[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

clip_weights(layer: Module, clip_value: float = 1.25) None[source]

Clips weights in quantized convolution layer in Residual Blocks

on_train_batch_end(layer: Module) None[source]

Is used with the pytorch lighting on_train_batch_end callback

Implement it to e.g. clip weights after optimization. Is recursively applied to every submodule.

Parameters:

layer (nn.Module) – current layer