Display line number in emacs

41页PPT | 华为业务流程架构全景视图:全业务域L1-L3级流程全案 TBD、收集和生成线索、验证机会点、TBD、管理销售授权、管理销售项目、管理销售项目群、管理合同要素/模板、验证和分发线索、标前引导、管理开票和回款、客户网络评估、管理销售评审、TBD、管理交付项目群、管理合同文档、管理结构化合同信息、跟踪和培育线索、制定并提交标书、管理合同/PO变更、客户网络规划、管理销售决策。:4.1 管理技术、服务请求、4.2管理备件、服务交付、4.3管理非技术、服务请求、4.4管理客户、投诉。:管理Idea、产生Idea、激发兴趣与协作、孵化、原型和验证、确认Idea与商业化。 阅读详情

1. download linum.el form http://www.emacswiki.org/emacs/line-num.el copy to ~/library/elisp

 

2. start emacs and add content

    C-x C-f ~/.emacs

 ; display line number
(add-to-list 'load-path "~/library/elisp/")
(load "linum.el")
(require 'linum)
(global-linum-mode 1)

; enable erase buffer command
(put 'erase-buffer 'disabled nil)

; set tab to 4 space
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)

;next

 

3. restart emacs

 

 

4. linum.el


;;; line-num.el --- Display line numbers in left-margin of buffer.

;;
;; Filename: line-num.el
;; Description: Display line numbers in left-margin of buffer.
;; Author: (Darryl Okahata) darrylo@hpsrdmo, Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1999-2010, Drew Adams, all rights reserved.
;; Copyright (C) 1989, Hewlett-Packard, all rights reserved.
;; Created: Wed Mar 31 16:18:24 1999
;; Version: 21.0
;; Last-Updated: Fri Jan 15 13:25:23 2010 (-0800)
;; By: dradams
;; Update #: 208
;; URL: http://www.emacswiki.org/cgi-bin/wiki/line-num.el
;; Keywords: local
;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x
;;
;; Features that might be required by this library:
;;
;; None
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Display line numbers in left-margin of buffer.
;;
;; New functions defined here:
;;
;; `display-line-numbers', `toggle-line-numbers-display',
;; `turn-on-line-numbers-display', `turn-off-line-numbers-display'.
;;
;; NOTE: `setnu.el' now provides similar, but generally better,
;; functionality.
;;
;; Original author was Darryl Okahata darrylo@hpsrdmo: The copy on
;; which the current (Adams) modifications were made was obtained from
;; Rick Kunin (rickk@sperdk).
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;; 2004/11/26 dadams
;; Replaced decf with setq...1+.
;; turn-off-line-numbers-display: Error if not displaying line #s.
;; Removed calls to `fit-frame' (and require of fit-frame.el).
;; 2000/11/01 dadams
;; 1. Added: toggle-line-numbers-display, turn-on-line-numbers-display,
;; turn-off-line-numbers-display.
;; 2. Added global vars: displaying-line-numbers-p,
;; display-line-numbers-format-string, display-line-numbers-first-line,
;; display-line-numbers-count, display-line-numbers-buffer-name,
;; display-line-numbers-modified-p.
;; 1999/04/14 dadams
;; Commented out assignment to unused free var: insert-end.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:

;;>> Problem: Tabs at beginning of lines


(and (< emacs-major-version 20) (eval-when-compile (require 'cl))) ;; when, unless

;;;;;;;;;;;;;


;;;###autoload
(defun display-line-numbers ()
"Temporarily display line numbers in left margin of current buffer."
(interactive)
(or (eq (current-buffer) (window-buffer (selected-window)))
(error "Current buffer, %s, is not the selected window's buffer"
(buffer-name)))
(let ((buffer-read-only nil)
(modified (buffer-modified-p))
(name buffer-file-name)
(point (point-marker))
format-string
line-number
(count 0)
nlines
first-line)
(save-restriction
(widen)
(save-excursion
(setq first-line (window-start (selected-window)))
(goto-char first-line)
(setq line-number (1+ (count-lines (point-min) (point))))
(move-to-window-line -1)
(beginning-of-line)
(setq nlines (count-lines first-line (point)))
(let ((max (+ line-number nlines)))
(setq format-string (cond ((< max 100) "%2d ")
((< max 1000) "%3d ")
((< max 10000) "%4d ")
(t "%7d "))))))
(save-excursion
(unwind-protect
(progn
(goto-char first-line)
;; defeat file locking... don't try this at home, kids!
(setq buffer-file-name nil)
(while (<= count nlines)
(insert-before-markers (format format-string line-number))
;;;(setq insert-end (point)) THIS VAR IS FREE - AND UNUSED!
(setq line-number (1+ line-number))
(setq count (1+ count))
(forward-line 1))
(set-window-start (selected-window) first-line)
(goto-char point)
(set-buffer-modified-p modified)
(message "<<< Press SPACE to continue >>>")
(let ((char (read-char)))
(or (eql char ?/ )
(setq unread-command-events (list char))))
)
(goto-char first-line)
(let ((n (1+ (- (aref format-string 1) ?0))))
(while (> count 0)
(setq count (1- count))
(delete-char n)
(forward-line 1)))
(setq buffer-file-name name)
(set-buffer-modified-p modified)))))

;;;-----------------------------------------------------------------

(defvar displaying-line-numbers-p nil)
(make-variable-buffer-local 'displaying-line-numbers-p)
(defvar display-line-numbers-format-string nil)
(make-variable-buffer-local 'display-line-numbers-format-string)
(defvar display-line-numbers-first-line nil)
(make-variable-buffer-local 'display-line-numbers-first-line)
(defvar display-line-numbers-count 0)
(make-variable-buffer-local 'display-line-numbers-count)
(defvar display-line-numbers-buffer-name nil)
(make-variable-buffer-local 'display-line-numbers-buffer-name)
(defvar display-line-numbers-modified-p nil)
(make-variable-buffer-local 'display-line-numbers-modified-p)

;;;###autoload
(defun toggle-line-numbers-display (arg)
"Display/clear line numbers in left margin of current buffer.
With prefix ARG, just number lines in current window, not all lines in
buffer."
(interactive "P")
(if displaying-line-numbers-p
(turn-off-line-numbers-display)
(turn-on-line-numbers-display arg)))

;;;###autoload
(defun turn-on-line-numbers-display (arg)
"Display line numbers in left margin of current buffer.
With prefix ARG, just number lines in current window, not all lines in
buffer."
(interactive "P")
(or (eq (current-buffer) (window-buffer (selected-window)))
(error "Current buffer, %s, is not the selected window's buffer"
(buffer-name)))
(let ((buffer-read-only nil)
(point (point-marker))
line-number
nlines)
(setq display-line-numbers-buffer-name buffer-file-name)
(setq display-line-numbers-modified-p (buffer-modified-p))
(save-restriction
(widen)
(save-excursion
(setq display-line-numbers-first-line
(if arg
(window-start (selected-window))
(point-min)))
(goto-char display-line-numbers-first-line)
(setq line-number (1+ (count-lines (point-min) (point))))
(if arg
(move-to-window-line -1)
(goto-char (point-max)))
(beginning-of-line)
(setq nlines (count-lines display-line-numbers-first-line (point)))
(let ((max (+ line-number nlines)))
(setq display-line-numbers-format-string (cond ((< max 100) "%2d ")
((< max 1000) "%3d ")
((< max 10000) "%4d ")
(t "%7d "))))))
(save-excursion
(condition-case nil
(progn
(goto-char display-line-numbers-first-line)
(setq buffer-file-name nil) ; To prevent saving with line numbers etc.
(setq displaying-line-numbers-p t)
(while (<= display-line-numbers-count nlines)
(insert-before-markers
(format display-line-numbers-format-string line-number))
(setq line-number (1+ line-number))
(setq display-line-numbers-count (1+ display-line-numbers-count))
(forward-line 1))
(when arg
(set-window-start (selected-window) display-line-numbers-first-line))
(goto-char point)
(set-buffer-modified-p display-line-numbers-modified-p))
(error
(progn
(goto-char display-line-numbers-first-line)
(let ((n (1+ (- (aref display-line-numbers-format-string 1) ?0))))
(while (> display-line-numbers-count 0)
(setq display-line-numbers-count (1- display-line-numbers-count))
(delete-char n)
(forward-line 1)))
(setq buffer-file-name display-line-numbers-buffer-name)
(set-buffer-modified-p display-line-numbers-modified-p)
(setq displaying-line-numbers-p nil))))))
(let ((curr-line (count-lines (window-start) (point))))
(when (> curr-line 0) (setq curr-line (1+ curr-line)))
(recenter curr-line)))

;;;###autoload
(defun turn-off-line-numbers-display ()
"Clear displayed line numbers from left margin of current buffer."
(interactive)
(unless (eq (current-buffer) (window-buffer (selected-window)))
(error "Current buffer, `%s', is not the selected window's buffer"
(buffer-name)))
(unless displaying-line-numbers-p
(error "Not displaying line numbers in buffer `%s'" (buffer-name)))
(let ((buffer-read-only nil))
(save-excursion
(when (boundp 'display-line-numbers-buffer-name)
(setq buffer-file-name display-line-numbers-buffer-name))
(goto-char display-line-numbers-first-line)
(let ((n (1+ (- (aref display-line-numbers-format-string 1) ?0))))
(while (> display-line-numbers-count 0)
(setq display-line-numbers-count (1- display-line-numbers-count))
(delete-char n)
(forward-line 1)))
(when (boundp 'display-line-numbers-modified-p)
(set-buffer-modified-p display-line-numbers-modified-p))
(setq displaying-line-numbers-p nil))))


;;;;;;;;;;;;;;;;;;;;;;;

(provide 'line-num)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; line-num.el ends here
Nvidia Jetson 编解码开发(3)解决H265解码报错“PPS id out of range” 基于之前的开发程序通过Jetson Xavier NX 硬编码的H265发出后,上位机断点播放发出来的H265码流,会报“PPS id out of range” 错误。 阅读详情

相关推荐

总结-NuerIPS2023-Direct Preference Optimization:Your Language Model is Secretly a Reward Model

对比PPO,DPO的泛化能力更强。

m0_60361484的博客 1609

display-line-number.el (emacs中显示行号)

;;; display-line-number.el --- line number mode for Emacs;; Copyright (C) 2004 Free Software Foundation, Inc.;; Author: ChunYe Wang ;; Keywords: tools;; This file is free software; you

嵌入式系统,linux,存储 4140

手把手教你用OpenClaw+飞书打造论文写作AI助手(附踩坑实录)

面对几十篇文献,逐一阅读摘要都费时。我:“请提取桌面‘论文参考文献’文件夹中所有PDF的摘要,整理成表格,包含:论文标题、作者、发表年份、核心方法、主要结论。AI助手:“正在处理...已提取18篇论文摘要,汇总表格已保存到桌面‘文献摘要汇总.xlsx’。这比我自己一个个打开PDF复制粘贴快了不止100倍。OpenClaw+飞书的组合,让AI真正成为了我的“数字员工”。虽然配置过程有些曲折,但看到它在飞书里回应指令、帮我处理繁琐工作时,那种成就感无可替代。如果你也在准备论文,不妨试试这套方案。记住,

AcademicIdeas的博客 1044

linum.el: Yet another package for Emacs to display line number

Emacs 自带的行号显示方式仅仅在 mode-line 上显示当前行号,有时候显得颇不方便。其他流行的和不流行的编辑器通常都有在左边显示行号的功能。Emacs 当然也有许多扩展来实现这个功能,比如 setnu.el(再配上 setnu+.el) 以及 wb-line-number.el 等。今天在这里又发现一个 linum.el ,它的主页在这里。 其实总的来说,这几个扩展都不是特别理想,比如...

350

服务器测试之GPU基础汇总

GPU英文全称Graphic Processing Unit,中文翻译为“图形处理器”。一个专门的图形核心处理器。GPU是显示卡的“大脑”,决定了该显卡的档次和大部分性能,同时也是2D显示卡和3D显示卡的区别依据。可以形象的理解为90%的ALU(运算单元),5%的Control(控制单元)、5%的Cache(缓存单元)GPU的设计原理——总结为大量的简单运算。

qq_41897488的博客 2万+

电子产品的老化测试有哪些类型?

因此,越来越多的人在寻找“已知合格的测试连接器”,即经过测试具有可靠性和有效性的测试连接器,可以在老化测试中制定优化方法。例如对于芯片来说,不同的封装有不同的老化测试座,QFP老化测试座,QFN老化测试座等。老化测试时,专用老化电路板上的元件将承受等于或高于其额定工作条件的压力,以消除任何在额定寿命之前过早失效的元件。静态老化:在此类系统中,将测试设备安装到老化板上的插座中,然后放入老化箱中,其中每隔12至24小时施加电源和高温。动态老化:在动态老化系统中,设备以老化速度设定的最大速率进行测试。

软件技术的专栏 1841

Unity3DTraining 面试题整理:Unity 游戏开发进阶面试全攻略(Lua / C / C++ / Unity / 算法 / 网络 / 设计模式)

> **导读**:本文以 [Doc/马三的面试题整理.md](https://link.gitcode.com/i/1e2661938046554cf4b53665647ea528) 为骨架,系统梳理 Unity 客户端开发岗位面试中的高频考点,涵盖 Lua、C#、C++、Unity 引擎、算法与 3D 数学、网络通信、设计模式七大板块,并对每一道题给出可复述的完整答案。文章同时以 Unity3D

gitblog_00845的博客 995

【EDA Tools】Spyglass 检查 Verilog 和 SystemVerilog 混合语言及 Lint 检查

Spyglass可以用于检查混合设计中的语言互操作性和一致性问题。对于设计中包含多种硬件描述语言的情况,Spyglass 能够识别并解析其中的模块及其互连,并对其进行验证。例如,在包含 Verilog 和 VHDL 的混合设计中,Spyglass 会自动识别并解析 Verilog 和 VHDL 文件及其相互连接。通过运行 Spyglass Lint 功能,可以检查混合设计中的语言一致性问题,例如不兼容的数据类型、互操作性问题以及其他可能导致设计故障或不一致的问题。

记录学习历程 5082

emacs显示行号

第一步:安装setnu.el到/usr/share/emacs/site-lisp目录下;第二步:在.emacs中添加(require setnu)(setnu-mode t)第三步:在启动emacs后M-x setnu-mode即可以!

3181

地统计插值学习心得(一)

(创建地统计图层工具用于根据现有的地统计图层或者地统计模型来创建包含新要素数据集的地统计图层,也就是使用构建好的地统计模型用到新的数据集中)这表明,远离极值的区域预测不受极值的影响,并且还表明,包括极值会导致钼元素浓度高的区域周围的预测明显变高。通常,我们使用同一个数据集进行建模和预测,但是在实际插值过程中,这两步的数据可以是不同的,这就是处理极值的诀窍。如果你的数据集有无法忽略的极值时(比如这些钼元素浓度),一种常见的方法是首先显式移除极值进行建模,然后在预测中使用整个数据集(包括极值)。

JData_Engineer的博客 287

【毕设级教程】从0到1实现基于YOLOv8的UA-DETRAC交通目标检测系统(含UI界面,助力智能交通毕设)

本项目基于YOLOv8模型和UA-DETRAC数据集开发了一个交通目标检测系统,包含数据处理、模型训练和可视化界面全流程。UA-DETRAC数据集包含多种交通场景下的车辆标注,通过格式转换适配YOLOv8训练要求。系统采用PyQt开发交互界面,支持图像检测、结果显示等功能。该项目技术路线清晰,既展现深度学习在智能交通中的应用,又提供完整的可视化展示方案,适合作为计算机视觉相关毕业设计选题。

m0_64661770的博客 151

Emacs 显示左侧行号

Emacs 显示左侧行号

weixin_46496519的博客 949

022、Conv-BN-SiLU 基础卷积块:构造函数参数计算,前向传播的 PyTorch 逐行实现

本文详细解析了Conv-BN-SiLU卷积块的实现细节与注意事项。作者从调试经历出发,指出bias参数冗余会导致数值不稳定,强调卷积层应设置bias=False。文章对比了SiLU与ReLU的特性差异,逐行分析了构造函数参数计算(包括自动填充、分组卷积等)和前向传播过程,特别讲解了BN层与SiLU激活的数值特性。最后分享了三个实践中的常见问题:BN的momentum设置、SiLU输出范围的影响,以及分组卷积的通道对齐要求,并提供了卷积与BN融合的推理优化技巧。全文聚焦实际工程实现中的关键细节,具有较强实操指

ai技术增长的博客 220

Flet 文件读写实战指南:用好 FLET_APP_STORAGE_* 存储路径,在移动端与桌面端持久化数据

本指南围绕 Flet 官方 Cookbook 中的文件读写主题([read-and-write-files.md](https://link.gitcode.com/i/f6a33217358877580cf6b8002a13e473)),系统讲解 Flet 为应用预置的三个私有存储目录(数据、缓存、临时),演示如何用 Python 内置 `open`/`os` 完成写入、读取与文件管理,并深入拆

gitblog_00882的博客 929

深度学习工具包 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")

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

「GNU Emacs」- 行号操作(显示、统计、定位) @20210318

问题描述 在阅读技术书籍时,作者使用行号来引用示例代码。我们需要知道示例代码的行号,以快速定位到示例代码的对应位置。 在日常代码编辑中,我也们需要查看行号: 1)以快速定位到特定行(某些情况会快于使用 goto-line 命令); 2)在描述问题时,通过代码所在的行号进行定位代码; 该笔记将记录:在 GNU Emacs 中,显示行号的方法。注意,我们所说的“显示行号”除了在左侧显示行号,还包括显示当前行号、统计总行数等等。 解决方案 显示当前行号: 1)M-x what-line [RET],将.

k4nz 562

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

如何在Emacs中安装pdf-tools?3分钟快速上手教程 [特殊字符]

想在Emacs中流畅地查看和编辑PDF文件吗?pdf-tools是Emacs社区最强大的PDF处理工具,提供了完整的PDF查看、搜索、注释等功能。本文将为您详细介绍如何在3分钟内快速完成pdf-tools的安装和配置,让您立即开始高效处理PDF文档! ## 📦 什么是pdf-tools? **pdf-tools**是Emacs的PDF支持库,它使用poppler库作为后端,通过epdfinf

gitblog_00201的博客 674

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Emacs Configuration

Emacs折腾了我很久,直到现在我才把它设置的比较满意。以下是我的.emacs文件:  (setq visible-bell t);不要打入TAB的时候总是听到PC叫(column-number-mode t);显示行号和列号(show-paren-mode t);显示要匹配的括号;(set-default-font "DejaVu Sans Mono:pixelsize=

dragon2nd的专栏 630

emacs29设置相对行号,行号和关闭splash界面

相对行号行号关闭欢迎界面。

Never Give Up 107

5分钟上手Emacs Powerline:从安装到自定义的快速教程

Emacs Powerline是一个让Emacs状态栏(mode-line)变得更美观、更实用的终极美化工具。这个强大的Emacs插件可以显著提升你的编辑体验,让状态栏信息更加清晰易读。如果你正在寻找一个简单快速的方法来美化Emacs界面,这篇完整指南将帮助你在5分钟内掌握Emacs Powerline的安装、配置和自定义技巧。😊 ## 🚀 快速安装Emacs Powerline 安装Em

gitblog_00354的博客 361

Emacs VS VIM代码前插入行号(六十一)

【代码】Emacs VS VIM在代码前插入行号。

Android系统攻城狮 532

GNU Emacs完全指南:从新手入门到定制你的终极编辑环境

如果你正在同时修改十来个配置文件、频繁在不同的项目目录间切换、还希望有一套完全属于自己的操作习惯——那么你大概率需要 GNU Emacs。这是一款可编程、可无限扩展的文本编辑器,更是一个把代码编辑、文件管理、终端操作、任务清单整合进同一界面的工作环境。本份 GNU Emacs 完全指南将带你从零上手,用实战场景逐步掌握它的核心用法,并最终搭建出属于你的终极编辑环境。无论你是刚接触编程的新手,还是想

gitblog_00363的博客 643

如何定制Emacs Powerline外观:字体、颜色与分隔符全攻略

Emacs Powerline是一款强大的模式行美化工具,能帮助用户打造个性化的编辑器界面。本文将详细介绍如何通过简单配置,轻松调整字体大小、自定义颜色方案以及更换分隔符样式,让你的Emacs模式行既美观又实用。 ## 🎨 基础设置:快速上手Powerline 要开始使用Emacs Powerline,首先需要安装并启用该插件。通过以下命令克隆项目仓库: ```bash git clone

gitblog_00390的博客 506

Emacs之linum插件废弃解决(七十六)

linum插件主要显示行号功能,但是将emacs升级到29.0以上版本 2.解决方式 废弃方式: 改为:

Android系统攻城狮 612

终极Emacs写作环境搭建:writeroom-mode与visual-fill-column完整配置方案

想在 Emacs 里打造一个真正让人沉浸的写作环境?writeroom-mode 就是为此而生的无干扰写作插件(Distraction-free Writing Minor Mode),它模仿了 macOS 上著名的 Writeroom 编辑器体验,配合 visual-fill-column 实现文字居中的优雅排版。激活后,Emacs 会自动进入全屏,隐藏菜单栏、工具栏、滚动条甚至模式行,让文字像

gitblog_01022的博客 314

Cyberpunk Neon主题高级定制:如何为Vim和Emacs编辑器配置个性化主题

Cyberpunk Neon是一款为KDE Plasma、GTK、Telegram、Tilix、Vim、Zim等多种应用打造的赛博朋克风格主题集合,通过鲜明的霓虹色彩和深色背景,为用户带来未来感十足的视觉体验。本文将详细介绍如何为Vim和Emacs两款经典编辑器配置Cyberpunk Neon主题,让你的代码编辑环境焕发赛博朋克魅力。 ## 准备工作:获取Cyberpunk Neon主题文件

gitblog_01002的博客 488

pdf-tools性能优化:让Emacs流畅处理大型PDF文件的7个技巧

想要在Emacs中流畅处理大型PDF文件吗?pdf-tools作为Emacs最强大的PDF查看和编辑工具,为学术研究、文档处理提供了完整解决方案。本指南将分享7个专业技巧,帮助你优化pdf-tools性能,让大型PDF文件在Emacs中运行如飞!🚀 ## 1. 优化图像缓存配置,提升渲染速度 pdf-tools使用智能缓存机制来存储渲染的页面图像,默认配置可能无法满足大型PDF文件的需求。通

gitblog_01108的博客 855
上一篇: 2008GCT, 过了
caesar_ca
博客等级 码龄20年 9粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值