predictor_output.h 947 字节
Newer Older
A
authorfu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#pragma once

#include <paddle_api.h>
#include <vector>
#include "common.h"

namespace ppredictor {
class PredictorOutput {
public:
    PredictorOutput(){

    }
    PredictorOutput(std::unique_ptr<const paddle::lite_api::Tensor> &&tensor, int index, int net_flag) :
        _tensor(std::move(tensor)), _index(index), _net_flag(net_flag) {

    }

    const float* get_float_data() const;
    const int* get_int_data() const;
    int64_t get_size() const;
    const std::vector<std::vector<uint64_t>> get_lod() const;
    const  std::vector<int64_t> get_shape() const;

A
authorfu 已提交
24 25 26 27
    std::vector<float> data; // return float, or use data_int
    std::vector<int> data_int; // several layers return int ,or use data
    std::vector<int64_t> shape; // PaddleLite output shape
    std::vector<std::vector<uint64_t>> lod; // PaddleLite output lod
A
authorfu 已提交
28 29 30 31 32 33 34 35

private:
    std::unique_ptr<const paddle::lite_api::Tensor> _tensor;
    int _index;
    int _net_flag;
};
}