Download tests/combo_test.cpp from cwenzi/neuroflow-cpp: direct link, hf CLI and curl.
- Browser
- Download file 951 Bytes
-
https://huggingface.co/cwenzi/neuroflow-cpp/resolve/main/tests/combo_test.cpp
- Command line
-
hf download hf://cwenzi/neuroflow-cpp/tests/combo_test.cpp
-
curl -L -o combo_test.cpp https://huggingface.co/cwenzi/neuroflow-cpp/resolve/main/tests/combo_test.cpp
951 Bytes
| using namespace neuroflow; | |
| int main() { | |
| std::cout << "Combo test..." << std::endl; | |
| Linear linear(64, 32); | |
| LayerNorm norm(32); | |
| GELU gelu; | |
| Tensor input({2, 64}); | |
| for (size_t i = 0; i < input.numel(); ++i) input.as_fp32()[i] = 0.1f * i; | |
| std::cout << "Linear..." << std::endl; | |
| Tensor h1 = linear.forward(input); | |
| std::cout << "h1: [" << h1.shape_[0] << ", " << h1.shape_[1] << "]" << std::endl; | |
| std::cout << "LayerNorm..." << std::endl; | |
| Tensor h2 = norm.forward(h1); | |
| std::cout << "h2: [" << h2.shape_[0] << ", " << h2.shape_[1] << "]" << std::endl; | |
| std::cout << "GELU..." << std::endl; | |
| Tensor h3 = gelu.forward(h2); | |
| std::cout << "h3: [" << h3.shape_[0] << ", " << h3.shape_[1] << "]" << std::endl; | |
| std::cout << "Success!" << std::endl; | |
| return 0; | |
| } | |