ios object-c errno

【Linux】Linux系统错误码errno详解 在嵌入式Linux开发中,使用errno进行错误处理是非常常见和必要的。嵌入式系统通常需要处理各种硬件和软件的交互,错误处理和调试是确保系统稳定性和可靠性的关键部分。errno在嵌入式Linux开发中是一个重要的工具,通过合理使用errno,可以有效地捕获和处理各种错误情况,确保系统的稳定性和可靠性。在Linux系统中,errno是一个全局变量,用于表示最近一次系统调用或库函数调用出错时的错误码。每个错误码对应一个特定的错误类型。了解这些错误码有助于调试和处理错误情况。 阅读详情

error是一个包含在<errno.h>中的预定义的外部int变量,用于表示最近一个函数调用是否产生了错误。若为0,则无错误,其它值均表示一类错误。

perror()和strerrot()函数可以把errno的值转化为有意义的字符输出。

[cpp]  view plain copy
  1. #include <stdio.h>  
  2. #include <stdlib.h>  
  3. #include <dirent.h>  
  4. #include <errno.h>  
  5. #include <string.h>  
  6.   
  7. int main(void){  
  8.     extern int errno;  
  9.   
  10.     errno=0;  
  11.     opendir("/home/kkk");  
  12. //用法1:直接读取errno的值  
  13.     printf("%d\n", errno);  
  14.   
  15. //用法2:使用perror函数,把error的值转化为有意义的字符提示。  
  16.     if(errno != 0){  
  17.         perror("opendir: ");  
  18. //        exit(EXIT_FAILURE);  
  19.     }  
  20.   
  21. //用法3:类似用法2,但使用strerror函数。  
  22.     if(errno != 0){  
  23.         printf("%s\n", strerror(errno));  
  24.         exit(0);  
  25.     }  
  26.   
  27.   
  28.     exit(0);  
  29. }  
输出结果为:

2
opendir: : No such file or directory
No such file or directory


以下程序用于显示所有的错误代码含义(经测试,目前的错误代码从0-132,其余未使用)

[cpp]  view plain copy
  1. #include <stdio.h>  
  2. #include <errno.h>  
  3. #include <stdlib.h>  
  4. #include <string.h>  
  5.   
  6. int main(void){  
  7.   
  8.     for(int i = 0; i < 140; i++){  
  9.         printf("%4d:%s\n", i, strerror(i));  
  10.     }  
  11.   
  12.     exit(0);  
  13. }  

