活动介绍

pointer-to-specialstring

时间: 2023-10-09 15:05:21 浏览: 98
Pointer-to-specialstring is a programming concept that involves using a pointer to reference a special string in memory. In C and C++ programming languages, a string is represented as an array of characters terminated by a null character ('\0'). When working with strings, a pointer-to-specialstring can be used to reference a specific substring within a larger string. This is accomplished by creating a pointer that points to the memory location of the first character in the substring. The pointer can then be used to manipulate the substring or pass it as an argument to a function. For example, consider the following code snippet: ``` char str[] = "Hello, world!"; char* substr = &str[7]; // points to the substring "world!" printf("%s", substr); // prints "world!" ``` In this example, the pointer `substr` is created to reference the memory location of the first character in the substring "world!". The pointer is then used to print the substring to the console.
阅读全文

相关推荐

基于stm32cubemx,stm32f103c8t6,四针脚的oled,帮我写雨滴传感器的驱动文件,实现测量雨量大小并在屏幕上,雨量处理数据和显示数据在main.c中写,其中oled.c:#include "oled.h" #include "oledfont.h" //几个变量声明 uint8_t **Hzk; //初始化命令 uint8_t CMD_Data[]={ 0xAE, 0x00, 0x10, 0x40, 0xB0, 0x81, 0xFF, 0xA1, 0xA6, 0xA8, 0x3F, 0xC8, 0xD3, 0x00, 0xD5, 0x80, 0xD8, 0x05, 0xD9, 0xF1, 0xDA, 0x12, 0xD8, 0x30, 0x8D, 0x14, 0xAF}; void WriteCmd() { uint8_t i = 0; for(i=0; i<27; i++){ HAL_I2C_Mem_Write(&hi2c1 ,0x78,0x00,I2C_MEMADD_SIZE_8BIT,CMD_Data+i,1,0x100); } } //向设备写控制命令 void OLED_WR_CMD(uint8_t cmd) { HAL_I2C_Mem_Write(&hi2c1 ,0x78,0x00,I2C_MEMADD_SIZE_8BIT,&cmd,1,0x100); } //向设备写数据 void OLED_WR_DATA(uint8_t data) { HAL_I2C_Mem_Write(&hi2c1 ,0x78,0x40,I2C_MEMADD_SIZE_8BIT,&data,1,0x100); } //初始化oled屏幕 void OLED_Init(void) { HAL_Delay(200); WriteCmd(); } //清屏size12 size16要清两行,其他函数有类似情况 void OLED_Clear() { uint8_t i,n; for(i=0;i<8;i++) { OLED_WR_CMD(0xb0+i); OLED_WR_CMD (0x00); OLED_WR_CMD (0x10); for(n=0;n<128;n++) OLED_WR_DATA(0); } } //清行 void OLED_Clearrow(uint8_t i) { uint8_t n; OLED_WR_CMD(0xb0+i); OLED_WR_CMD (0x00); OLED_WR_CMD (0x10); for(n=0;n<128;n++) OLED_WR_DATA(0); } //开启OLED显示 void OLED_Display_On(void) { OLED_WR_CMD(0X8D); //SET DCDC命令 OLED_WR_CMD(0X14); //DCDC ON OLED_WR_CMD(0XAF); //DISPLAY ON } //关闭OLED显示 void OLED_Display_Off(void) { OLED_WR_CMD(0X8D); //SET DCDC命令 OLED_WR_CMD(0X10); //DCDC OFF OLED_WR_CMD(0XAE); //DISPLAY OFF } void OLED_Set_Pos(uint8_t x, uint8_t y) { OLED_WR_CMD(0xb0+y); OLED_WR_CMD(((x&0xf0)>>4)|0x10); OLED_WR_CMD(x&0x0f); } void OLED_On(void) { uint8_t i,n; for(i=0;i<8;i++) { OLED_WR_CMD(0xb0+i); //设置页地址(0~7) OLED_WR_CMD(0x00); //设置显示位置—列低地址 OLED_WR_CMD(0x10); //设置显示位置—列高地址 for(n=0;n<128;n++) OLED_WR_DATA(1); } //更新显示 } unsigned int oled_pow(uint8_t m,uint8_t n) { unsigned int result=1; while(n--)result*=m; return result; } //在指定位置显示一个字符,包括部分字符 //x:0~127 //y:0~63 //mode:0,反白显示;1,正常显示 //size:选择字体 16/12 void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr,uint8_t Char_Size) { unsigned char c=0,i=0; c=chr-' ';//得到偏移后的值 if(x>128-1){x=0;y=y+2;} if(Char_Size ==16) { OLED_Set_Pos(x,y); for(i=0;i<8;i++) OLED_WR_DATA(F8x16[c*16+i]); OLED_Set_Pos(x,y+1); for(i=0;i<8;i++) OLED_WR_DATA(F8x16[c*16+i+8]); } else { OLED_Set_Pos(x,y); for(i=0;i<6;i++) OLED_WR_DATA(F6x8[c][i]); } } //显示2个数字 //x,y :起点坐标 //len :数字的位数 //size:字体大小 //mode:模式 0,填充模式;1,叠加模式 //num:数值(0~4294967295); void OLED_ShowNum(uint8_t x,uint8_t y,unsigned int num,uint8_t len,uint8_t size2) { uint8_t t,temp; uint8_t enshow=0; for(t=0;t<len;t++) { temp=(num/oled_pow(10,len-t-1))%10; if(enshow==0&&t<(len-1)) { if(temp==0) { OLED_ShowChar(x+(size2/2)*t,y,' ',size2); continue; }else enshow=1; } OLED_ShowChar(x+(size2/2)*t,y,temp+'0',size2); } } //显示一个字符号串 void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size) { unsigned char j=0; while (chr[j]!='\0') { OLED_ShowChar(x,y,chr[j],Char_Size); x+=8; if(x>120){x=0;y+=2;} j++; } } //显示汉字 //hzk 用取模软件得出的数组 void OLED_ShowCHinese(uint8_t x,uint8_t y,uint8_t no) { uint8_t t,adder=0; OLED_Set_Pos(x,y); for(t=0;t<16;t++) { OLED_WR_DATA(Hzk[2*no][t]); adder+=1; } OLED_Set_Pos(x,y+1); for(t=0;t<16;t++) { OLED_WR_DATA(Hzk[2*no+1][t]); adder+=1; } } oled.h:#ifndef __OLED_H_ #define __OLED_H_ #include "stdint.h" #include "i2c.h" void WriteCmd(void); //向设备写控制命令 void OLED_WR_CMD(uint8_t cmd); //向设备写数据 void OLED_WR_DATA(uint8_t data); //初始化oled屏幕 void OLED_Init(void); //清屏 void OLED_Clear(void); //清行 void OLED_Clearrow(uint8_t i); //开启OLED显示 void OLED_Display_On(void); //关闭OLED显示 void OLED_Display_Off(void); //设置光标 void OLED_Set_Pos(uint8_t x, uint8_t y); void OLED_On(void); //在指定位置显示一个字符,包括部分字符 //x:0~127 //y:0~63 //mode:0,反白显示;1,正常显示 //size:选择字体 16/12 void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr,uint8_t Char_Size); //显示2个数字 //x,y :起点坐标 //len :数字的位数 //size:字体大小 //mode:模式 0,填充模式;1,叠加模式 //num:数值(0~4294967295); void OLED_ShowNum(uint8_t x,uint8_t y,unsigned int num,uint8_t len,uint8_t size2); //显示一个字符号串 void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size); //显示汉字 //hzk 用取模软件得出的数组 void OLED_ShowCHinese(uint8_t x,uint8_t y,uint8_t no); #endif main.c:/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** ** This notice applies to any and all portions of this file * that are not between comment pairs USER CODE BEGIN and * USER CODE END. Other portions of this file, whether * inserted by the user or by software development tools * are owned by their respective copyright owners. * * COPYRIGHT(c) 2019 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "i2c.h" #include "gpio.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "oled.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN PV */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_I2C1_Init(); /* USER CODE BEGIN 2 */ uint8_t A[]="hdilisa !!"; //初始化oled屏幕 OLED_Init(); //开启OLED显示 OLED_Display_On(); //清屏 OLED_Clear(); // OLED_ShowNum(10,10,10,8,8); // OLED_ShowChar(0, 0,'C',16); OLED_ShowString(0,0,A,sizeof(A)); // //清行 // OLED_Clearrow(2); // OLED_Clearrow(3); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { Error_Handler(); } } /* USER CODE BEGIN 4 */ /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

/** * Copyright (C) Bosch Sensortec GmbH. All Rights Reserved. Confidential. * * Disclaimer * * Common: * Bosch Sensortec products are developed for the consumer goods industry. They may only be used * within the parameters of the respective valid product data sheet. Bosch Sensortec products are * provided with the express understanding that there is no warranty of fitness for a particular purpose. * They are not fit for use in life-sustaining, safety or security sensitive systems or any system or device * that may lead to bodily harm or property damage if the system or device malfunctions. In addition, * Bosch Sensortec products are not fit for use in products which interact with motor vehicle systems. * The resale and/or use of products are at the purchaser's own risk and his own responsibility. The * examination of fitness for the intended use is the sole responsibility of the Purchaser. * * The purchaser shall indemnify Bosch Sensortec from all third party claims, including any claims for * incidental, or consequential damages, arising from any product use not covered by the parameters of * the respective valid product data sheet or not approved by Bosch Sensortec and reimburse Bosch * Sensortec for all costs in connection with such claims. * * The purchaser must monitor the market for the purchased products, particularly with regard to * product safety and inform Bosch Sensortec without delay of all security relevant incidents. * * Engineering Samples are marked with an asterisk (*) or (e). Samples may vary from the valid * technical specifications of the product series. They are therefore not intended or fit for resale to third * parties or for use in end products. Their sole purpose is internal client testing. The testing of an * engineering sample may in no way replace the testing of a product series. Bosch Sensortec * assumes no liability for the use of engineering samples. By accepting the engineering samples, the * Purchaser agrees to indemnify Bosch Sensortec from all claims arising from the use of engineering * samples. * * Special: * This software module (hereinafter called "Software") and any information on application-sheets * (hereinafter called "Information") is provided free of charge for the sole purpose to support your * application work. The Software and Information is subject to the following terms and conditions: * * The Software is specifically designed for the exclusive use for Bosch Sensortec products by * personnel who have special experience and training. Do not use this Software if you do not have the * proper experience or training. * * This Software package is provided as is and without any expressed or implied warranties, * including without limitation, the implied warranties of merchantability and fitness for a particular * purpose. * * Bosch Sensortec and their representatives and agents deny any liability for the functional impairment * of this Software in terms of fitness, performance and safety. Bosch Sensortec and their * representatives and agents shall not be liable for any direct or indirect damages or injury, except as * otherwise stipulated in mandatory applicable law. * * The Information provided is believed to be accurate and reliable. Bosch Sensortec assumes no * responsibility for the consequences of use of such Information nor for any infringement of patents or * other rights of third parties which may result from its use. No license is granted by implication or * otherwise under any patent or patent rights of Bosch. Specifications mentioned in the Information are * subject to change without notice. * * It is not allowed to deliver the source code of the Software to any third party without permission of * Bosch Sensortec. * */ /*! * @file bsec_iot_example.c * * @brief * Example for using of BSEC library in a fixed configuration with the BME68x sensor. * This works by running an endless loop in the bsec_iot_loop() function. */ /*! * @addtogroup bsec_examples BSEC Examples * @brief BSEC usage examples * @{*/ /**********************************************************************************************************************/ /* header files */ /**********************************************************************************************************************/ #include "bsec_integration.h" /**********************************************************************************************************************/ /* functions */ /**********************************************************************************************************************/ /*! * @brief Write operation in either Wire or SPI * * param[in] reg_addr register address * param[in] reg_data_ptr pointer to the data to be written * param[in] data_len number of bytes to be written * param[in] intf_ptr interface pointer * * @return result of the bus communication function */ int8_t bus_write(uint8_t reg_addr, const uint8_t *reg_data_ptr, uint32_t data_len, void *intf_ptr) { // ... // Please insert system specific function to write to the bus where BME68x is connected // ... return 0; } /*! * @brief Read operation in either Wire or SPI * * param[in] reg_addr register address * param[out] reg_data_ptr pointer to the memory to be used to store the read data * param[in] data_len number of bytes to be read * param[in] intf_ptr interface pointer * * @return result of the bus communication function */ int8_t bus_read(uint8_t reg_addr, uint8_t *reg_data_ptr, uint32_t data_len, void *intf_ptr) { // ... // Please insert system specific function to read from bus where BME68x is connected // ... return 0; } /*! * @brief System specific implementation of sleep function * * @param[in] t_us Time in microseconds * @param[in] intf_ptr Pointer to the interface descriptor * * @return none */ void sleep_n(uint32_t t_us, void *intf_ptr) { // ... // Please insert system specific function sleep or delay for t_ms milliseconds // ... } /*! * @brief Capture the system time in microseconds * * @return system_current_time current system timestamp in microseconds */ int64_t get_timestamp_us() { int64_t system_current_time = 0; // ... // Please insert system specific function to retrieve a timestamp (in microseconds) // ... return system_current_time; } /*! * @brief Handling of the ready outputs * * @param[in] outputs output_t structure * @param[in] bsec_status value returned by the bsec_do_steps() call * * @return none */ void output_ready(output_t *outputs, bsec_library_return_t bsec_status) { // ... // Please insert system specific code to further process or display the BSEC outputs // ... } /*! * @brief Load previous library state from non-volatile memory * * @param[in,out] state_buffer buffer to hold the loaded state string * @param[in] n_buffer size of the allocated state buffer * * @return number of bytes copied to state_buffer */ uint32_t state_load(uint8_t *state_buffer, uint32_t n_buffer) { // ... // Load a previous library state from non-volatile memory, if available. // // Return zero if loading was unsuccessful or no state was available, // otherwise return length of loaded state string. // ... return 0; } /*! * @brief Save library state to non-volatile memory * * @param[in] state_buffer buffer holding the state to be stored * @param[in] length length of the state string to be stored * * @return none */ void state_save(const uint8_t *state_buffer, uint32_t length) { // ... // Save the string some form of non-volatile memory, if possible. // ... } /*! * @brief Load library config from non-volatile memory * * @param[in,out] config_buffer buffer to hold the loaded state string * @param[in] n_buffer size of the allocated state buffer * * @return number of bytes copied to config_buffer */ uint32_t config_load(uint8_t *config_buffer, uint32_t n_buffer) { // ... // Load a library config from non-volatile memory, if available. // // Return zero if loading was unsuccessful or no config was available, // otherwise return length of loaded config string. // ... return 0; } /*! * @brief Main function which configures BSEC library and then reads and processes the data from sensor based * on timer ticks * * @return result of the processing */ int main() { return_values_init ret; struct bme68x_dev bme_dev; memset(&bme_dev,0,sizeof(bme_dev)); /* Call to the function which initializes the BSEC library * Switch on low-power mode and provide no temperature offset */ ret = bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, bus_write, bus_read, sleep_n, state_load, config_load, bme_dev, 0); if (ret.bme68x_status) { /* Could not intialize BME68x */ return (int)ret.bme68x_status; } else if (ret.bsec_status) { /* Could not intialize BSEC library */ return (int)ret.bsec_status; } /* Call to endless loop function which reads and processes data based on sensor settings */ /* State is saved every 10.000 samples, which means every 10.000 * 3 secs = 500 minutes */ bsec_iot_loop(sleep_n, get_timestamp_us, output_ready, state_save, 10000); return 0; } /*! @}*/ 根据这个例程使用stm32hal库用keil开发

/** * @struct RKLLMExtendParam * @brief The extend parameters for configuring an LLM instance. */ typedef struct { int32_t base_domain_id; /**< base_domain_id */ uint8_t reserved[112]; /**< reserved */ } RKLLMExtendParam; /** * @struct RKLLMParam * @brief Defines the parameters for configuring an LLM instance. */ typedef struct { const char* model_path; /**< Path to the model file. */ int32_t max_context_len; /**< Maximum number of tokens in the context window. */ int32_t max_new_tokens; /**< Maximum number of new tokens to generate. */ int32_t top_k; /**< Top-K sampling parameter for token generation. */ float top_p; /**< Top-P (nucleus) sampling parameter. */ float temperature; /**< Sampling temperature, affecting the randomness of token selection. */ float repeat_penalty; /**< Penalty for repeating tokens in generation. */ float frequency_penalty; /**< Penalizes frequent tokens during generation. */ float presence_penalty; /**< Penalizes tokens based on their presence in the input. */ int32_t mirostat; /**< Mirostat sampling strategy flag (0 to disable). */ float mirostat_tau; /**< Tau parameter for Mirostat sampling. */ float mirostat_eta; /**< Eta parameter for Mirostat sampling. */ bool skip_special_token; /**< Whether to skip special tokens during generation. */ bool is_async; /**< Whether to run inference asynchronously. */ const char* img_start; /**< Starting position of an image in multimodal input. */ const char* img_end; /**< Ending position of an image in multimodal input. */ const char* img_content; /**< Pointer to the image content. */ RKLLMExtendParam extend_param; /**< Extend parameters. */ } RKLLMParam; /** * @struct RKLLMLoraAdapter * @brief Defines parameters for a Lora adapter used in model fine-tuning. */ typedef struct { const char* lora_adapter_path; /**< Path to the Lora adapter file. */ const char* lora_adapter_name; /**< Name of the Lora adapter. */ float scale; /**< Scaling factor for applying the Lora adapter. */ } RKLLMLoraAdapter; /** * @struct RKLLMEmbedInput * @brief Represents an embedding input to the LLM. */ typedef struct { float* embed; /**< Pointer to the embedding vector (of size n_tokens * n_embed). */ size_t n_tokens; /**< Number of tokens represented in the embedding. */ } RKLLMEmbedInput;转换为node代码

