<commit_before>#include "DestinData.h"

#include <fstream>
#include <map>
#include <math.h>
#include <iostream>

using namespace std;

DestinData::DestinData(void)
{
	mLastImageIndex=-1;
	mRows=0;
	mCols=0;
	// TODO: This is also not dynamic works for numbers of 32x32 images
    for(int r=0;r<40;r++)
    {
        for(int c=0;c<40;c++)
        {
            mImageWithOffset[r][c]=0;
        }
    }
	cout << "Destin data created" << endl;
}

DestinData::~DestinData(void)
{
	cudaFree(dImage);
	delete [] mImage;
	cout << "Destin data deleted" << endl;
}

void DestinData::LoadFile(const char* sFileName)
{
	mImagePointer.clear();
	mLabels.clear();
	mUniqueLabels.clear();
	mMapLabelToIndexVector.clear();

	std::ifstream stmIn;
	stmIn.open(sFileName,ios::in | ios::binary );

	int iSignals;
	stmIn.read( (char*)&iSignals,sizeof(iSignals));
	stmIn.read( (char*)&mRows, sizeof(mRows) );
	stmIn.read( (char*)&mCols, sizeof(mCols) );
	// Create the array for pinned memory for CUDA
    int size = mRows*mCols;
    // Host side memory
    mImage = new float[size];
    // Device side memory
    cudaMalloc( (void**)&dImage, size*sizeof(float) );

	int iLabel;
	unsigned char* cImageData;
	float** fImageDataByRow;
	float *fRow;

	map<int, vector<int> >::iterator it;

	for(int i=0; i<iSignals; i++)
	{
		stmIn.read( (char*)&iLabel, sizeof(iLabel) );
		mLabels.push_back(iLabel);
		it = mMapLabelToIndexVector.find(iLabel);<commit_msg>check if it finds the training data<commit_after>#include "DestinData.h"

#include <fstream>
#include <map>
#include <math.h>
#include <iostream>

using namespace std;

DestinData::DestinData(void)
{
	mLastImageIndex=-1;
	mRows=0;
	mCols=0;
	// TODO: This is also not dynamic works for numbers of 32x32 images
    for(int r=0;r<40;r++)
    {
        for(int c=0;c<40;c++)
        {
            mImageWithOffset[r][c]=0;
        }
    }
	cout << "Destin data created" << endl;
}

DestinData::~DestinData(void)
{
	cudaFree(dImage);
	delete [] mImage;
	cout << "Destin data deleted" << endl;
}

void DestinData::LoadFile(const char* sFileName)
{
	mImagePointer.clear();
	mLabels.clear();
	mUniqueLabels.clear();
	mMapLabelToIndexVector.clear();

	std::ifstream stmIn;
	stmIn.open(sFileName,ios::in | ios::binary );
	if(stmIn.is_open()){
		cout << "Found input file." << endl;
	}else{
		cout << "Did not find input file." << endl;
		return;
	}

	int iSignals;
	stmIn.read( (char*)&iSignals,sizeof(iSignals));
	stmIn.read( (char*)&mRows, sizeof(mRows) );
	stmIn.read( (char*)&mCols, sizeof(mCols) );
	// Create the array for pinned memory for CUDA
    int size = mRows*mCols;
    // Host side memory
    mImage = new float[size];
    // Device side memory
    cudaMalloc( (void**)&dImage, size*sizeof(float) );

	int iLabel;
	unsigned char* cImageData;
	float** fImageDataByRow;
	float *fRow;

	map<int, vector<int> >::iterator it;

	for(int i=0; i<iSignals; i++)
	{
		stmIn.read( (char*)&iLabel, sizeof(iLabel) );
		mLabels.push_back(iLabel);
		it = mMapLabelToIndexVector.find(iLabel);
{'fraction_non_alphanumeric': 0.16058394160583941, 'fraction_numerical': 0.009953550099535502, 'mean_word_length': 4.118845500848896, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '359308', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1183, 'n_words': 252}