CoolFace
Modelpublic

cwenzi/neuroflow-cpp

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
1likes
combo_test.cpp32 linesDownload Raw Back to tests
1#include <iostream>2#include "../include/neuroflow/tensor.hpp"3#include "../include/neuroflow/networks.hpp"4 5using namespace neuroflow;6 7int main() {8    std::cout << "Combo test..." << std::endl;9    10    Linear linear(64, 32);11    LayerNorm norm(32);12    GELU gelu;13    14    Tensor input({2, 64});15    for (size_t i = 0; i < input.numel(); ++i) input.as_fp32()[i] = 0.1f * i;16    17    std::cout << "Linear..." << std::endl;18    Tensor h1 = linear.forward(input);19    std::cout << "h1: [" << h1.shape_[0] << ", " << h1.shape_[1] << "]" << std::endl;20    21    std::cout << "LayerNorm..." << std::endl;22    Tensor h2 = norm.forward(h1);23    std::cout << "h2: [" << h2.shape_[0] << ", " << h2.shape_[1] << "]" << std::endl;24    25    std::cout << "GELU..." << std::endl;26    Tensor h3 = gelu.forward(h2);27    std::cout << "h3: [" << h3.shape_[0] << ", " << h3.shape_[1] << "]" << std::endl;28    29    std::cout << "Success!" << std::endl;30    return 0;31}32