Create an intermediate representation.

This way the visualiser does not need to know all about caffe, and can
just work on the intermediate representation which is a lot easier on
the compiler.
This commit is contained in:
2017-10-12 14:21:53 +02:00
parent c725fcb8df
commit 19390f8d4f
6 changed files with 157 additions and 31 deletions

50
src/LayerData.hpp Normal file
View File

@@ -0,0 +1,50 @@
#pragma once
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "utils.hpp"
namespace fmri {
using std::string;
using std::string_view;
using std::unique_ptr;
using std::vector;
class LayerData
{
public:
enum class Type {
Input,
Convolutional,
ReLU,
Pooling,
Output,
Other
};
LayerData(const string& name, const vector<int>& shape, const DType* data, Type type);
LayerData(const LayerData&) = delete;
LayerData(LayerData&&) = default;
LayerData& operator=(const LayerData&) = delete;
LayerData& operator=(LayerData&&) = default;
const string& name() const;
Type type() const;
const vector<int>& shape() const;
DType const * data() const;
size_t numEntries() const;
static Type typeFromString(string_view name);
private:
string name_;
vector<int> shape_;
unique_ptr<DType[]> data_;
Type type_;
};
}