-
Notifications
You must be signed in to change notification settings - Fork 2
/
SpatiallySparseLayer.h
27 lines (26 loc) · 1.25 KB
/
SpatiallySparseLayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include <iostream>
#include "SpatiallySparseBatchInterface.h"
#include "SpatiallySparseBatch.h"
class SpatiallySparseLayer {
public:
cudaMemStream &memStream;
virtual void preprocess(SpatiallySparseBatch &batch,
SpatiallySparseBatchInterface &input,
SpatiallySparseBatchInterface &output) = 0;
virtual void forwards(SpatiallySparseBatch &batch,
SpatiallySparseBatchInterface &input,
SpatiallySparseBatchInterface &output) = 0;
virtual void scaleWeights(SpatiallySparseBatchInterface &input,
SpatiallySparseBatchInterface &output,
float &scalingUnderneath, bool topLayer);
virtual void backwards(SpatiallySparseBatch &batch,
SpatiallySparseBatchInterface &input,
SpatiallySparseBatchInterface &output,
float learningRate, float momentum) = 0;
SpatiallySparseLayer(cudaMemStream &memStream);
~SpatiallySparseLayer();
virtual void loadWeightsFromStream(std::ifstream &f, bool momentum);
virtual void putWeightsToStream(std::ofstream &f, bool momentum);
virtual int calculateInputSpatialSize(int outputSpatialSize) = 0;
};