/** * @struct RKLLMParam * @brief Defines the parameters for configuring an LLM instance. */ typedef struct { const char* model_path; /**< Path to the model file. */ int32_t max_context_len; /**< Maximum number of tokens in the context window. */ int32_t max_new_tokens; /**< Maximum number of new tokens to generate. */ int32_t top_k; /**< Top-K sampling parameter for token generation. */ float top_p; /**< Top-P (nucleus) sampling parameter. */ float temperature; /**< Sampling temperature, affecting the randomness of token selection. */ float repeat_penalty; /**< Penalty for repeating tokens in generation. */ float frequency_penalty; /**< Penalizes frequent tokens during generation. */ float presence_penalty; /**< Penalizes tokens based on their presence in the input. */ int32_t mirostat; /**< Mirostat sampling strategy flag (0 to disable). */ float mirostat_tau; /**< Tau parameter for Mirostat sampling. */ float mirostat_eta; /**< Eta parameter for Mirostat sampling. */ bool skip_special_token; /**< Whether to skip special tokens during generation. */ bool is_async; /**< Whether to run inference asynchronously. */ const char* img_start; /**< Starting position of an image in multimodal input. */ const char* img_end; /**< Ending position of an image in multimodal input. */ const char* img_content; /**< Pointer to the image content. */ RKLLMExtendParam extend_param; /**< Extend parameters. */ } RKLLMParam; /** * @brief Creates a default RKLLMParam structure with preset values. * @return A default RKLLMParam structure. */ RKLLMParam rkllm_createDefaultParam();转换为node ffi代码

