相关推荐
ollama环境变量配置:修改ollama的数据路径(安装路径)
ollama安装模型,如果很大,会占用C盘空间,影响系统运行速度,通过设置环境变量,来改变ollama放目录的地址。
怎样才算好代码?
好代码具备的特性 正确:代码应当正确处理所有预期输入(expected input)和非法输入(unexpected input)。 高效:
【QGIS、OSM】利用python开源工具实现指定区域的交通分配
如果从osmgnms和grid2demand得到的node.csv,我们要修改path4gnms代码中的utils.py的四处设置。利用QGIS实现可视化,得到的link_performance.csv,参数有volume和VOC。改完这四处代码,就可以运行path4gnms中的tutorial.ipynb了。
什么是好代码?
“什么狗屁代码,老子看了几个小时也没明白!”“这么烂的代码,到底是谁写的!”Bob大叔说:“衡量代码质量的唯一标准是阅读该代码时说脏话的次数”, 真是很有趣的说法。什么是...
“三进制”bonsai27b+NInfer=6g显存闪电侠(token真的自由了!)
本文将1.58-bit三元大模型Bonsai27B成功移植至NInfer推理引擎,并在RTX 4080 SUPER上实现100+ token/s的极速推理。通过自研补丁扩展NInfer支持Ada架构与三元量化格式,解决激活布局、行置换等关键bug,实测PPL 6.445,单流吞吐达96.7–130.8 t/s,20题基准得分16/20。附完整复现包(含文档、工具、源码补丁),零权重分发,助力垃圾显卡跑通27B级模型。
3A之自动对焦(AF)算法:从Tenegrad到拉普拉斯的清晰度评价实战
本文深入解析自动对焦(AF)算法的核心——清晰度评价函数,通过实战对比Tenegrad、方差、能量梯度、Brenner和拉普拉斯五大经典算法的原理、代码实现与性能。文章详细阐述了各函数在计算速度、抗噪性和单峰性上的优劣,并提供了从仿真测试到硬件部署的优化策略,帮助开发者根据实际场景选择最合适的AF算法。
什么样的代码才是好代码
衡量代码的好坏的指标或者维度有很多,比如性能好、架构好、高内聚等,这些指标的侧重点各不相同,不同的开发人员的关注的重点也各不相同。我个人更喜欢简单的可读性高的代码,我主要从以下几个维度衡量代码是否良好: 代码是可工作的 代码是可读性高的 代码是简单的 代码是高内聚的 代码是低耦合的 代码是可工作的 写代码的目的是要为了解决特定问题的,因此无论如何,代码首先是可工作的,能解...
详解GPU显存和batch size的关系
GPU显存、规格指标;神经网络训练,显存占用
究竟怎样写代码才算是好代码?
看下面这段英文解释: 'Good code' is code that works, is bug free, and is readable and maintainable. Some organizations have coding 'standards' that all developers are supposed to adhere to, but everyone has
DRAM刷新refresh相关知识归类-基础小知识(三)
RAM每一位数据都是通过芯片内的一个小电容充电(或低电平)存储的。但随着时间的推移,电容逐渐失去电荷。为避免丢失存储的数据,必须定期刷新以将电荷(如果存在)恢复到其原始级别。此刷新过程包括读取每个位的值,然后将其写回。在此“刷新”期间,内存被占用,无法执行加载或存储位等正常操作。知道了应该这么做,但怎么去做以及有什么办法更有效率去做,就是接下来要整理的内容。
AI Agent在智能餐饮管理中的实践
本文章的主要目的是详细探讨AI Agent在智能餐饮管理中的实际应用。随着人工智能技术的飞速发展,餐饮行业也在积极寻求智能化转型,AI Agent作为一种具有自主决策和执行能力的智能体,为餐饮管理带来了新的机遇和解决方案。本文将涵盖AI Agent在餐饮管理各个环节的应用,包括订单管理、库存管理、员工调度、客户服务等方面,旨在为餐饮企业和相关技术人员提供全面的技术指导和实践参考。本文将按照以下结构进行阐述:首先介绍核心概念与联系,明确AI Agent和智能餐饮管理的定义和相互关系;
聊一聊怎样写代码才算是好代码
究竟怎样写代码才算是好代码,今天就跟大家聊一聊这个话题 一、代码命名规范: 1、 package包名全部由小写的ASCII字母组成,用“.”分隔。在此项目中,所有的包均以“com.abc.ticket”开头。 2、 class 类名应当是名词,每个内部单词的头一个字母大写。应当使你的类名简单和具有说明性。用完整的英语单词或约定俗成的简写命名类名。 【示例】public class User
究竟怎样写代码才算是好代码[转载]
转载出处:http://blog.csdn.net/u013970991/article/details/52609083 写的很好,转载保存起来 今天让我们来谈谈代码吧。代码重要吗?当然,代码就是设计(Jack W.Reeves, 1992);代码是最有价值的交付物。我们需要好代码吗?在给“好代码”下个定义之前,这个问题无法回答。那么,究竟什么是好代码? 看下面这段英文解释:
Statistics and Machine Learning Toolbox
Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
一天写多少行代码才算是好程序员?
点击查看全文 当今时代很多吃瓜群众对程序员的印象都是 而程序员的真实情况却是这样:每天大部分时间都在改代码,写代码,看代码才是我们真实的工作日常,到底每天要写多少行才是好程序员呢? 为了探讨这个问题首先要了解程序员的种类。一般来讲,开发者(指的是纯的写代码,不包括不写代码的项目经理 、技术总监等)主要分为: 1. web工程师: 一般是写基于w
假人有限元模型
假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用
Codex 接入真实项目:写代码只是开始,能解释失败才算入门
摘要:Codex 这类 AI 编程助手在个人 Demo 场景下确实能提速,但团队把它接入真实项目时,真正拉开差距的不是"能不能写代码",而是"能不能解释失败"。本文以一段可运行的 Flask 服务为例,从上下文配置、修改流程、测试验证到团队协作规范,给出完整复盘,包含踩坑记录和可直接复用的代码片段。---目录Codex 的定位:它不是替代开发者,是替代重复劳动项目上下文理解:给 Codex 喂什么,决定了它写什么代码修改流程:从 Demo 到可维护项目的关键一步。
深度学习工具包 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');```[](https://bitdeli.com/free "Bitdeli Badge")
一天写多少行代码才算是好程序员?v
点击查看全文 当今时代很多吃瓜群众对程序员的印象都是 而程序员的真实情况却是这样:每天大部分时间都在改代码,写代码,看代码才是我们真实的工作日常,到底每天要写多少行才是好程序员呢? 为了探讨这个问题首先要了解程序员的种类。一般来讲,开发者(指的是纯的写代码,不包括不写代码的...
你写的PyTorch代码为什么能“边写边跑”?读懂这3个核心设计,才算真正掌握动态图
PyTorch的本质,不是一个深度学习框架,而是一种“让研究者像写Python一样写神经网络”的建模范式。模型应该被“描述”然后“执行”,还是被“编写”然后“运行”?PyTorch选择了后者——因为编写和运行是同一件事,而研究者不应该为框架的约束牺牲思想的表达自由。截至2026年8月,PyTorch 2.13.0已经实现了这个愿景的绝大部分。如果你正在从事AI研究工作,或者需要构建需要极致灵活性的动态网络,值得花一个下午,深入读一读的源码。关注我们,获取更多AI技术深度解读和工程实践案例。
提高代码质量-总结思维导图
拜读了“究竟怎样写代码才算是好代码“这篇文章http://blog.csdn.net/u013970991/article/details/52609083。简单做了个整理,规划学习路线,提高代码质量
1万+




被折叠的 条评论
为什么被折叠?



