Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CoreML ML Program Resize #21370

Merged
merged 11 commits into from
Jul 19, 2024
Prev Previous commit
Next Next commit
lint
  • Loading branch information
skottmckay committed Jul 18, 2024
commit f002f3d1f8c436f2019b05cafa68b2be8d55b5f2
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@

#if defined(COREML_ENABLE_MLPROGRAM)
if (model_builder.CreateMLProgram()) {
using namespace CoreML::Specification::MILSpec;

Check warning on line 216 in onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Do not use namespace using-directives. Use using-declarations instead. [build/namespaces] [5] Raw Output: onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc:216: Do not use namespace using-directives. Use using-declarations instead. [build/namespaces] [5]

std::string_view coreml_op_type;
if (using_scales) {
Expand Down Expand Up @@ -278,7 +278,7 @@

AddOperationOutput(*op, *output_defs[0]);
model_builder.AddOperation(std::move(op));
} else

Check warning on line 281 in onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 If an else has a brace on one side, it should have it on both [readability/braces] [5] Raw Output: onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc:281: If an else has a brace on one side, it should have it on both [readability/braces] [5]
#endif
{
std::unique_ptr<COREML_SPEC::NeuralNetworkLayer> layer = model_builder.CreateNNLayer(node);
Expand Down Expand Up @@ -423,12 +423,12 @@
} else if (scale_h <= 1.f && scale_w <= 1.f) {
// downsample
if (input_params.create_mlprogram) {
// use double when applying the scale in case we get a value > 16,777,216, which is 1 << 24
// use double when applying the scale in case we get a value > 16,777,216, which is 1 << 24
// and the max integer value a 32-bit float can represent accurately with its mantissa
auto h_in = input_shape[input_rank - 2];
auto w_in = input_shape[input_rank - 1];
auto h_out = double(h_in) * scale_h;

Check warning on line 430 in onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Using deprecated casting style. Use static_cast<double>(...) instead [readability/casting] [4] Raw Output: onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc:430: Using deprecated casting style. Use static_cast<double>(...) instead [readability/casting] [4]
auto w_out = double(w_in) * scale_w;

Check warning on line 431 in onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Using deprecated casting style. Use static_cast<double>(...) instead [readability/casting] [4] Raw Output: onnxruntime/core/providers/coreml/builders/impl/resize_op_builder.cc:431: Using deprecated casting style. Use static_cast<double>(...) instead [readability/casting] [4]

if (std::floor(h_out) != h_out) {
LOGS(logger, VERBOSE) << "Resize: downsampling output height: " << h_out
Expand Down
Loading