11
11
#include < executorch/runtime/core/exec_aten/testing_util/tensor_factory.h>
12
12
#include < executorch/runtime/core/exec_aten/testing_util/tensor_util.h>
13
13
#include < executorch/runtime/core/exec_aten/util/scalar_type_util.h>
14
+ #include < executorch/runtime/platform/runtime.h>
14
15
#include < executorch/test/utils/DeathTest.h>
15
16
16
17
#include < gtest/gtest.h>
@@ -57,10 +58,12 @@ void test_dtype() {
57
58
}
58
59
59
60
TEST (OpDequantizeOutTest, AllDtypesSupported) {
61
+ et_pal_init ();
60
62
test_dtype<ScalarType::Byte>();
61
63
}
62
64
63
65
TEST (OpDequantizeOutTest, NonWholeNumbers) {
66
+ et_pal_init ();
64
67
TensorFactory<ScalarType::Byte> tf;
65
68
66
69
Tensor input = tf.full ({3 , 5 }, 100 );
@@ -87,6 +90,7 @@ TEST(OpDequantizeOutTest, NonWholeNumbers) {
87
90
}
88
91
89
92
TEST (OpDequantizeOutTest, TensorArgOverload) {
93
+ et_pal_init ();
90
94
TensorFactory<ScalarType::Byte> tf_byte;
91
95
TensorFactory<ScalarType::Double> tf_double;
92
96
TensorFactory<ScalarType::Long> tf_long;
@@ -115,12 +119,13 @@ TEST(OpDequantizeOutTest, TensorArgOverload) {
115
119
}
116
120
117
121
TEST (OpDequantizeOutTest, DequantizePerChannel) {
122
+ et_pal_init ();
118
123
TensorFactory<ScalarType::Byte> tf_byte;
119
- TensorFactory<ScalarType::Float> tf_float ;
124
+ TensorFactory<ScalarType::Double> tf_double ;
120
125
TensorFactory<ScalarType::Long> tf_long;
121
126
122
127
Tensor input = tf_byte.full ({3 , 2 }, 100 );
123
- Tensor scale = tf_float .make ({2 }, {0.5 , 1 });
128
+ Tensor scale = tf_double .make ({2 }, {0.5 , 1 });
124
129
Tensor zero_point = tf_long.make ({2 }, {30 , 60 });
125
130
int64_t quant_min = 0 ;
126
131
int64_t quant_max = 255 ;
@@ -145,7 +150,7 @@ TEST(OpDequantizeOutTest, DequantizePerChannel) {
145
150
146
151
// Test with a different axis
147
152
out = tfo.zeros ({3 , 2 });
148
- scale = tf_float .make ({3 }, {0.5 , 0.75 , 1 });
153
+ scale = tf_double .make ({3 }, {0.5 , 0.75 , 1 });
149
154
zero_point = tf_long.make ({3 }, {30 , 50 , 60 });
150
155
// (100 - 30) * 0.5
151
156
// (100 - 50) * 0.75
@@ -167,7 +172,7 @@ TEST(OpDequantizeOutTest, DequantizePerChannel) {
167
172
// Test with a different axis
168
173
out = tfo.zeros ({3 });
169
174
input = tf_byte.make ({3 }, {100 , 100 , 100 });
170
- scale = tf_float .make ({3 }, {0.5 , 0.75 , 1 });
175
+ scale = tf_double .make ({3 }, {0.5 , 0.75 , 1 });
171
176
zero_point = tf_long.make ({3 }, {30 , 50 , 60 });
172
177
// (100 - 30) * 0.5
173
178
// (100 - 50) * 0.75
0 commit comments