# Crate caffe2op_i8quantized

source ·## Macros

## Structs

- | consumes an input blob X and applies | average pooling across the the blob | according to kernel sizes, stride sizes, | and pad lengths defined by the ConvPoolOpBase | operator. | | Average pooling consisting of averaging | all values of a subset of the input tensor | according to the kernel size and downsampling | the data into the output blob Y for further | processing. |
- | Concatenate a list of tensors into a | single tensor |
- | The convolution operator consumes | an input vector, a ND filter blob and | a bias blob and computes the output. | | [Only NHWC order is supported now]Note | that other parameters, such as the stride | and kernel size, or the pads’ sizes in | each direction are not necessary for | input because they are provided by the | ConvPoolOpBase operator. | | Various dimension checks are done implicitly, | and the sizes are specified in the Input | docs for this operator. | | As is expected, the filter is convolved | with a subset of the image and the bias | is added; this is done throughout the | image data and the output is computed. | | As a side note on the implementation | layout: conv_op_impl.h is the templated | implementation of the conv_op.h file, | which is why they are separate files. |
- | The transposed convolution consumes | an input vector, the filter blob, and | the bias blob, and computes the output. | | ———– | @note | | other parameters, such as the stride | and kernel size, or the pads’ sizes in | each direction are not necessary for | input because they are provided by the | ConvTransposeUnpoolOpBase operator. | | Various dimension checks are done implicitly, | and the sizes are specified in the Input | docs for this operator. | | As is expected, the filter is deconvolved | with a subset of the image and the bias | is added; this is done throughout the | image data and the output is computed. | | As a side note on the implementation | layout: conv_transpose_op_impl.h | is the templated implementation of | the conv_transpose_op.h file, which | is why they are separate files. |
- | Computes the result of passing an input | vector | | X into a fully connected layer with 2D | weight matrix W and 1D bias vector b. | | That is, the layer computes Y = X * W^T | + b, where | | X has size (M x K), W has size (N x K), b has | size (N), and Y has size (M x N), where | M is often the batch size. | | ———– | @note | | X does not need to explicitly be a 2D vector; | rather, it will be coerced into one. | | For an arbitrary n-dimensional tensor | X \in [a_0, a_1 * … * a_{n-1}]. | | Only this case is supported! Lastly, | even though b is a 1D vector of size N, | it is copied/resized to be size (M x N) | implicitly and added to each vector | in the batch. | | Each of these dimensions must be matched | correctly, or else the operator will | throw errors. |
- | Flattens the input tensor into a 2D matrix. | If input tensor has shape | | (d_0, d_1, … d_n) | | then the output will have shape | | (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) | … X dn) |
- | Creates quantized tensor of type int32 | with scale and zero point info. |
- | Creates quantized tensor of type char(byte) | with scale and zero point info. |
- | LeakyRelu takes input data (Tensor
) | and an argument alpha, and produces | one output data (Tensor ) where the | function `f(x) = alpha x for x < 0`

,`f(x) | = x for x >= 0`

, is applied to the data tensor | elementwise. | - | MaxPoolND consumes an input blob X and | applies max pooling across the the blob | according to kernel sizes, stride sizes, | and pad lengths defined by the ConvPoolOpBase | operator. | | Max pooling consisting of taking the | maximum value of a subset of the input | tensor according to the kernel size | and downsampling the data into the output | blob Y for further processing. |
- | Relu takes one input data (Tensor
) | and produces one output data (Tensor ) | where the rectified linear function, | y = max(0, x), is applied to the tensor | elementwise. | - | Reshape the input tensor similar to | numpy.reshape. | | It takes a tensor as input and an optional | tensor specifying the new shape. | | When the second input is absent, an extra | argument
`shape`

must be specified. | | It outputs the reshaped tensor as well | as the original shape. | | At most one dimension of the new shape | can be -1. | | In this case, the value is inferred from | the size of the tensor and the remaining | dimensions. | | A dimension could also be 0, in which | case the actual dimension value is going | to be copied from the input tensor. | - | Resizes the spatial dimensions of the | input using nearest neighbor interpolation. | | The
`width_scale`

and`height_scale`

| arguments control the size of the output, | which is given by: | | output_width = floor(input_width | * width_scale) | | output_height = floor(output_height | height_scale) | - | Region of Interest (RoI) align operation | as used in Mask R-CNN. |
- | Apply the Sigmoid function element-wise | to the input tensor. | | This is often used as a non-linear activation | function in a neural network. | | The sigmoid function is defined as: | | $$Sigmoid(x) = \frac{1}{1+\exp(-x)}$$ | | Github Links: | | - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/sigmoid_op.cc |
- | Produces a slice of the input Int8 tensor. | | Currently, only slicing in a single | dimension is supported. | | Slices are passed as 2 1D vectors or as | two keyword argument lists with starting | and end indices for each dimension of | the input
`data`

tensor. | | If a negative value is passed for any | of the start or end indices, it represents | the number of elements before the end | of that dimension. | | End indices are non-inclusive unless | negative (end index -1 means up to and | including the last element). | - | The operator computes the softmax normalized | values for each layer in the batch of | the given input. | | The input is a 2-D tensor (Tensor
) | of size (batch_size x input_feature_dimensions). | | The output tensor has the same shape | and contains the softmax normalized | values of the corresponding input. | | X does not need to explicitly be a 2D vector; | rather, it will be coerced into one. | | For an arbitrary n-dimensional tensor | | X \in [a_0, a_1, …, a_{k-1}, a_k, …, | a_{n-1}] and k is the axis provided, | then X will be coerced into a 2-dimensional | tensor with dimensions [a_0 * … * a_{k-1}, | a_k * … * a_{n-1}]. | | For the default case where axis=1, this | means the X tensor will be coerced into | a 2D tensor of dimensions [a_0, a_1 * | … * a_{n-1}], where a_0 is often the | batch size. | | In this situation, we must have a_0 = | N and a_1 * … * a_{n-1} = D. | | Each of these dimensions must be matched | correctly, or else the operator will | throw errors. | - | Transpose the input tensor by permuting | the axes of the input according to the |
`axes`

argument. | | Similar to numpy’s transpose | function. | | For example, when axes=(1, 0, 2), given | an input tensor of shape | | (1, 2, 3), the output shape will be (2, | 1, 3). |

## Enums

## Functions

- | for quantized Add, the error shouldn’t | exceed 2 * scale |
- | Initialized QNNPACK (only once). | | Throws if initialization failed. |