MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ShuffleDims

Function ShuffleDims

tensorflow/lite/toco/tooling_util.cc:2085–2102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2083}
2084
2085void ShuffleDims(const Shape& input_shape, AxesOrder input_axes_order,
2086 AxesOrder output_axes_order, Shape* output_shape) {
2087 if (input_axes_order == AxesOrder::kHWIM &&
2088 output_axes_order == AxesOrder::k1HWO) {
2089 // This special case isn't just a permutation, the IM pair of dims get
2090 // merged into the 3 dim, so we have to special-case it.
2091 *output_shape = Shape({1, input_shape.dims(0), input_shape.dims(1),
2092 input_shape.dims(3) * input_shape.dims(2)});
2093 } else {
2094 std::vector<int> shuffle;
2095 GetShuffleShape(input_axes_order, output_axes_order, &shuffle);
2096 std::vector<int>* output_dims = output_shape->mutable_dims();
2097 output_dims->resize(input_shape.dimensions_count());
2098 for (int i = 0; i < input_shape.dimensions_count(); i++) {
2099 (*output_dims)[i] = input_shape.dims(shuffle[i]);
2100 }
2101 }
2102}
2103
2104template <typename T>
2105void ShuffleArrayTemplate(const Shape& input_shape, AxesOrder input_axes_order,

Callers 2

ExportFloatArrayFunction · 0.85

Calls 6

GetShuffleShapeFunction · 0.85
mutable_dimsMethod · 0.80
dimensions_countMethod · 0.80
ShapeClass · 0.70
dimsMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected