cwenzi/neuroflow-cpp-bucket / tests /gemm_noavx_test.cpp
cwenzi's picture
download
raw
861 Bytes
#include <iostream>
#define HAS_AVX2 0 // 强制禁用 AVX2
#include "../include/neuroflow/tensor.hpp"
#include "../include/neuroflow/networks.hpp"
using namespace neuroflow;
int main() {
std::cout << "GEMM without AVX2 test..." << std::endl;
size_t d_model = 64;
Linear W_q(d_model, d_model, false);
Tensor input({1, d_model});
float* d = input.as_fp32();
for (size_t i = 0; i < input.numel(); ++i) d[i] = 0.1f * i;
Tensor x_flat = input.reshape({1, d_model});
std::cout << "x_flat shape: [" << x_flat.shape_[0] << ", " << x_flat.shape_[1] << "]" << std::endl;
std::cout << "Calling W_q.forward..." << std::endl;
Tensor q = W_q.forward(x_flat);
std::cout << "q shape: [" << q.shape_[0] << ", " << q.shape_[1] << "]" << std::endl;
std::cout << "Success!" << std::endl;
return 0;
}

Xet Storage Details

Size:
861 Bytes
·
Xet hash:
f0c85fe48c42d957c9d8eef9e066dbef0c41edc3c0c09d320fa4f032b37714bc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.