Skip to content

Commit 2b23670

Browse files
committed
format
1 parent ddd4b1e commit 2b23670

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

onnxruntime/core/providers/coreml/builders/impl/softmax_op_builder.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Status SoftmaxOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
3535
NodeAttrHelper helper(node);
3636
int32_t axis_default_value = (node.SinceVersion() < 13) ? 1 : -1;
3737
const auto axis = helper.Get("axis", axis_default_value);
38-
auto axis_nonnegative = HandleNegativeAxis(axis, data_shape.size());
38+
auto axis_nonnegative = HandleNegativeAxis(axis, data_shape.size());
3939

4040
#if defined(COREML_ENABLE_MLPROGRAM)
4141
// CoreML's softmax match onnx's softmax behavior since opset 13.
@@ -47,15 +47,15 @@ Status SoftmaxOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
4747
const int32_t elem_type = static_cast<int32_t>(input_dtype);
4848

4949
std::string_view layer_input_name_x = node.InputDefs()[0]->Name();
50-
const bool need_reshape = node.SinceVersion() < 13 && axis_nonnegative != static_cast<int64_t>(data_shape.size()) - 1;
50+
const bool need_reshape = node.SinceVersion() < 13 && axis_nonnegative != static_cast<int64_t>(data_shape.size()) - 1;
5151
std::vector<int64_t> target_shape;
5252
if (need_reshape) {
5353
// reshape to 2D to simulate onnx softmax behavior
5454
auto reshape1 = model_builder.CreateOperation(node, "reshape", "pre");
5555
TensorShape input_shape(data_shape);
56-
target_shape.push_back(input_shape.SizeToDimension(axis_nonnegative ));
57-
target_shape.push_back(input_shape.SizeFromDimension(axis_nonnegative ));
58-
axis_nonnegative = 1;
56+
target_shape.push_back(input_shape.SizeToDimension(axis_nonnegative));
57+
target_shape.push_back(input_shape.SizeFromDimension(axis_nonnegative));
58+
axis_nonnegative = 1;
5959
AddOperationInput(*reshape1, "x", layer_input_name_x);
6060
AddOperationInput(*reshape1, "shape", model_builder.AddConstant(reshape1->type(), "shape1", target_shape));
6161
layer_input_name_x = model_builder.GetUniqueName(node, "ln_reshape1_");
@@ -64,7 +64,7 @@ Status SoftmaxOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
6464
}
6565
std::unique_ptr<Operation> op = model_builder.CreateOperation(node, "softmax");
6666
AddOperationInput(*op, "x", layer_input_name_x);
67-
AddOperationInput(*op, "axis", model_builder.AddScalarConstant(op->type(), "axis", axis_nonnegative ));
67+
AddOperationInput(*op, "axis", model_builder.AddScalarConstant(op->type(), "axis", axis_nonnegative));
6868
if (!need_reshape) {
6969
AddOperationOutput(*op, *node.OutputDefs()[0]);
7070
model_builder.AddOperation(std::move(op));
@@ -91,8 +91,8 @@ Status SoftmaxOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
9191
// note: if opsets < 13, onnx Softmax coerces the input shape to be 2D based on axis.
9292
// we need to manually reshape to 2D and apply SoftmaxND to axis -1 to achieve equivalent results for CoreML.
9393
TensorShape input_shape(data_shape);
94-
const auto size_to_dimension = input_shape.SizeToDimension(axis_nonnegative );
95-
const auto size_from_dimension = input_shape.SizeFromDimension(axis_nonnegative );
94+
const auto size_to_dimension = input_shape.SizeToDimension(axis_nonnegative);
95+
const auto size_from_dimension = input_shape.SizeFromDimension(axis_nonnegative);
9696

9797
TensorShapeVector target_shape;
9898
target_shape.push_back(size_to_dimension);

onnxruntime/core/providers/cpu/tensor/unsqueeze.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UnsqueezeBase {
2020
};
2121

2222
Status PrepareCompute(OpKernelContext* context, Prepare& p) const;
23-
static TensorShapeVector ComputeOutputShape(
23+
static TensorShapeVector ComputeOutputShape(
2424
const TensorShape& input_shape,
2525
const TensorShapeVector& axes) {
2626
TensorShapeVector output_shape;

0 commit comments

Comments
 (0)