public void Reset() { if (!doReset_ || Index == 0L || Context.Type != ContextType.Gpu) { return; } Index = 0L; ShuffleIndices(); Context.Copy(IndicesTensor, Indices.AsTensor()); var stream = Context.ToGpuContext().Stream; var srcData = DataTensor == DataTensor1 ? DataTensor1.Buffer.Ptr : DataTensor2.Buffer.Ptr; var dstData = DataTensor == DataTensor1 ? DataTensor2.Buffer.Ptr : DataTensor1.Buffer.Ptr; var srcLabels = LabelsTensor == LabelsTensor1 ? LabelsTensor1.Buffer.Ptr : LabelsTensor2.Buffer.Ptr; var dstLabels = LabelsTensor == LabelsTensor1 ? LabelsTensor2.Buffer.Ptr : LabelsTensor1.Buffer.Ptr; var idx = IndicesTensor.Buffer.Ptr; DeviceFor.For(stream, 0, Rows, i => { var j = idx[i]; var srcDataOffset = srcData + i * cols_; var dstDataOffset = dstData + j * cols_; for (var k = 0; k < cols_; ++k) { dstDataOffset[k] = srcDataOffset[k]; } var srcLabelsOffset = srcLabels + i * outputs_; var dstLabelsOffset = dstLabels + j * outputs_; for (var k = 0; k < outputs_; ++k) { dstLabelsOffset[k] = srcLabelsOffset[k]; } }); DataTensor = DataTensor == DataTensor1 ? DataTensor2 : DataTensor1; LabelsTensor = LabelsTensor == LabelsTensor1 ? LabelsTensor2 : LabelsTensor1; }