The :class:`QuanConv2dWithBN` class is a quantized convolutional layer with BN, which weights are 'bitW' bits and the output of the previous layer are 'bitA' bits while inferencing. Note that, the bias vector would keep the same. Parameters ---------- n_filter : int The
| 16 | |
| 17 | |
| 18 | class QuanConv2dWithBN(Layer): |
| 19 | """The :class:`QuanConv2dWithBN` class is a quantized convolutional layer with BN, which weights are 'bitW' bits and the output of the previous layer |
| 20 | are 'bitA' bits while inferencing. |
| 21 | |
| 22 | Note that, the bias vector would keep the same. |
| 23 | |
| 24 | Parameters |
| 25 | ---------- |
| 26 | n_filter : int |
| 27 | The number of filters. |
| 28 | filter_size : tuple of int |
| 29 | The filter size (height, width). |
| 30 | strides : tuple of int |
| 31 | The sliding window strides of corresponding input dimensions. |
| 32 | It must be in the same order as the ``shape`` parameter. |
| 33 | padding : str |
| 34 | The padding algorithm type: "SAME" or "VALID". |
| 35 | act : activation function |
| 36 | The activation function of this layer. |
| 37 | decay : float |
| 38 | A decay factor for `ExponentialMovingAverage`. |
| 39 | Suggest to use a large value for large dataset. |
| 40 | epsilon : float |
| 41 | Eplison. |
| 42 | is_train : boolean |
| 43 | Is being used for training or inference. |
| 44 | beta_init : initializer or None |
| 45 | The initializer for initializing beta, if None, skip beta. |
| 46 | Usually you should not skip beta unless you know what happened. |
| 47 | gamma_init : initializer or None |
| 48 | The initializer for initializing gamma, if None, skip gamma. |
| 49 | bitW : int |
| 50 | The bits of this layer's parameter |
| 51 | bitA : int |
| 52 | The bits of the output of previous layer |
| 53 | use_gemm : boolean |
| 54 | If True, use gemm instead of ``tf.matmul`` for inferencing. (TODO). |
| 55 | W_init : initializer |
| 56 | The initializer for the the weight matrix. |
| 57 | W_init_args : dictionary |
| 58 | The arguments for the weight matrix initializer. |
| 59 | data_format : str |
| 60 | "NHWC" or "NCHW", default is "NHWC". |
| 61 | dilation_rate : tuple of int |
| 62 | Specifying the dilation rate to use for dilated convolution. |
| 63 | in_channels : int |
| 64 | The number of in channels. |
| 65 | name : str |
| 66 | A unique layer name. |
| 67 | |
| 68 | Examples |
| 69 | --------- |
| 70 | >>> import tensorlayer as tl |
| 71 | >>> net = tl.layers.Input([50, 256, 256, 3]) |
| 72 | >>> layer = tl.layers.QuanConv2dWithBN(n_filter=64, filter_size=(5,5),strides=(1,1),padding='SAME',name='qcnnbn1') |
| 73 | >>> print(layer) |
| 74 | >>> net = tl.layers.QuanConv2dWithBN(n_filter=64, filter_size=(5,5),strides=(1,1),padding='SAME',name='qcnnbn1')(net) |
| 75 | >>> print(net) |