the beginning of the implementation of Vulkan

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-30 01:35:29 +07:00
parent 1a05d3a6d9
commit 8abdea6b77
9 changed files with 320 additions and 21 deletions
+17 -1
View File
@@ -4,6 +4,12 @@
#include "typedef.hpp"
#include <vector>
#include <cmath>
#include "core.hpp"
#include <cstdlib>
#include <omp.h>
#include <vulkan/vulkan.hpp>
#include <iostream>
#include <fstream>
class NeuralNetwork {
private:
@@ -13,13 +19,23 @@ private:
std::vector<std::vector<double>> biases;
std::vector<std::vector<double>> outputs;
vk::Instance instance;
vk::PhysicalDevice physDev;
vk::Device device;
vk::Queue queue;
vk::CommandPool cmdPool;
uint32_t NeuralNetwork::findMemoryType(uint32_t typeFilter, vk::MemoryPropertyFlags properties);
double sigmoid(double x) { return 1.0 / (1.0 + exp(-x)); }
double sigmoidDeriv(double x) { return x * (1.0 - x); }
public:
NeuralNetwork(LayerStructure_t layers[], int count);
int cpu_count = 1;
NeuralNetwork(LayerStructure_t layers[], int count, bool useVulkan = false);
std::vector<double> feedForward(const std::vector<double>& input);
double train(const std::vector<double>& input, const std::vector<double>& target, double lr);
double trainVulkan();
};
#endif