Implement a debug print for LayerData.
This commit is contained in:
@@ -63,3 +63,23 @@ LayerData::Type LayerData::typeFromString(string_view typeName)
|
||||
return Type::Other;
|
||||
}
|
||||
}
|
||||
|
||||
ostream& operator<< (ostream& o, const LayerData& layer)
|
||||
{
|
||||
o << layer.name() << '(';
|
||||
bool first = true;
|
||||
|
||||
for (auto d : layer.shape()) {
|
||||
if (!first) {
|
||||
o << ", ";
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
|
||||
o << d;
|
||||
}
|
||||
|
||||
o << ')';
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -7,44 +8,49 @@
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace fmri {
|
||||
namespace fmri
|
||||
{
|
||||
|
||||
using std::string;
|
||||
using std::string_view;
|
||||
using std::unique_ptr;
|
||||
using std::vector;
|
||||
using std::ostream;
|
||||
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
|
||||
};
|
||||
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(const string &name, const vector<int> &shape, const DType *data, Type type);
|
||||
LayerData(const LayerData &) = delete;
|
||||
|
||||
LayerData& operator=(const LayerData&) = delete;
|
||||
LayerData& operator=(LayerData&&) = default;
|
||||
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;
|
||||
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);
|
||||
static Type typeFromString(string_view name);
|
||||
|
||||
private:
|
||||
string name_;
|
||||
vector<int> shape_;
|
||||
unique_ptr<DType[]> data_;
|
||||
Type type_;
|
||||
};
|
||||
private:
|
||||
string name_;
|
||||
vector<int> shape_;
|
||||
unique_ptr<DType[]> data_;
|
||||
Type type_;
|
||||
};
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const fmri::LayerData&);
|
||||
|
||||
Reference in New Issue
Block a user