mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-12-23 06:44:24 +00:00
Migrate module to tensors
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
#ifndef CUDANET_MODULE_H
|
||||
#define CUDANET_MODULE_H
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "layer.hpp"
|
||||
|
||||
namespace CUDANet {
|
||||
|
||||
class Module : public Layers::SequentialLayer {
|
||||
public:
|
||||
virtual float* forward(const float* d_input) = 0;
|
||||
|
||||
int getOutputSize();
|
||||
int getInputSize();
|
||||
|
||||
void addLayer(const std::string& name, Layers::SequentialLayer* layer);
|
||||
|
||||
const std::vector<std::pair<std::string, Layers::SequentialLayer*>>& getLayers() const;
|
||||
|
||||
protected:
|
||||
std::vector<std::pair<std::string, Layers::SequentialLayer*>> layers;
|
||||
|
||||
int outputSize;
|
||||
int inputSize;
|
||||
};
|
||||
|
||||
} // namespace CUDANet
|
||||
|
||||
#endif
|
||||
35
include/module.hpp
Normal file
35
include/module.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "layer.hpp"
|
||||
|
||||
namespace CUDANet {
|
||||
|
||||
class Module {
|
||||
public:
|
||||
CUDANet::Shape input_shape();
|
||||
|
||||
CUDANet::Shape output_shape();
|
||||
|
||||
size_t input_size();
|
||||
|
||||
size_t output_size();
|
||||
|
||||
void register_layer(const std::string& name, Layer& layer);
|
||||
|
||||
void register_module(Module& module);
|
||||
|
||||
const std::vector<std::pair<std::string, Layer&>>& get_layers() const;
|
||||
|
||||
protected:
|
||||
std::vector<std::pair<std::string, Layer&>> layers;
|
||||
|
||||
CUDANet::Shape in_shape;
|
||||
CUDANet::Shape out_shape;
|
||||
};
|
||||
|
||||
} // namespace CUDANet
|
||||
Reference in New Issue
Block a user