How can I set w. add instead of random generated I need to add my own weight input. | Sololearn: Learn to code for FREE!

0

How can I set w. add instead of random generated I need to add my own weight input.

void AArtificialNS::Initialize(int inputs, int outputs, TArray<int> hiddenLayers, float _initialLearningRate, float _learningRateDecay) {     // Set dimensions     nInputs = inputs;     nOutputs = outputs;     nHiddenLayers = hiddenLayers;     TArray<int> dimensions;     dimensions.Add(nInputs);     dimensions.Append(nHiddenLayers);     dimensions.Add(nOutputs);     // Initialize weights     weights.Empty();             for (int l = 1; l < dimensions.Num(); l++)     {         TArray<TArray<float>> layer; // The weights for the current layer         for (int j = 0; j < dimensions[l]; j++)         {             TArray<float> w; // The weights for the current unit                         for (int i = 0; i < dimensions[l - 1] + 1; i++) // +1: include the weight for the bias             {                                                 w.Add(FMath::RandRange(-1.0f, 1.0f));                             }             layer.Add(w);                     }  

3/30/2020 1:56:49 PM

Trefendor LiP

1 Answer

New Answer

+2

If I understand you right and you want to set the weights of this Neural Network then you have to add them as a Parameter and instead of setting weights to empty you have to set them on your Parameter... Here you can see my Neural Network too (not including weight setting to inputs) https://code.sololearn.com/clqW42eJH17t/?ref=app