Skip to content

Add seed support to NeuralNetwork for reproducible weight initialisation#2

Draft
Copilot wants to merge 3 commits intocopilot/complete-tree-renderer-implementationfrom
copilot/add-seeds-to-neural-network
Draft

Add seed support to NeuralNetwork for reproducible weight initialisation#2
Copilot wants to merge 3 commits intocopilot/complete-tree-renderer-implementationfrom
copilot/add-seeds-to-neural-network

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 2, 2026

Introduces NRE::NeuralNetwork — a seeded feedforward neural network enabling reproducible procedural generation across runs.

New files

  • engine/neural/NeuralNetwork.h/.cpp — Fully-connected network with He-initialised weights via a seeded std::mt19937. Key API:
    • NeuralNetwork(uint32_t seed = 0) — seed 0 falls back to std::random_device
    • SetSeed(uint32_t) / GetSeed() — change seed and reinitialise all layer weights in-place
    • AddLayer(int in, int out) / Forward(vector<float>) — layer construction and ReLU forward pass
  • examples/neural_demo/main.cpp — Demonstrates same-seed reproducibility and seed isolation
  • CMakeLists.txt — Builds nre_neural static lib and neural_demo executable
  • .gitignore — Excludes CMake build dirs and compiled artefacts

Usage

NRE::NeuralNetwork nn(42);
nn.AddLayer(4, 8);
nn.AddLayer(8, 4);
auto out1 = nn.Forward({0.5f, 0.3f, 0.8f, 0.1f});

nn.SetSeed(42);          // reinitialises weights — out2 == out1
auto out2 = nn.Forward({0.5f, 0.3f, 0.8f, 0.1f});
Original prompt

Reference: af11a6e add seeds to neural network


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@Cleanskiier27 Cleanskiier27 changed the base branch from copilot/update-reference-commit to copilot/complete-tree-renderer-implementation March 2, 2026 17:13
Copilot AI and others added 2 commits March 2, 2026 17:17
Co-authored-by: Cleanskiier27 <220620570+Cleanskiier27@users.noreply.github.com>
Co-authored-by: Cleanskiier27 <220620570+Cleanskiier27@users.noreply.github.com>
Copilot AI changed the title [WIP] Add seeds to neural network Add seed support to NeuralNetwork for reproducible weight initialisation Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants