| 24 | namespace fastertransformer { |
| 25 | |
| 26 | static 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 | |
| 43 | static inline int trt_getS(int actual_seqlen, int size_per_head, bool use_int8 = false) |
| 44 | { |
no outgoing calls
no test coverage detected