MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / getWeightNum

Function getWeightNum

examples/cpp/swin/functions.h:26–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace fastertransformer {
25
26static int getWeightNum(const int layer_num, const int* depths, const int version = 1)
27{
28 // We arrange weights layer by layer and block by block inside each layer;
29 // each block has 14 weights for version 1 or 15 weights for version 2
30 // each layer has a block list && 5 weights
31 // each swin transformer has a layer list && 6 weights && 3 handles
32
33 int weight_num = 6;
34 for (int l = 0; l < layer_num; l++) {
35 for (int di = 0; di < depths[l]; di++) {
36 weight_num += (version == 1 ? 14 : 15);
37 }
38 weight_num += 5;
39 }
40 return weight_num;
41}
42
43static inline int trt_getS(int actual_seqlen, int size_per_head, bool use_int8 = false)
44{

Callers 4

SwinTransformerPluginMethod · 0.85
testFunction · 0.85
testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected