The :class:`DorefaConv2d` class is a 2D quantized convolutional layer, which weights are 'bitW' bits and the output of the previous layer are 'bitA' bits while inferencing. Note that, the bias vector would not be binarized. Parameters ---------- bitW : int The bits of t
| 13 | |
| 14 | |
| 15 | class DorefaConv2d(Layer): |
| 16 | """The :class:`DorefaConv2d` class is a 2D quantized convolutional layer, which weights are 'bitW' bits and the output of the previous layer |
| 17 | are 'bitA' bits while inferencing. |
| 18 | |
| 19 | Note that, the bias vector would not be binarized. |
| 20 | |
| 21 | Parameters |
| 22 | ---------- |
| 23 | bitW : int |
| 24 | The bits of this layer's parameter |
| 25 | bitA : int |
| 26 | The bits of the output of previous layer |
| 27 | n_filter : int |
| 28 | The number of filters. |
| 29 | filter_size : tuple of int |
| 30 | The filter size (height, width). |
| 31 | strides : tuple of int |
| 32 | The sliding window strides of corresponding input dimensions. |
| 33 | It must be in the same order as the ``shape`` parameter. |
| 34 | act : activation function |
| 35 | The activation function of this layer. |
| 36 | padding : str |
| 37 | The padding algorithm type: "SAME" or "VALID". |
| 38 | use_gemm : boolean |
| 39 | If True, use gemm instead of ``tf.matmul`` for inferencing. |
| 40 | TODO: support gemm |
| 41 | data_format : str |
| 42 | "channels_last" (NHWC, default) or "channels_first" (NCHW). |
| 43 | dilation_rate : tuple of int |
| 44 | Specifying the dilation rate to use for dilated convolution. |
| 45 | W_init : initializer |
| 46 | The initializer for the the weight matrix. |
| 47 | b_init : initializer or None |
| 48 | The initializer for the the bias vector. If None, skip biases. |
| 49 | in_channels : int |
| 50 | The number of in channels. |
| 51 | name : None or str |
| 52 | A unique layer name. |
| 53 | |
| 54 | Examples |
| 55 | --------- |
| 56 | With TensorLayer |
| 57 | |
| 58 | >>> net = tl.layers.Input([8, 12, 12, 32], name='input') |
| 59 | >>> dorefaconv2d = tl.layers.QuanConv2d( |
| 60 | ... n_filter=32, filter_size=(5, 5), strides=(1, 1), act=tf.nn.relu, padding='SAME', name='dorefaconv2d' |
| 61 | ... )(net) |
| 62 | >>> print(dorefaconv2d) |
| 63 | >>> output shape : (8, 12, 12, 32) |
| 64 | |
| 65 | """ |
| 66 | |
| 67 | def __init__( |
| 68 | self, |
| 69 | bitW=1, |
| 70 | bitA=3, |
| 71 | n_filter=32, |
| 72 | filter_size=(3, 3), |
no outgoing calls
no test coverage detected
searching dependent graphs…