30 std::vector<ITensorHandle*> outputs)
const
36 std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputInfo, inputs[0]->
Map());
39 std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputInfo, outputs[0]->
Map());
42 auto getNumberOfElements = [](
const TensorShape& tensorShape,uint32_t startAxis, uint32_t lastAxis)
45 for (uint32_t i = startAxis; i < lastAxis; i++)
47 count *= tensorShape[i];
55 const uint32_t groupSize = tensorShape[channelsAxis] / numGroups;
57 uint32_t outerSize = getNumberOfElements(tensorShape, 0, channelsAxis);
58 uint32_t innerSize = getNumberOfElements(tensorShape, channelsAxis + 1, tensorShape.GetNumDimensions());
60 for (uint32_t outer = 0; outer < outerSize; ++outer)
62 for (uint32_t inner = 0; inner < innerSize; ++inner)
64 uint32_t decoderStep1 = outer * tensorShape[channelsAxis] * innerSize + inner;
65 decoder += decoderStep1;
66 uint32_t encoderStep1 = outer * tensorShape[channelsAxis] * innerSize + inner;
67 encoder += encoderStep1;
68 for (uint32_t i = 0; i < groupSize; i++)
70 for (uint32_t j = 0; j < numGroups; j++, encoder += innerSize, encoderStep1 += innerSize)
72 decoder += innerSize * (i + j * groupSize);
73 float decoded = decoder.
Get();
75 decoder -= innerSize * (i + j * groupSize);
78 decoder -= decoderStep1;
79 encoder -= encoderStep1;