-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrelu_maxpool_transformer.h
34 lines (28 loc) · 1.19 KB
/
relu_maxpool_transformer.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
28
29
30
31
32
33
34
#ifndef SYRENN_SYRENN_SERVER_RELU_MAXPOOL_TRANSFORMER_H_
#define SYRENN_SYRENN_SERVER_RELU_MAXPOOL_TRANSFORMER_H_
#include <string>
#include <vector>
#include "syrenn_server/segmented_line.h"
#include "syrenn_server/maxpool_transformer.h"
#include "syrenn_server/transformer.h"
// Transformer for fused ReLU + MaxPool layers. This is automatically
// substituted for sequential ReLU/MaxPool layers in server.cc.
class ReLUMaxPoolTransformer : public MaxPoolTransformer {
public:
using MaxPoolTransformer::MaxPoolTransformer;
explicit ReLUMaxPoolTransformer(const MaxPoolTransformer &other)
: MaxPoolTransformer(other) {}
virtual void process_window(
// The windows in (H, W) format.
const Eigen::Map<RMMatrixXf, 0, Eigen::OuterStride<>> &from_window,
const Eigen::Map<RMMatrixXf, 0, Eigen::OuterStride<>> &to_window,
// The preimage-ratios for each endpoint.
double from_ratio, double to_ratio,
// The set to place the endpoints in.
tbb::concurrent_set<double> *endpoints) const;
void Compute(RMMatrixXf *inout) const;
std::string layer_type() const override {
return "ReLUMaxPool";
};
};
#endif // SYRENN_SYRENN_SERVER_RELU_MAXPOOL_TRANSFORMER_H_