/******************************************************************************* *BSD 3-Clause License * *Copyright (c) 2016-2023, Mech-Mind Robotics *All rights reserved. * *Redistribution and use in source and binary forms, with or without *modification, are permitted provided that the following conditions are met: * *1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * *2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * *3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * *THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" *AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR *SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, *OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ #pragma once #include <memory> #include <string> #include "common/StatusCode.h" namespace mmind::dl { /** * @brief Defines the Image. */ struct MMIND_DL_SDK_EXPORT MMindImage { /** * @brief Creates an image from its path. * @param [in] imagePath Image storage path. * @return See @ref StatusCode for details. */ StatusCode createFromPath(const std::string& imagePath); /** * @brief Visualizes an image. * @param [in] winName The window name for visualizing an image. * @return See @ref StatusCode for details. * @note The size of the image display window equals to that of the image. */ StatusCode show(const std::string& winName); /** * @brief Saves the image to a specified directory. * @param [in] savePath The path to save the image. * @return See @ref StatusCode for details. */ StatusCode save(const std::string& savePath); /** * @brief Releases the memory of the image. */ ~MMindImage(); int width = 0; ///< The width of the image. int height = 0; ///< The height of the image. int channel = 0; ///< The number of channels in the image. int depth = 0; ///< The depth of the image. std::shared_ptr<unsigned char> data = nullptr; ///< The pointer of the image data. }; } // namespace mmind::dl 这里面的析构函数还是虚函数,不需要绑定吗? ~MMindImage();

最新推荐

recommend-type

Google C++ Style Guide(Google C++编程规范)高清PDF

Sometimes it makes sense to have pointer (or better, scoped_ptr) members instead of object members. However, this complicates code readability and imposes a performance penalty, so avoid doing this ...
recommend-type

slf4j-simple-1.8.0-beta2.jar中文文档.zip

1、压缩文件中包含: 中文文档、jar包下载地址、Maven依赖、Gradle依赖、源代码下载地址。 2、使用方法: 解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。 3、特殊说明: (1)本文档为人性化翻译,精心制作,请放心使用; (2)只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; (3)不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 4、温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件。 5、本文件关键字: jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册。
recommend-type

基于gin搭建的go框架.zip

基于gin搭建的go框架.zip
recommend-type

lombok-1.12.2.jar中文文档.zip

1、压缩文件中包含: 中文文档、jar包下载地址、Maven依赖、Gradle依赖、源代码下载地址。 2、使用方法: 解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。 3、特殊说明: (1)本文档为人性化翻译,精心制作,请放心使用; (2)只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; (3)不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 4、温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件。 5、本文件关键字: jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册。
recommend-type

qhexedit2-doc-0.8.9-11.el8.tar.gz

# 适用操作系统:Centos8 #Step1、解压 tar -zxvf xxx.el8.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm
recommend-type

11款开源中文分词引擎性能对比分析

在当今信息时代,中文分词作为自然语言处理中的一个基础且关键环节,对于中文信息检索、机器翻译、语音识别等领域的应用至关重要。分词准确度直接影响了后续的语言分析与理解。由于中文不同于英文等西方语言,中文书写是以连续的字符序列来表达,不存在明显的单词间分隔符,如空格。因此,在处理中文文本之前,必须先进行分词处理,即确定字符串中的词边界。 开放中文分词引擎是指那些提供免费使用的中文文本分词服务的软件。在开放源代码或提供分词API的分词系统上,开发者和研究者可以测试和评估它们在不同场景和数据集上的性能,以便选择最适合特定需求的分词引擎。 本文件标题为“11款开放中文分词引擎测试数据”,意味着内容涉及11个不同的中文分词引擎。这些引擎可能覆盖了从传统基于规则的方法到现代基于机器学习和深度学习的方法,也可能包括了针对特定领域(如医疗、法律等)优化的分词引擎。以下将对这些分词引擎的重要知识点进行详细阐述。 1. 基于规则的分词引擎:这类引擎依据汉语语法规则和词典进行分词。词典会包含大量的词汇、成语、习惯用语等,而规则会涉及汉语构词方式、歧义消解等。优点在于分词速度快,对常见文本的处理效果好;缺点是规则和词典需要不断更新,对新词和专业术语的支持不足。 2. 基于统计的分词引擎:通过大规模的语料库进行训练,统计各个词语的出现概率,从而实现分词。这种方法能够自动学习和适应新词和新用法,但需要的计算资源较大。 3. 基于深度学习的分词引擎:利用深度神经网络模型,如循环神经网络(RNN)和卷积神经网络(CNN),来识别和分词。近年来,基于Transformer架构的预训练模型,如BERT和GPT,也开始被应用到中文分词任务中,具有更好的语境理解和处理能力。 4. 评估指标:通常使用准确率(precision)、召回率(recall)和F1分数作为分词效果的评价指标。准确率是指分词结果中正确词占所有识别词的比例,召回率是指分词结果中正确词占实际正确词的比例,F1分数是准确率和召回率的调和平均。 5. 测试数据集:测试数据集通常由不同类型的文本组成,如新闻、科技文献、社交媒体文本等,用于评估分词引擎在不同场景下的性能。测试数据集的多样性和丰富度是影响分词引擎性能评估的关键。 6. 性能对比:通过对比各款分词引擎在相同测试数据集上的表现,可以分析出哪些分词引擎在准确率、速度、资源消耗等方面表现更优,哪些更适合处理特定类型的文本。 7. 应用场景:分词引擎的选择也依赖于其应用场景。例如,搜索引擎可能更重视速度和准确率,而语音识别则可能更注重实时性和对口语的适应性。 8. 开源分词引擎:一些开源分词引擎如HanLP、结巴分词(Jieba)等,提供了丰富的功能和社区支持,同时便于开发者根据特定需求进行定制和优化。 通过上述内容,我们可以看到中文分词引擎的重要性和测试数据的作用。开发者和研究人员可以根据测试结果,选择适合自己应用需求的分词工具,并且对分词引擎的性能进行优化,进一步提高中文信息处理的质量和效率。
recommend-type

【大规模EEG数据处理技巧】:EEGbdfreader性能优化秘籍

# 摘要 本文综合探讨了大规模EEG数据处理的关键理论和技术实践,重点介绍了一个名为EEGbdfreader的工具及其在数据处理中的应用。文中首先概述了大规模EEG数据处理的挑战,随后深入介绍了EEGbdfreader工具的安装、配置、基本操作和高级功能,包括
recommend-type

安卓studio多行注释快捷键

<think>好的,我现在需要帮助用户查找Android Studio中多行注释的快捷键。首先,我得回想一下自己之前对Android Studio的了解。通常,不同的IDE有不同的注释快捷键,比如Eclipse中使用Ctrl + /,而IntelliJ IDEA系列(包括Android Studio)可能使用类似的快捷方式。不过用户提到的问题可能涉及到特定情况下的快捷键冲突,比如引用[2]中提到的Kotlin方法注释快捷键的问题,这说明用户可能遇到了快捷键不生效的情况,需要检查是否有冲突。 接下来,我应该确认标准的Android Studio多行注释快捷键是什么。根据常规知识,Windows
recommend-type

JavaFX自学资料整理合集

JavaFX是一个由Oracle公司开发的用于构建富客户端应用程序的软件平台。它是Java SE的一个部分,能够帮助开发者创建图形用户界面(GUI)应用程序,这类应用程序具备现代桌面应用的特性,例如多媒体、图形和动画。JavaFX是Java的一个补充,它利用了Java的强大功能,同时提供了更加丰富的组件库和更加灵活的用户界面布局功能。 在自学整理JavaFX的过程中,以下是一些重要的知识点和概念: 1. JavaFX的架构和组件 JavaFX拥有一个模块化的架构,它由多个组件构成,包括JavaFX Scene Builder、JavaFX运行时、JavaFX SDK、NetBeans IDE插件等。JavaFX Scene Builder是一个可视化工具,用于设计UI布局。JavaFX SDK提供了JavaFX库和工具,而NetBeans IDE插件则为NetBeans用户提供了一体化的JavaFX开发环境。 2. JavaFX中的场景图(Scene Graph) 场景图是JavaFX中用于定义和管理用户界面元素的核心概念。它由节点(Nodes)组成,每个节点代表了界面中的一个元素,如形状、文本、图像、按钮等。节点之间可以存在父子关系,形成层次结构,通过这种方式可以组织复杂的用户界面。 3. FXML FXML是一种XML语言,它允许开发者以声明的方式描述用户界面。使用FXML,开发者可以将界面布局从代码中分离出来,使界面设计可以由设计师独立于程序逻辑进行处理。FXML与JavaFX Scene Builder结合使用可以提高开发效率。 4. JavaFX中的事件处理 JavaFX提供了强大的事件处理模型,使得响应用户交互变得简单。事件处理涉及事件监听器的注册、事件触发以及事件传递机制。JavaFX中的事件可以是键盘事件、鼠标事件、焦点事件等。 5. JavaFX的动画与媒体API JavaFX支持创建平滑的动画效果,并且能够处理视频和音频媒体。动画可以通过时间线(Timeline)和关键帧(KeyFrame)来实现。JavaFX媒体API提供了丰富的类和接口,用于控制音视频的播放、暂停、停止、调整音量等。 6. CSS与JavaFX CSS样式表可以用于美化JavaFX应用程序界面,提供与Web开发中相似的样式设置能力。JavaFX应用了大部分CSS 3标准,允许开发者使用CSS来控制节点的样式,比如颜色、字体、边框等。 7. JavaFX的过渡效果和效果库 JavaFX拥有内置的过渡效果库,可以为节点提供多种动画效果,如移动、旋转、缩放和淡入淡出等。除此之外,JavaFX还提供了一系列的效果,如阴影效果、反射效果、模糊效果等,可以应用于节点以增强视觉表现。 8. JavaFX的数据绑定 数据绑定是JavaFX中非常重要的一个特性,它允许开发者将用户界面元素与后端数据源连接起来。数据绑定可以简化代码的编写,减少手动同步数据的需要。 9. JavaFX的模块化 JavaFX的模块化特性使其可以轻松集成到Java应用中,并且可以独立于Java核心库进行下载和更新,这样有利于JavaFX的快速迭代和减少应用体积。 10. JavaFX的多种输入设备支持 JavaFX支持多种输入设备,包括鼠标、键盘、触摸板等。它提供了一套完整的API来处理各种输入设备的事件,使得创建交互式的用户体验成为可能。 了解这些知识点之后,JavaFX的自学和资料整理工作会更加有条理和系统。由于这些内容较为广泛,因此在实际学习过程中,重点应该是逐一深入理解每一个概念,并尝试在实践项目中应用这些知识点。通过编写小程序和应用来实际感受JavaFX的开发流程和操作细节,最终达到熟练掌握的目的。
recommend-type

【MATLAB编程优化术】:针对EEGbdfreader的代码调优策略

# 摘要 EEGbdfreader作为一款处理脑电图(EEG)数据的软件工具,在临床和研究领域有着广泛应用。本文首先介绍了EEGbdfreader的基本功能和面临的性能挑战,随后回顾了MATLAB编程的基础知识,为深入理解软件内部机制和后续优化工作奠定了基础。第三章重点探讨了EEGbdfreader的代码优化策略,包括代码重构、内存管理、数据缓存以及并行计算与多线程的应用,旨在提升程序性能和效率。第四章则深入讲解