Skip to content
Snippets Groups Projects
Select Git revision
  • 0572b7d2371a0b256baaab7620a2ca3256c60e80
  • stable default protected
  • MA_Pape_2018
  • MA_2018_Lopatin
  • feature/mesh_viewer
  • feature/#468_access_isosurface_scalar
  • feature/#459_default_primitives
  • master protected
  • feature/#470_Create_a_color_lookup_table
  • feature/#473_resize_companion_window
  • feature/#462_do_not_use_arb_extensions
  • feature/#495_Provide_data_for_larger_isosurfaces
  • feature/#323_default_image
  • feature/#480_Create_a_smaller_test_mesh_for_combustion_demo
  • feature/#236_Get_Integration_tests_running_on_CI
  • feature/#447_Copy_standard_assets_to_build_folder
  • 447-copy-standard-assets-to-build-folder-and-remove-resource-path
  • feature/#445_mesh_render_settings_component
  • feature/#251_Make_sure_tests_cpp_is_compiled_once
  • feature/#455_Remove_navigation_and_improve_interaction_for_combustion_demo
  • feature/446_strange_txt_files
  • v18.06.0
  • v18.05.0
  • #251_bad
  • #251_good
  • v18.03.0
  • v18.02.0
  • v18.01.0
  • v17.12.0
  • v17.11.0
  • v17.10.0
  • v17.09.0
  • v17.07.0
33 results

mouse.hpp

Blame
  • user avatar
    jwendt authored
    #463
    0572b7d2
    History
    mouse.hpp 2.31 KiB
    #include "kissinference/kissinference.h"
    #include <stddef.h>
    #include <onnxruntime_c_api.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <assert.h>
    #include <stdlib.h>
    #include <string.h>
    #include <float.h>
    
    #define _USE_MATH_DEFINES
    #include <math.h>
    
    #define KISS_STRERROR_LEN 256
    
    struct kiss_priv
    {
    	const struct OrtApiBase *base_api;
    	const struct OrtApi *api;
    	OrtEnv *env;
    	OrtSession *session;
    
    	char err[KISS_STRERROR_LEN];
    };
    
    struct kiss_inference_req
    {
    	struct kiss_network *net;
    	const char **input_names;
    	const OrtValue **input_tensors;
    	float *input_array;
    	OrtValue *input;
    	const char **output_names;
    	OrtValue **output_tensors;
    	void *user_data;
    };
    
    void kiss_inference_req_free(struct kiss_inference_req *req)
    {
    	free(req->output_names);
    	if(req->input_array)
    		free(req->input_array);
    	free(req->input_tensors);
    	free(req->input_names);
    	free(req);
    }
    
    const struct kiss_version_fixed kiss_get_version(void)
    {
    	static const struct kiss_version_fixed version = {1, 1, 0};
    	return version;
    }
    
    static void kiss_free_str_array(char **array)
    {
    	char **ptr = array;
    	for(; *ptr; ptr++)
    		free(*ptr);
    	free(array);
    }
    
    void kiss_free_network(struct kiss_network *net)
    {
    	if(net) {
    		kiss_free_network_prealloc(net);
    		free(net);
    	}
    }
    
    void kiss_free_network_prealloc(struct kiss_network *net)