Fix std::uniform_int_distribution usage in random uniform op
The standard does not specify support for char/int8 types, and compilation fails with MSVC. GitHub #47452 is related. PiperOrigin-RevId: 360082481 Change-Id: I3c8614bc8c7e8de10a1807c4f610df7385a8902f
This commit is contained in:
parent
fc1bdb3a68
commit
358948ec8d
@ -140,7 +140,7 @@ TfLiteStatus EvalInt(TfLiteContext* context, TfLiteNode* node) {
|
||||
size_t output_size = tflite::NumElements(output);
|
||||
switch (output->type) {
|
||||
case kTfLiteInt8:
|
||||
RandomUniformSample<int8_t, std::uniform_int_distribution<int8_t>>(
|
||||
RandomUniformSample<int8_t, std::uniform_int_distribution<int32_t>>(
|
||||
params->rng, GetTensorData<int8_t>(output), output_size, min_value,
|
||||
max_value);
|
||||
break;
|
||||
|
@ -36,6 +36,11 @@ tflite::TensorType GetTTEnum<double>() {
|
||||
return tflite::TensorType_FLOAT64;
|
||||
}
|
||||
|
||||
template <>
|
||||
tflite::TensorType GetTTEnum<int8_t>() {
|
||||
return tflite::TensorType_INT8;
|
||||
}
|
||||
|
||||
template <>
|
||||
tflite::TensorType GetTTEnum<int32_t>() {
|
||||
return tflite::TensorType_INT32;
|
||||
@ -150,7 +155,7 @@ class RandomUniformIntTest : public ::testing::Test {
|
||||
using Int = IntType;
|
||||
};
|
||||
|
||||
using TestTypesInt = ::testing::Types<int32_t, int64_t>;
|
||||
using TestTypesInt = ::testing::Types<int8_t, int32_t, int64_t>;
|
||||
|
||||
TYPED_TEST_SUITE(RandomUniformIntTest, TestTypesInt);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user