ScriptIntrinsicBLAS.BNNM Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Performs an 8-bit matrix multiplication for neural networks, using input offsets and output scaling. The final output is calculated in 1.10.21 fixed-point format before its fractional bits are dropped.
[Android.Runtime.Register("BNNM", "(Landroid/renderscript/Allocation;ILandroid/renderscript/Allocation;ILandroid/renderscript/Allocation;II)V", "", ApiSince=23)]
public void BNNM(Android.Renderscripts.Allocation? A, int a_offset, Android.Renderscripts.Allocation? B, int b_offset, Android.Renderscripts.Allocation? C, int c_offset, int c_mult);
[<Android.Runtime.Register("BNNM", "(Landroid/renderscript/Allocation;ILandroid/renderscript/Allocation;ILandroid/renderscript/Allocation;II)V", "", ApiSince=23)>]
member this.BNNM : Android.Renderscripts.Allocation * int * Android.Renderscripts.Allocation * int * Android.Renderscripts.Allocation * int * int -> unit
Parameters
The input allocation contains matrix A, supported elements type Element#U8.
- a_offset
- Int32
The offset for all values in matrix A, e.g A[i,j] = A[i,j] - a_offset. Value should be from 0 to 255.
The input allocation contains matrix B, supported elements type Element#U8.
- b_offset
- Int32
The offset for all values in matrix B, e.g B[i,j] = B[i,j] - b_offset. Value should be from 0 to 255.
The output allocation for matrix C, with element type Element#U8.
- c_offset
- Int32
The offset for all values in matrix C.
- c_mult
- Int32
The fixed-point multiplier applied after the output offset.
- Attributes
Remarks
An 8-bit GEMM-like operation for neural networks uses A and the transpose of B, with input offsets and output scaling. Calculations are done in 1.10.21 fixed-point format for the final output, just before there's a shift down to drop the fractional parts. The output values are gated to 0 to 255 to fit in a byte, but the 10-bit format gives some headroom to avoid wrapping around on small overflows.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.