@Test
public void testApplyWeightChanges() {           

    RandomGenerator.getDefault().initSeed(123);
    
    FullyConnectedLayer prevLayer = new FullyConnectedLayer(5);
    FullyConnectedLayer instance = new FullyConnectedLayer(10);
    instance.setPrevLayer(prevLayer);
    instance.init();
    
    Tensor weights = new Tensor(5, 10);
    WeightsInit.initSeed(123);
        
    Tensor biases = new Tensor(10); //  ? zasto ovde isod opet randomize kad gore imam uniform
    WeightsInit.uniform(weights.getValues(), 5); //  0.19961303, -0.23501621, 0.43907326, -0.17747784, -0.22066136, 0.06630343, 0.097314, -0.21566293, 0.273578, 0.10945064, 0.33577937, 0.044093937, 0.19323963, -0.3021235, -0.38288906, 0.16261822, 0.26498383, -0.207817, 0.070406556, -0.23022851, 0.36503863, 0.091478825, -0.31402034, -0.25345784, 0.42504954, -0.037393004, -0.38854277, -0.36758634, -0.38503492, -0.33786723, -0.36604232, -0.14479709, -0.06755906, 0.38639867, 0.3348655, 0.15910655, 0.06717491, -0.4455302, -0.09257606, -1.219213E-4, -0.21616945, 0.43006968, -0.31055218, 0.2699433, -0.214278, 0.25471163, -0.03427276, -0.43431506, -0.054469943, -0.23747501
    WeightsInit.randomize(biases.getValues()); // "[-0.2885946, -0.023120344, 0.114212096, -0.35789996, -0.46654212, -0.060512245, 0.18889612, -0.38798183, 0.18411279, 0.34890008]"
    instance.setWeights(weights);
    instance.setBiases(biases.getValues());        
    instance.deltaBiases = new float[10];
    instance.deltaWeights = new Tensor(5, 10);
    WeightsInit.randomize(instance.deltaWeights.getValues()); // "[-0.4247411, -0.3433265, 0.44680566, -0.09958029, -0.063123405, 0.43927592, 0.19381553, -0.083636045, 0.17639846, 0.32855767, 0.12878358, 0.1629799, 0.07470411, -0.46918643, -0.11202836, 0.2753712, -0.31087178, -0.08334535, -0.47327846, -0.3146028, -0.46844327, 0.112583816, 0.33040798, -0.10281438, 0.24008608, 0.32558167, 0.44147235, 0.32505035, 0.32593954, -0.17731398, 0.014207661, 0.28614485, 0.09407586, 0.123054445, -0.27172554, -0.14735949, -0.19683117, -0.33119786, 0.19504476, 0.23377019, -0.07173675, -0.06975782, 0.46547735, -0.06449604, 0.22543085, -0.25612664, -0.16484225, -0.21565866, 0.45828927, -0.13396758]"
    WeightsInit.randomize(instance.deltaBiases); // "[-0.014675736, -0.20824462, -0.2544266, -0.29433697, 0.19522274, -0.042135, -0.2805665, 0.44587213, -0.38881636, 0.2882418]"
            
    instance.applyWeightChanges();        
    Tensor expectedWeights = new Tensor(-0.22512805f, -0.57834274f, 0.8858789f, -0.27705812f, -0.28378475f, 0.50557935f, 0.29112953f, -0.29929897f, 0.44997644f, 0.4380083f, 0.46456295f, 0.20707384f, 0.26794374f, -0.7713099f, -0.49491742f, 0.4379894f, -0.045887947f, -0.29116237f, -0.4028719f, -0.5448313f, -0.10340464f, 0.20406264f, 0.016387641f, -0.35627222f, 0.6651356f, 0.28818867f, 0.05292958f, -0.04253599f, -0.059095383f, -0.5151812f, -0.35183465f, 0.14134777f, 0.026516795f, 0.5094531f, 0.063139975f, 0.011747062f, -0.12965626f, -0.77672803f, 0.1024687f, 0.23364827f, -0.2879062f, 0.36031187f, 0.15492517f, 0.20544726f, 0.011152849f, -0.0014150143f, -0.19911501f, -0.64997375f, 0.40381932f, -0.3714426f);
    Tensor expectedBiases = new Tensor(10);
    expectedBiases.setValues(-0.30327034f, -0.23136496f, -0.1402145f,  -0.65223693f, -0.27131938f, -0.10264724f,  -0.09167038f,  0.0578903f,  -0.20470357f,  0.63714188f); // 0.4507922, 0.35359812, 0.25770348, -0.39445835, 0.7433155, 0.7244545, -0.07723093, 0.26560563, -0.23044652, 0.2704906
            
    assertArrayEquals(weights.getValues(), expectedWeights.getValues(), 1e-7f);
    assertArrayEquals(biases.getValues(), expectedBiases.getValues(), 1e-7f);                        
}