Create an extern op that compute fully connected of 1D tensor lhs and 2D tensor rhs with nnpack. Parameters ---------- lhs : Tensor lhs 1D array input[input_channels] of FP32 elements rhs : Tensor lhs 2D matrix kernel[output_channels][input_channels] of FP32 elem
(lhs, rhs, nthreads=1)
| 31 | |
| 32 | |
| 33 | def fully_connected_inference(lhs, rhs, nthreads=1): |
| 34 | """Create an extern op that compute fully connected of 1D tensor lhs and |
| 35 | 2D tensor rhs with nnpack. |
| 36 | |
| 37 | Parameters |
| 38 | ---------- |
| 39 | lhs : Tensor |
| 40 | lhs 1D array input[input_channels] of FP32 elements |
| 41 | rhs : Tensor |
| 42 | lhs 2D matrix kernel[output_channels][input_channels] of FP32 elements |
| 43 | |
| 44 | Returns |
| 45 | ------- |
| 46 | C : Tensor |
| 47 | lhs 1D array out[output_channels] of FP32 elements. |
| 48 | """ |
| 49 | m = rhs.shape[0] |
| 50 | return te.extern( |
| 51 | (m,), |
| 52 | [lhs, rhs], |
| 53 | lambda ins, outs: tvm.tirx.call_packed( |
| 54 | "tvm.contrib.nnpack.fully_connected_inference", ins[0], ins[1], outs[0], nthreads |
| 55 | ), |
| 56 | name="C", |
| 57 | ) |
| 58 | |
| 59 | |
| 60 | class ConvolutionAlgorithm: |
nothing calls this directly
no test coverage detected
searching dependent graphs…