summaryrefslogtreecommitdiff
path: root/inference-engine/tests/mock_engine/stub_inference_engine.xpp
blob: fa2d9de1faa16d5af2c54f875df5bb7b41065d5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (C) 2018 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include <random>
#include <algorithm>

#include "stub_inference_engine.hpp"

using namespace InferenceEngine;
using namespace std;

void StubInferenceEngine::Infere(const Blob &input, Blob & output) {
    unsigned int batchNumber = input.dims().size() > 3 ? input.dims()[3] : 1;
    auto &outBlob = dynamic_cast<TBlob<float>&>(output);
    outBlob.Resize({ 1000, batchNumber });
    outBlob.allocate();
    
    //uniform distribution in 0-1 range
    random_device rd;
    mt19937 mersen(rd());
    uniform_real_distribution<float> uniformDistribution(0 , 1);
    generate(outBlob.data(), outBlob.data() + outBlob.size(), [&] () {
        return uniformDistribution(mersen);
    });
}