输出结果如下:

   0:Success
   1:Operation not permitted
   2:No such file or directory
   3:No such process
   4:Interrupted system call
   5:Input/output error
   6:No such device or address
   7:Argument list too long
   8:Exec format error
   9:Bad file descriptor
  10:No child processes
  11:Resource temporarily unavailable
  12:Cannot allocate memory
  13:Permission denied
  14:Bad address
  15:Block device required
  16:Device or resource busy
  17:File exists
  18:Invalid cross-device link
  19:No such device
  20:Not a directory
  21:Is a directory
  22:Invalid argument
  23:Too many open files in system
  24:Too many open files
  25:Inappropriate ioctl for device
  26:Text file busy
  27:File too large
  28:No space left on device
  29:Illegal seek
  30:Read-only file system
  31:Too many links
  32:Broken pipe
  33:Numerical argument out of domain
  34:Numerical result out of range
  35:Resource deadlock avoided
  36:File name too long
  37:No locks available
  38:Function not implemented
  39:Directory not empty
  40:Too many levels of symbolic links
  41:Unknown error 41
  42:No message of desired type
  43:Identifier removed
  44:Channel number out of range
  45:Level 2 not synchronized
  46:Level 3 halted
  47:Level 3 reset
  48:Link number out of range
  49:Protocol driver not attached
  50:No CSI structure available
  51:Level 2 halted
  52:Invalid exchange
  53:Invalid request descriptor
  54:Exchange full
  55:No anode
  56:Invalid request code
  57:Invalid slot
  58:Unknown error 58
  59:Bad font file format
  60:Device not a stream
  61:No data available
  62:Timer expired
  63:Out of streams resources
  64:Machine is not on the network
  65:Package not installed
  66:Object is remote
  67:Link has been severed
  68:Advertise error
  69:Srmount error
  70:Communication error on send
  71:Protocol error
  72:Multihop attempted
  73:RFS specific error
  74:Bad message
  75:Value too large for defined data type
  76:Name not unique on network
  77:File descriptor in bad state
  78:Remote address changed
  79:Can not access a needed shared library
  80:Accessing a corrupted shared library
  81:.lib section in a.out corrupted
  82:Attempting to link in too many shared libraries
  83:Cannot exec a shared library directly
  84:Invalid or incomplete multibyte or wide character
  85:Interrupted system call should be restarted
  86:Streams pipe error
  87:Too many users
  88:Socket operation on non-socket
  89:Destination address required
  90:Message too long
  91:Protocol wrong type for socket
  92:Protocol not available
  93:Protocol not supported
  94:Socket type not supported
  95:Operation not supported
  96:Protocol family not supported
  97:Address family not supported by protocol
  98:Address already in use
  99:Cannot assign requested address
 100:Network is down
 101:Network is unreachable
 102:Network dropped connection on reset
 103:Software caused connection abort
 104:Connection reset by peer
 105:No buffer space available
 106:Transport endpoint is already connected
 107:Transport endpoint is not connected
 108:Cannot send after transport endpoint shutdown
 109:Too many references: cannot splice
 110:Connection timed out
 111:Connection refused
 112:Host is down
 113:No route to host
 114:Operation already in progress
 115:Operation now in progress
 116:Stale NFS file handle
 117:Structure needs cleaning
 118:Not a XENIX named type file
 119:No XENIX semaphores available
 120:Is a named type file
 121:Remote I/O error
 122:Disk quota exceeded
 123:No medium found
 124:Wrong medium type
 125:Operation canceled
 126:Required key not available
 127:Key has expired
 128:Key has been revoked
 129:Key was rejected by service
 130:Owner died
 131:State not recoverable
 132:Operation not possible due to RF-kill
 133:Unknown error 133
 134:Unknown error 134
 135:Unknown error 135
 136:Unknown error 136
 137:Unknown error 137
 138:Unknown error 138
 139:Unknown error 139

在双系统之一Ubuntu下安装YaH3C并解决 [Errno 19] No such device成功连上校园网 前言:今天要给自己一个大大的拥抱,从6、7点到晚上一点多的奋战终于让自己刚刚安好的优麒麟(Ubuntu Kylin)—— Ubuntu 中国定制版本连上了校园网,希望自己的经验能帮到大家 我为什么不用 H3C iNode ? 跑不动啊,不知道为啥按照校园网给的教程到最后一步打开可执行文件的时候都没有程序界面出来,我也很绝望,实话告诉大家,我一个H3C iNode 大概折腾了整整一天,坚强的... 阅读详情

相关推荐

nios 9.1 IDE报错:Unable to reach errno (at 0x) from the global pointer (at 0x0000b2b0) because t

nios 9.1 IDE报错:Unable to reach errno (at 0x) from the global pointer (at 0x0000b2b0) because t

xin15200793067的专栏 1870

errno详解

errno 详解作用相关函数多线程 作用 errno 是 error number 的缩写,意味系统调用错误码。 如果系统调用返回成功,errno 有可能但不一定会置0;而系统调用出错时,errno 必定会被设为对应的错误编号。因此,强迫症患者可以在调用系统调用之前,手动将 errno 置0。不过,如果系统调用返回成功,谁会闲着没事去看 errno 呢? 相关函数 一般来说,我们是不是需要了解每个...

tissar的博客 7576

iOS-底层原理 17:类的加载(上)

iOS 底层原理 文章汇总 在上一篇iOS-底层原理 16:dyld与objc的关联文章中,我们理解了dyld与objc是如何关联的,本文的主要目的是理解类的相关信息是如何加载到内存的,其中重点关注map_images和load_images map_images:主要是管理文件中和动态库中的所有符号,即class、protocol、selector、category等 load_images:加载执行load方法 其中代码通过编译,读取到Mach-O可执行文件中,再从Mach-O中读取到内.

lin1109221208的博客 1447

select 出错! errno:22(EINVAL)

errno = 0; 很多文章都抄来抄去,哔哔了半天手动清零errno,也没有说怎么清零errno错误。实际上就这一句话。若你不执行这一句话等个几个小时,系统才可能给你清零,可不是等几分钟。有时间一个最简单操作能难道英雄汉。实践是检验真理的唯一标准。

jia12216的专栏 3668

php 使用ios的apns进行推送

