Use narrow instead of gsl::narrow. (#13555)

This commit is contained in:
Edward Chen 2022-11-03 16:24:11 -07:00 committed by GitHub
parent 2de883c592
commit b4a1ae8350
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@
#include "core/providers/coreml/builders/impl/builder_utils.h"
#include "core/providers/coreml/builders/model_builder.h"
#endif
#include "core/common/narrow.h"
#include "core/providers/common.h"
#include "core/providers/coreml/builders/helper.h"
#include "core/providers/coreml/builders/impl/base_op_builder.h"
@ -51,7 +52,7 @@ Status AddPReluWeight(ModelBuilder& model_builder, const Node& node,
COREML_SPEC::ActivationPReLU& prelu) {
// add slope initializer as alpha weight
const auto& slope_tensor = *model_builder.GetInitializerTensors().at(node.InputDefs()[1]->Name());
const auto slope_tensor_num_elements = gsl::narrow<size_t>(Product(slope_tensor.dims()));
const auto slope_tensor_num_elements = narrow<size_t>(Product(slope_tensor.dims()));
if (slope_tensor_num_elements != 1) {
ORT_RETURN_IF_ERROR(CreateCoreMLWeight(*prelu.mutable_alpha(), slope_tensor));
} else {