layers.h 3.1 KB
Newer Older
dengjb's avatar
update  
dengjb committed
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#pragma once

#include <map>
#include <math.h>
#include <assert.h>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
using namespace nvinfer1;

namespace trtxapi {

    IActivationLayer* addMinClamp(INetworkDefinition* network, 
        ITensor& input, 
        const float min);

    ITensor* addDiv255(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor* input,
        const std::string lname);
        
    ITensor* addMeanStd(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor* input, 
        const std::string lname,
        const float* mean, 
        const float* std, 
        const bool div255);

    IScaleLayer* addBatchNorm2d(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const std::string lname, 
        const float eps);

    IScaleLayer* addInstanceNorm2d(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const std::string lname, 
        const float eps);

    IConcatenationLayer* addIBN(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const std::string lname);

    IActivationLayer* basicBlock_ibn(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const int inch, 
        const int outch,
        const int stride, 
        const std::string lname, 
        const std::string ibn);

    IActivationLayer* bottleneck_ibn(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const int inch, 
        const int outch,
        const int stride, 
        const std::string lname, 
        const std::string ibn);

    ILayer* distill_basicBlock_ibn(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const int inch, 
        const int outch,
        const int stride, 
        const std::string lname, 
        const std::string ibn);

    ILayer* distill_bottleneck_ibn(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const int inch, 
        const int outch,
        const int stride, 
        const std::string lname, 
        const std::string ibn);

    IShuffleLayer* addShuffle2(INetworkDefinition* network, 
        ITensor& input, 
        const Dims dims, 
        const Permutation pmt, 
        const bool reshape_first);

    IElementWiseLayer* Non_local(INetworkDefinition* network, 
        std::map<std::string, Weights>& weightMap, 
        ITensor& input, 
        const std::string lname, 
        const int reduc_ratio = 2);

    IPoolingLayer* addAdaptiveAvgPool2d(INetworkDefinition* network, 
        ITensor& input, 
        const DimsHW output_dim = DimsHW{1,1});

    IScaleLayer* addGeneralizedMeanPooling(INetworkDefinition* network, 
        ITensor& input, 
        const float norm = 3.f, 
        const DimsHW output_dim = DimsHW{1,1}, 
        const float eps = 1e-6);
}