$data = array( "aps"=>array( 'alert'=>'这是推送标题', "sound"=>"default", "badge"=>0, ), 'app'=>array( "title"=>"这是展示标题内容", "con

PHP_xiaozhang的博客 868

errno错误码含义及使用

今天在用到_trename进行文件重命名时,考虑可能会重命名失败,需要将出错时对应的错误吗记录到日志中。从MSDN查知,函数执行失败时会返回非0,通过errno宏可能获知对应的错误码。为了定位问题的方便,特将错误码对应的含义列出来。 1、 errno错误码含义 #ifndef _ASM_GENERIC_ERRNO_BASE_H #define _ASM_GENERIC_

dvlinker的技术专栏 1万+

揭秘C语言与Rust错误传递机制:90%开发者忽略的3个关键差异

深入解析C语言与Rust错误传递机制差异,揭示高效稳定的系统编程关键。涵盖返回码、panic和Result类型的应用场景与优势对比,帮助开发者规避常见陷阱,提升代码可靠性。值得收藏

FuncTide的博客 958

errno 错误码含义及使用

errno 错误码含义及使用

dvlinker的技术专栏 298

iOS13上传相册视频Code=1 "Operation not permitted"

iOS13上传相册视频Code=1 “Operation not permitted” 在做文件上传时候,发现iOS13上,选择相册的视频上传,会报无权限访问文件的错误,iOS13以下的系统不会出这个问题,可能部分机型上会有吧,但是我没发现。 报错信息: Error Domain=NSCocoaErrorDomain Code=257 "The file "trim.166DC0B6-0C86...

竹毛言己 3452

傅里叶变换实战:用Python手把手教你分析音频频谱(附完整代码)

本文详细介绍了如何使用Python实现傅里叶变换进行音频频谱分析,涵盖音频加载、预处理、FFT应用、频谱可视化及特征提取等关键步骤。通过实战案例和完整代码,帮助开发者掌握数字信号处理技术,特别适合音频分析和音乐信息检索领域的应用。

weixin_29090677的博客 150

C语言|深入浅出讲解int转换为float全过程(附2017年统考大题案例)

int转换为float类型为什么会发生精度损失? 精度损失的详细过程究竟是什么样的? 什么样情况float会发生精度损失?没有弄懂2017年浮点数统考大题? 这一篇用2017年统考大题案例帮你更深的理解浮点数的存储规则。

DADONGOOO的博客 1万+

ios客户端访问fastdfs linux服务器遇到的问题

一、基本需求:主要是实现ios客户端可以访问linux服务器上面配置的fastdfs服务器,能够实现上传和下载文件二、基本信息:        最新版本代码地址:https://github.com/happyfish100/        fastdfs版本:FastDFS_v5.08.tar.gz,libfastcommon也是最新版本,下载版本时间大约2018.03.01左右三、主要思路: ...

xiaojunfucking的博客 980

避开新手第一个坑:手把手教你正确安装Perforce服务器与客户端(P4d/P4V)

本文详细指导如何正确安装和配置Perforce服务器与客户端(P4d/P4V),避免新手常见的安装顺序错误。从环境准备到分步安装,再到常见问题排查和性能优化,帮助开发者快速搭建稳定的版本控制环境,提升团队协作效率。

weixin_26804345的博客 666

linux c 485 串口通信,Linux c使用485通讯,ioctl的配置

/* Include definition for RS485 ioctls: TIOCGRS485 and TIOCSRS485 */#include /* Open your specific device (e.g., /dev/mydevice): */int fd = open ("/dev/mydevice", O_RDWR);if (fd < 0) {/* Error hand...

weixin_39631467的博客 1335

2021.11.23 Covins 多机器人单目协同建图 跑Euroc数据集 更新

近日,一直在调试如何使用Covins跑通数据集,因为是初学者,所以很多bug出来的时候原理都不懂,只能复制——百度——尝试解决的过程。 现分享一下近日的结果以及与Covins作者帮助解答的一些问题。 使用代码行跑依次跑Euroc多数据集 这里的意思是使用作者提供的covins_examples文件夹中的euroc_examples_mh123_vigba.sh文件,这个文件是将三个Euroc数据集依次运行,跑完第一个数据集,第二个数据集运行的时候在第一个数据集生成地图的基础上继续绘制,由于我只下载了两个数据

qq_42614598的博客 2475

使用CubeMX生成的项目在Keil下添加DSP库并包含arm_math头文件后报错的解决办法

问题描述: 最近使用Cube生成工程后,在Keil中使用Manage Runtime Environment即绿色小饼干按钮添加CMSIS的DSP库后编译报错。很有意思的是,STM32论坛上有外国朋友报告的同样的错误,都是30个Errors,5个Warning。 问题分析: 参考国内论坛某帖子(具体想不起来了),认为因该是Cube复制了库后,Keil从原始Packs目录下引用DSP库导致和Cub...

qq_32256951的博客 7001

ios math 那个头文件_什么情况下要加头文件math.h?

展开全部^math.hThe math header defines several mathematic functions.Macros:HUGE_VALFunctions:acos();asin();atan();atan2();ceil();cos();cosh();exp();fabs();floor();fmod();frexp();ldexp();log();log10();modf...

weixin_39588084的博客 365

从你的全世界路过---陌陌X-SIGN还原

我们上期介绍了hook 接口方式,今天我分析so 层。学习是为了复杂的事情简单化。不用如此繁琐。跟进native_sdbyecbu37x这个函数,我们f5看伪代码 v13 = sign(v9, v10, v11, a6); 跟进这个函数 代码如下(示例): 2.代码贴入 SHA消息摘要java代码如下: java 代码如下(示例): 总结 算法,结合动态调试!

任雪飘的博客 2302

ios-webkit-debug-proxy 示例客户端完全指南:从浏览器 HTML 调试页到 C 语言 WebSocket 回声服务器

ios-webkit-debug-proxy(iwdp)是一个面向 iOS 设备(MobileSafari 与 UIWebView)的 DevTools 代理,它把来自 usbmuxd 守护进程的请求代理到 WebSocket 连接上,让开发者可以直接向 iOS 上的 Web Inspector 发送命令。本指南以仓库 [examples/README.md](https://link.gitco

gitblog_00475的博客 294

YOLOv11魔改高效涨点 | 注意力篇 | SimAM注意力:基于神经科学的 3D 注意力机制,三维权重的暴力美学,无参数也能暴力涨点?代码极简,彻底疯狂!!!

在本文中,我们为卷积神经网络(ConvNets)提出了一个概念简单但非常有效的注意力模块。与现有的通道注意力(Channel-wise)和空间注意力(Spatial-wise)模块不同,我们的模块在不向原始网络添加参数的情况下,推断出层中特征图的 3D 注意力权重。具体来说,我们基于一些知名的神经科学理论,提出优化一个能量函数来寻找每个神经元的重要性。我们进一步推导出了该能量函数的快速闭式解,并表明该解可以用不到十行代码实现。

猫天意的博客 248

PCL 点云圆柱形邻域搜索【2026最新版】

圆柱形邻域搜索是KD-tree算法在点云数据处理中的扩展应用,在一些特定场景应用中具有无与伦比的优势。博客长期更新,本文最近一次更新时间为:2026年5月4日。

点云侠的博客 3451

IOS使用mkdir创建目录

在IOS真机上可以创建目录的位置只有两个Documents和Caches,如果直接在NSHomeDirectory()上创建目录,会失败,返回的errno含义为操作被禁止。 获取Caches中的一个目录的方法: NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NS...

weixin_30784501的博客 200

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

cocoapods 安装报错 ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin...

cocoapods 安装报错 ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj 执行下面语句安装即可: sudo gem install -n /usr/local/bin cocoapods 转载于:https://www.cnblogs.com/co...

weixin_30904593的博客 166

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

IOError: [Errno 2] No such file or directory: 'nul'

今天使用python脚本编译的时候报这个错误Process Process-1:Traceback (most recent call last):  File "C:\Python27\lib\multiprocessing\process.py", line 250, in _bootstrap    sys.stdin = open(os.devnull)IOError: [Errno 2]...

zxl05403的专栏 3160

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

从‘123abc’解析说起:手把手教你用C语言strtol函数搞懂进制转换和错误处理

本文深入解析C语言中strtol函数的进制转换和错误处理机制,对比atoi的局限性,详细讲解strtol的核心参数、错误检测及实际应用技巧。通过实战代码示例,帮助开发者掌握工业级字符串转换方法,提升代码健壮性。

weixin_30325487的博客 205
上一篇: centos安装php php-fpm nginx
下一篇: svn: warning: Tree conflicts can only be resolved to 'working' state
hellochenlian
博客等级 码龄17年 629粉丝 295原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值