void save_resume_network_data_pusher::push(const training_task_state& task_state)
	{
		unsigned int index = task_state.index_peeked;

		std::string data_filename = (boost::format("ann_trained_%|1$03d|_epoch_%|2$05d|.data") % index % task_state.get_current_epoch()).str();
		save_data_to_file(task_state.data, data_filename);

		std::string momentum_data_filename = (boost::format("momentum_%|1$03d|.data") % index).str();
		if (task_state.momentum_data)
			save_data_to_file(task_state.momentum_data, momentum_data_filename);
		else
			boost::filesystem::remove(momentum_data_filename);
	}
Example #2
0
/* save a piece of the file */
int save_piece(bt_args_t *bt_args, bt_piece_t *piece_t){
	int fd = create_file_descriptor(bt_args->save_file);
	size_t len = bt_args->bt_info->piece_length;
	void* ptr = malloc(len);
	memcpy(ptr, piece_t->piece, len);
	int save = save_data_to_file(ptr, len - piece_t->begin, piece_t->index*len+ piece_t->begin, fd, bt_args->save_file);
	return save;
}
Example #3
0
 void OnButtonTSaveClicked(WM_MESSAGE * pMsg,ESaveState save_state)
 {
	int i,j,k;
	LISTVIEW_Handle hObj;
	char buf[10];
	hObj = WM_GetDialogItem(pMsg->hWin,GUI_ID_LISTVIEW_RESULT_T);
	tget_record.act_record_lenth = LISTVIEW_GetNumRows(hObj);
	for(i=0;i<LISTVIEW_GetNumRows(hObj);i++)
		{
	LISTVIEW_GetItemText(hObj,0,i,tget_record.sig_record[i].order,4);

	LISTVIEW_GetItemText(hObj,1,i,tget_record.sig_record[i].V1,5);

	LISTVIEW_GetItemText(hObj,2,i,tget_record.sig_record[i].V2,5);

	LISTVIEW_GetItemText(hObj,3,i,tget_record.sig_record[i].result_r_e,5);
	
	LISTVIEW_GetItemText(hObj,4,i,tget_record.sig_record[i].state,8);

	LISTVIEW_GetItemText(hObj,5,i,tget_record.sig_record[i].time,6);

	LISTVIEW_GetItemText(hObj,6,i,tget_record.sig_record[i].dir,3);
		}

	if(save_state == RemberToSd)
	{
	tget_record.year = Tim.year;
	tget_record.month = Tim.month;
	tget_record.date = Tim.date;

	file_clear();

	save_data_to_file( "speedt.lt", (TCustormer*)&custormer,sizeof(TCustormer));
    save_data_to_file( "speedt.lt", (TTPars*)&ttpars,sizeof(TTPars));
	save_data_to_file( "speedt.lt", (TGetRecord*)&tget_record,sizeof(TGetRecord));
	}
 }
Example #4
0
void WriteTask::draw() {
    SkString dir(FLAGS_writePath[0]);
#if SK_BUILD_FOR_IOS
    if (dir.equals("@")) {
        dir.set(FLAGS_resourcePath[0]);
    }
#endif
    this->makeDirOrFail(dir);
    for (int i = 0; i < fSuffixes.count(); i++) {
        dir = SkOSPath::Join(dir.c_str(), fSuffixes[i].c_str());
        this->makeDirOrFail(dir);
    }

    SkString path = SkOSPath::Join(dir.c_str(), fGmName.c_str());
    path.append(fExtension);

    const bool ok = fData.get() ? save_data_to_file(fData,   path.c_str())
                                : PngAndRaw::Encode(fBitmap, path.c_str());
    if (!ok) {
        this->fail();
    }
}