//Environment.getInstance().setExecutionMode(EXECUTION_MODE.SEQ);
Environment.getInstance().setUseWeightsSharedMemory(true);
RBM rbm = NNFactory.rbm(3, 2, true);
Matrix cg1 = rbm.getMainConnections().getWeights();
cg1.set(0.2f, 0, 0);
cg1.set(0.4f, 0, 1);
cg1.set(-0.5f, 0, 2);
cg1.set(-0.3f, 1, 0);
cg1.set(0.1f, 1, 1);
cg1.set(0.2f, 1, 2);
Matrix cgb1 = rbm.getVisibleBiasConnections().getWeights();
cgb1.set(0f, 0, 0);
cgb1.set(0f, 1, 0);
cgb1.set(0f, 2, 0);
Matrix cgb2 = rbm.getHiddenBiasConnections().getWeights();
cgb2.set(-0.4f, 0, 0);
cgb2.set(0.2f, 1, 0);
AparapiCDTrainer t = TrainerFactory.cdSigmoidTrainer(rbm, new SimpleInputProvider(new float[][] { { 1, 0, 1 } }, null), null, null, null, 1f, 0f, 0f, 0f, 1, 1, 1, true);
t.train();
assertEquals(0.52276707, cgb1.get(0, 0), 0.00001);
assertEquals(- 0.54617375, cgb1.get(1, 0), 0.00001);
assertEquals(0.51522285, cgb1.get(2, 0), 0.00001);
assertEquals(-0.4 - 0.08680013, cgb2.get(0, 0), 0.00001);
assertEquals(0.2 - 0.02693379, cgb2.get(1, 0), 0.00001);
assertEquals(0.2 + 0.13203661, cg1.get(0, 0), 0.00001);
assertEquals(0.4 - 0.22863509, cg1.get(0, 1), 0.00001);
assertEquals(-0.5 + 0.12887852, cg1.get(0, 2), 0.00001);
assertEquals(-0.3 + 0.26158813, cg1.get(1, 0), 0.00001);