Skip to content

Commit

Permalink
Create model.h
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 6, 2024
1 parent ac4eba7 commit b0135bd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions blockchain_integration/pi_network/dapi/ai/ml/tensorflow/model.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef MODEL_H
#define MODEL_H

#include <string>
#include <vector>
#include <tensorflow/cc/ops/standard_ops.h>
#include <tensorflow/cc/saved_model/loader.h>
#include <tensorflow/cc/saved_model/tag_constants.h>

class Model {
public:
Model(const std::string& model_path);
~Model();

// Load the model from a file
void load();

// Run the model on input data
std::vector<float> run(const std::vector<float>& input);

// Get the model's input shape
std::vector<int> get_input_shape() const;

// Get the model's output shape
std::vector<int> get_output_shape() const;

private:
std::string model_path_;
tensorflow::Session* session_;
tensorflow::GraphDef graph_def_;
std::vector<tensorflow::Tensor> inputs_;
std::vector<tensorflow::Tensor> outputs_;
};

#endif // MODEL_H

0 comments on commit b0135bd

Please sign in to comment.