// RUN: mlir-opt --tosa-test-quant-utils %s | FileCheck %s // ----- // CHECK-LABEL: test_build_qtype_unsigned func.func @test_build_qtype_unsigned(%arg0 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>>, %arg1: tensor<1xui8>, %arg2: tensor<1xui8>) -> tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> { // CHECK: tosa.negate %0 = "tosa.negate"(%arg0, %arg1, %arg2) : (tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>>, tensor<1xui8>, tensor<1xui8>) -> tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> return %0 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> } // ----- // CHECK-LABEL: test_build_qtype_signed func.func @test_build_qtype_signed(%arg0 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>>, %arg1: tensor<1xi8>, %arg2: tensor<1xi8>) -> tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> { // CHECK: tosa.negate %0 = "tosa.negate"(%arg0, %arg1, %arg2) : (tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>>, tensor<1xi8>, tensor<1xi8>) -> tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> return %0 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> } // ----- // CHECK-LABEL: test_build_mult_and_shift func.func @test_build_mult_and_shift(%arg0: tensor<1x32x32x8x!quant.uniform>, %arg1 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489>>, %arg2 : tensor<16xi32>) -> tensor<1x34x36x16x!quant.uniform> { // CHECK: tosa.conv2d %input_zp = "tosa.const"() {values = dense<-1> : tensor<1xi8>} : () -> tensor<1xi8> %weight_zp = "tosa.const"() {values = dense<1> : tensor<1xi8>} : () -> tensor<1xi8> %0 = "tosa.conv2d"(%arg0, %arg1, %arg2, %input_zp, %weight_zp) {acc_type = i32, pad = array, dilation = array, stride = array} : (tensor<1x32x32x8x!quant.uniform>, tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489>>, tensor<16xi32>, tensor<1xi8>, tensor<1xi8>) -> tensor<1x34x36x16x!quant.uniform> return %0 : tensor<1x34x36x16x!quant.uniform> }