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

Function main

examples/cpp/vit/vit_example.cc:161–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161int main(int argc, char* argv[])
162{
163 struct cudaDeviceProp prop;
164 check_cuda_error(cudaGetDeviceProperties(&prop, 0));
165 printf("Device %s\n", prop.name);
166
167 if (argc != 9) {
168 printf(
169 "[ERROR] vit_example batch_size img_size patch_size embed_dim head_number layer_num with_cls_token is_fp16\n");
170 printf("e.g. ./bin/vit_example 1 224 16 768 12 12 1 0 \n");
171 return 0;
172 }
173
174 const int batch_size = atoi(argv[1]);
175 const int img_size = atoi(argv[2]);
176 const int patch_size = atoi(argv[3]);
177 const int embed_dim = atoi(argv[4]);
178 const int head_num = atoi(argv[5]);
179 const int layer_num = atoi(argv[6]);
180 const int token_classifier = atoi(argv[7]);
181 const int is_fp16 = atoi(argv[8]);
182
183 if (is_fp16) {
184 test<half>(batch_size, img_size, patch_size, embed_dim, head_num, layer_num, token_classifier);
185 }
186 else {
187 test<float>(batch_size, img_size, patch_size, embed_dim, head_num, layer_num, token_classifier);
188 }
189}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected