1 // Copyright (C) 2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
13 #include <ie_layers.h>
14 #include "ie_const_infer_impl.hpp"
16 namespace InferenceEngine {
17 namespace ShapeInfer {
20 *@brief Implementation of Const inference for TBD layer
22 class PowerConstInfer : public ConstInferImpl {
24 explicit PowerConstInfer(const std::string& type) : ConstInferImpl(type) {}
26 void inferImpl(const std::vector<Blob::CPtr>& inData,
27 const std::map<std::string, std::string>& params,
28 const std::map<std::string, Blob::Ptr>& blobs,
29 std::vector<Blob::Ptr>& outData) override {
32 layer.params = params;
34 _validator->parseParams(&layer);
36 float scale = layer.scale;
37 float power = layer.power;
38 float shift = layer.offset;
40 // TODO: check for access and sizes
41 auto* input = inData[0]->cbuffer().as<float*>();
42 auto* output = outData[0]->buffer().as<float*>();
43 size_t dataSize = inData[0]->size();
46 for (int i = 0; i < dataSize; i++) {
47 output[i] = input[i] * scale + shift;
50 for (int i = 0; i < dataSize; i++) {
51 output[i] = pow(input[i] * scale + shift, power);
57 } // namespace ShapeInfer
58 } // namespace InferenceEngine