Dims<4> shapeToDims(const Shape &s)
{
Dims<4> dims;
- assert(s.getDims() == 4);
+ int rank = s.getDims();
+ assert(rank == 4);
int stride = 1;
- for (int i = 0; i < s.getDims(); ++i)
+ for (int i = 0; i < rank; ++i)
{
- dims.sizes[i] = s[i];
+ dims.sizes[i] = s[rank - 1 - i];
dims.strides[i] = stride;
- stride *= s[i];
+ stride *= s[rank - 1 - i];
}
return dims;
}
{
const float *input[] = {args.getData()...};
Dims<4> input_d[] = {shapeToDims(args.getShape())...};
- int axis = deserializeT<char>(params);
+ // 3 - ... because inner functions accepts axis in reverse order
+ int axis = 3 - deserializeT<char>(params);
Shape out_s = deserializeShape(params);
int inputs_count = sizeof(input)/sizeof(input[0]);