当前位置: 首页 > news >正文

跟着 Lua 5.1 官方参考文档学习 Lua (3)

文章目录

    • 2.5 – Expressions
      • 2.5.1 – Arithmetic Operators
      • 2.5.2 – Relational Operators
      • 2.5.3 – Logical Operators
      • 2.5.4 – Concatenation
      • 2.5.5 – The Length Operator
      • 2.5.6 – Precedence
      • 2.5.7 – Table Constructors
      • 2.5.8 – Function Calls
      • 2.5.9 – Function Definitions
    • 2.6 – Visibility Rules

2.5 – Expressions

The basic expressions in Lua are the following:

	exp ::= prefixexpexp ::= nil | false | trueexp ::= Numberexp ::= Stringexp ::= functionexp ::= tableconstructorexp ::= `...´exp ::= exp binop expexp ::= unop expprefixexp ::= var | functioncall | `(´ exp `)´

Numbers and literal strings are explained in §2.1;

variables are explained in §2.3;

function definitions are explained in §2.5.9;

function calls are explained in §2.5.8;

table constructors are explained in §2.5.7.

Vararg expressions, denoted by three dots (‘...’), can only be used when directly inside a vararg function; they are explained in §2.5.9.

Binary operators comprise arithmetic operators (see §2.5.1), relational operators (see §2.5.2), logical operators (see §2.5.3), and the concatenation operator (see §2.5.4).

Unary operators comprise the unary minus (see §2.5.1), the unary not (see §2.5.3), and the unary length operator (see §2.5.5).

Both function calls and vararg expressions can result in multiple values. If an expression is used as a statement (only possible for function calls (see §2.4.6)), then its return list is adjusted to zero elements, thus discarding all returned values. If an expression is used as the last (or the only) element of a list of expressions, then no adjustment is made (unless the call is enclosed in parentheses). In all other contexts, Lua adjusts the result list to one element, discarding all values except the first one.

Here are some examples:

     f()                -- adjusted to 0 resultsg(f(), x)          -- f() is adjusted to 1 resultg(x, f())          -- g gets x plus all results from f()a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)a,b = ...          -- a gets the first vararg parameter, b gets-- the second (both a and b can get nil if there-- is no corresponding vararg parameter)a,b,c = x, f()     -- f() is adjusted to 2 resultsa,b,c = f()        -- f() is adjusted to 3 resultsreturn f()         -- returns all results from f()return ...         -- returns all received vararg parametersreturn x,y,f()     -- returns x, y, and all results from f(){f()}              -- creates a list with all results from f(){...}              -- creates a list with all vararg parameters{f(), nil}         -- f() is adjusted to 1 result

Any expression enclosed in parentheses always results in only one value. Thus, (f(x,y,z)) is always a single value, even if f returns several values. (The value of (f(x,y,z)) is the first value returned by f or nil if f does not return any values.)

2.5.1 – Arithmetic Operators

Lua supports the usual arithmetic operators: the binary + (addition), - (subtraction), * (multiplication), / (division), % (modulo), and ^ (exponentiation); and unary - (negation). If the operands are numbers, or strings that can be converted to numbers (see §2.2.1), then all operations have the usual meaning. Exponentiation works for any exponent. For instance, x^(-0.5) computes the inverse of the square root of x. Modulo is defined as

     a % b == a - math.floor(a/b)*b

That is, it is the remainder of a division that rounds the quotient towards minus infinity.

2.5.2 – Relational Operators

The relational operators in Lua are

     ==    ~=    <     >     <=    >=

These operators always result in false or true.

Equality (==) first compares the type of its operands. If the types are different, then the result is false. Otherwise, the values of the operands are compared.

Numbers and strings are compared in the usual way.

Objects (tables, userdata, threads, and functions) are compared by reference: two objects are considered equal only if they are the same object. Every time you create a new object (a table, userdata, thread, or function), this new object is different from any previously existing object.

You can change the way that Lua compares tables and userdata by using the “eq” metamethod (see §2.8).

The conversion rules of §2.2.1 do not apply to equality comparisons. Thus, "0"==0 evaluates to false, and t[0] and t["0"] denote different entries in a table.

The operator ~= is exactly the negation of equality (==).

The order operators work as follows. If both arguments are numbers, then they are compared as such. Otherwise, if both arguments are strings, then their values are compared according to the current locale. Otherwise, Lua tries to call the “lt” or the “le” metamethod (see §2.8). A comparison a > b is translated to b < a and a >= b is translated to b <= a.

2.5.3 – Logical Operators

The logical operators in Lua are and, or, and not. Like the control structures (see §2.4.4), all logical operators consider both false and nil as false and anything else as true.

The negation operator not always returns false or true.

The conjunction operator and returns its first argument if this value is false or nil; otherwise, and returns its second argument. 【0&0=0, 0&1=0】

The disjunction operator or returns its first argument if this value is different from nil and false; otherwise, or returns its second argument. 【1|0=1, 1|1=1, 0|0=0, 0|1=1】

Both and and or use short-cut evaluation; that is, the second operand is evaluated only if necessary. Here are some examples:

     10 or 20            --> 1010 or error()       --> 10nil or "a"          --> "a"nil and 10          --> nilfalse and error()   --> falsefalse and nil       --> falsefalse or nil        --> nil10 and 20           --> 20

(In this manual, --> indicates the result of the preceding expression.)

2.5.4 – Concatenation

The string concatenation operator in Lua is denoted by two dots (‘..’). If both operands are strings or numbers, then they are converted to strings according to the rules mentioned in §2.2.1. Otherwise, the “concat” metamethod is called (see §2.8).

2.5.5 – The Length Operator

The length operator is denoted by the unary operator #. The length of a string is its number of bytes (that is, the usual meaning of string length when each character is one byte).

The length of a table t is defined to be any integer index n such that t[n] is not nil and t[n+1] is nil; moreover, if t[1] is nil, n can be zero.

For a regular array, with non-nil values from 1 to a given n, its length is exactly that n, the index of its last value. If the array has “holes” (that is, nil values between other non-nil values), then #t can be any of the indices that directly precedes a nil value (that is, it may consider any such nil value as the end of the array).

补充:If you really need to handle arrays with holes up to their last index, you can use the function table.maxn, which returns the largest numerical positive index of a table.

The length operator provides several common Lua idioms:

print(a[#a]) -- prints the last value of list ’a’
a[#a] = nil -- removes this last value
a[#a+1] = v -- appends ’v’ to the end of the list  

例子:从标准输入读取10行数据

a = {}
for i=1,10 doa[#a+1] = io.read()
end

例子:

t = {}
t[10000] = 1
print(#t) -- 长度为0,因为t[1]为nilt = {}
t[1] = 1
t[2] = 1
t[3] = 1t[10000] = 1
print(#t) -- 长度为3print(table.maxn(t)) -- 输出 10000

2.5.6 – Precedence

Operator precedence in Lua follows the table below, from lower to higher priority:

     orand<     >     <=    >=    ~=    ==..+     -*     /     %not   #     - (unary)^

As usual, you can use parentheses to change the precedences of an expression. The concatenation (‘..’) and exponentiation (‘^’) operators are right associative. All other binary operators are left associative.

例子:^ 和 … 的右结合性

print(2^2^3) -- 2^(2^3) 而不是(2^2)^3print("a" .. "b" .. "c") -- "a" .. ("b" .. "c") 而不是 ("a" .. "b") .. "c"

补充:

Therefore, the following expressions on the left are equivalent to those on the right:

a+i < b/2+1 <--> (a+i) < ((b/2)+1)
5+x^2*8 <--> 5+((x^2)*8)
a < y and y <= z <--> (a < y) and (y <= z)
-x^2 <--> -(x^2)
x^y^z <--> x^(y^z)

When in doubt, always use explicit parentheses.

2.5.7 – Table Constructors

Table constructors are expressions that create tables. Every time a constructor is evaluated, a new table is created. A constructor can be used to create an empty table or to create a table and initialize some of its fields. The general syntax for constructors is

	tableconstructor ::= `{´ [fieldlist] `}´fieldlist ::= field {fieldsep field} [fieldsep]field ::= `[´ exp `]´ `=´ exp | Name `=´ exp | expfieldsep ::= `,´ | `;´

Each field of the form [exp1] = exp2 adds to the new table an entry with key exp1 and value exp2. A field of the form name = exp is equivalent to ["name"] = exp. Finally, fields of the form exp are equivalent to [i] = exp, where i are consecutive numerical integers, starting with 1. Fields in the other formats do not affect this counting.

For example,

     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }

is equivalent to

     dolocal t = {}t[f(1)] = gt[1] = "x"         -- 1st expt[2] = "y"         -- 2nd expt.x = 1            -- t["x"] = 1t[3] = f(x)        -- 3rd expt[30] = 23t[4] = 45          -- 4th expa = tend

If the last field in the list has the form exp and the expression is a function call or a vararg expression, then all values returned by this expression enter the list consecutively (see §2.5.8). To avoid this, enclose the function call or the vararg expression in parentheses (see §2.5).

The field list can have an optional trailing separator, as a convenience for machine-generated code.

2.5.8 – Function Calls

A function call in Lua has the following syntax:

	functioncall ::= prefixexp argsprefixexp ::= var | functioncall | `(´ exp `)´

In a function call, first prefixexp and args are evaluated. If the value of prefixexp has type function, then this function is called with the given arguments. Otherwise, the prefixexp “call” metamethod is called, having as first parameter the value of prefixexp, followed by the original call arguments (see §2.8).

The form

	functioncall ::= prefixexp `:´ Name args

can be used to call “methods”. A call v:name(args) is syntactic sugar for v.name(v,args), except that v is evaluated only once.

Arguments have the following syntax:

	args ::= `(´ [explist] `)´args ::= tableconstructorargs ::= String

All argument expressions are evaluated before the call.

A call of the form f{fields} is syntactic sugar for f({fields}); that is, the argument list is a single new table.

A call of the form f'string' (or f"string" or f[[string]]) is syntactic sugar for f('string'); that is, the argument list is a single literal string.

例子:函数参数语法的三种形式

function foo(a)print(a)
endfoo(1)   -- 1foo"abc" -- abcfoo{1,2,3} -- table: ...

As an exception to the free-format syntax of Lua, you cannot put a line break before the ‘(’ in a function call. This restriction avoids some ambiguities in the language. If you write

     a = f(g).x(a)

Lua would see that as a single statement, a = f(g).x(a). So, if you want two statements, you must add a semi-colon between them. If you actually want to call f, you must remove the line break before (g).

A call of the form return functioncall is called a tail call. Lua implements proper tail calls (or proper tail recursion): in a tail call, the called function reuses the stack entry of the calling function. Therefore, there is no limit on the number of nested tail calls that a program can execute. However, a tail call erases any debug information about the calling function.

Note that a tail call only happens with a particular syntax, where the return has one single function call as argument; this syntax makes the calling function return exactly the returns of the called function. So, none of the following examples are tail calls:

     return (f(x))        -- results adjusted to 1return 2 * f(x)return x, f(x)       -- additional resultsf(x); return         -- results discardedreturn x or f(x)     -- results adjusted to 1

2.5.9 – Function Definitions

The syntax for function definition is

	function ::= function funcbodyfuncbody ::= `(´ [parlist] `)´ block end

The following syntactic sugar simplifies function definitions:

	stat ::= function funcname funcbodystat ::= local function Name funcbodyfuncname ::= Name {`.´ Name} [`:´ Name]

The statement

     function f () body end

translates to

     f = function () body end

The statement

     function t.a.b.c.f () body end

translates to

     t.a.b.c.f = function () body end

The statement

     local function f () body end

translates to

     local f; f = function () body end

not to

     local f = function () body end

(This only makes a difference when the body of the function contains references to f.)

补充:So, we can use this syntax for recursive functions without worrying:

local function fact (n)if n == 0 then return 1else return n*fact(n-1)end
end  

A function definition is an executable expression, whose value has type function.

When Lua pre-compiles a chunk, all its function bodies are pre-compiled too. Then, whenever Lua executes the function definition, the function is instantiated (or closed). This function instance (or closure) is the final value of the expression. Different instances of the same function can refer to different external local variables and can have different environment tables.


补充:When a function is written enclosed in another function, it has full access to local variables from the enclosing function; this feature is called lexical scoping.

例子:闭包

names = {"Peter", "Paul", "Mary"}
grades = {Mary = 10, Paul = 7, Peter = 8}function sortbygrade (names, grades)table.sort(names, function (n1, n2)return grades[n1] > grades[n2] -- compare the gradesend)
endsortbygrade(names, grades)for _, v in ipairs(names) doprint(v)
end

The interesting point in the example is that the anonymous function given to sort accesses the parameter grades, which is local to the enclosing function sortbygrade. Inside this anonymous function, grades is neither a global variable nor a local variable, but what we call a non-local variable. (For historical reasons, non-local variables are also called upvalues in Lua.)

例子:使用闭包实现计数器

function newCounter ()local i = 0return function () -- anonymous functioni = i + 1return iend
endc1 = newCounter()
print(c1()) --> 1
print(c1()) --> 2c2 = newCounter()
print(c2()) --> 1
print(c1()) --> 3
print(c2()) --> 2

In this code, the anonymous function refers to a non-local variable, i, to keep its counter. However, by the time we call the anonymous function, i is already out of scope, because the function that created this variable (newCounter) has returned. Nevertheless, Lua handles this situation correctly, using the concept of closure. Simply put, a closure is a function plus all it needs to access nonlocal variables correctly.

Technically speaking, what is a value in Lua is the closure, not the function. The function itself is just a prototype for closures. Nevertheless, we will continue to use the term “function” to refer to a closure whenever there is no possibility of confusion.


Parameters act as local variables that are initialized with the argument values:

	parlist ::= namelist [`,´ `...´] | `...´

When a function is called, the list of arguments is adjusted to the length of the list of parameters, unless the function is a variadic or vararg function, which is indicated by three dots (‘...’) at the end of its parameter list.

A vararg function does not adjust its argument list; instead, it collects all extra arguments and supplies them to the function through a vararg expression, which is also written as three dots. The value of this expression is a list of all actual extra arguments, similar to a function with multiple results.

If a vararg expression is used inside another expression or in the middle of a list of expressions, then its return list is adjusted to one element. If the expression is used as the last element of a list of expressions, then no adjustment is made (unless that last expression is enclosed in parentheses).

As an example, consider the following definitions:

     function f(a, b) endfunction g(a, b, ...) endfunction r() return 1,2,3 end

Then, we have the following mapping from arguments to parameters and to the vararg expression:

     CALL            PARAMETERSf(3)             a=3, b=nilf(3, 4)          a=3, b=4f(3, 4, 5)       a=3, b=4f(r(), 10)       a=1, b=10f(r())           a=1, b=2g(3)             a=3, b=nil, ... -->  (nothing)g(3, 4)          a=3, b=4,   ... -->  (nothing)g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8g(5, r())        a=5, b=1,   ... -->  2  3

Results are returned using the return statement (see §2.4.4). If control reaches the end of a function without encountering a return statement, then the function returns with no results.

The colon syntax is used for defining methods, that is, functions that have an implicit extra parameter self. Thus, the statement

     function t.a.b.c:f (params) body end

is syntactic sugar for

     t.a.b.c.f = function (self, params) body end

2.6 – Visibility Rules

Lua is a lexically scoped language. The scope of variables begins at the first statement after their declaration and lasts until the end of the innermost block that includes the declaration. Consider the following example:

     x = 10                -- global variabledo                    -- new blocklocal x = x         -- new 'x', with value 10print(x)            --> 10x = x+1do                  -- another blocklocal x = x+1     -- another 'x'print(x)          --> 12endprint(x)            --> 11endprint(x)              --> 10  (the global one)

Notice that, in a declaration like local x = x, the new x being declared is not in scope yet, and so the second x refers to the outside variable.

Because of the lexical scoping rules, local variables can be freely accessed by functions defined inside their scope. A local variable used by an inner function is called an upvalue, or external local variable, inside the inner function.

Notice that each execution of a local statement defines new local variables. Consider the following example:

     a = {}local x = 20for i=1,10 dolocal y = 0a[i] = function () y=y+1; return x+y endend

The loop creates ten closures (that is, ten instances of the anonymous function). Each of these closures uses a different y variable, while all of them share the same x.

相关文章:

跟着 Lua 5.1 官方参考文档学习 Lua (3)

文章目录 2.5 – Expressions2.5.1 – Arithmetic Operators2.5.2 – Relational Operators2.5.3 – Logical Operators2.5.4 – Concatenation2.5.5 – The Length Operator2.5.6 – Precedence2.5.7 – Table Constructors2.5.8 – Function Calls2.5.9 – Function Definiti…...

ORM框架详解:为什么不直接写SQL?

想象一下&#xff0c;你正在开发一个小型的在线书店应用。你需要存储书籍信息、用户数据和订单记录。作为一个初学者&#xff0c;你可能会想&#xff1a;“我已经学会了SQL&#xff0c;为什么还要使用ORM框架呢&#xff1f;直接写SQL语句不是更简单、更直接吗&#xff1f;” 如…...

【Server Components 解析:Next.js 的未来组件模型】

&#x1f6e0;️ Server Components 解析&#xff1a;Next.js 的未来组件模型 本文将用 3000 字 &#xff0c;带你彻底掌握 React Server Components 的核心原理与实战技巧。无论你是刚接触 Next.js 的新手&#xff0c;还是想优化现有项目的老手&#xff0c;这里都有你需要的关…...

2025最新智能优化算法:改进型雪雁算法(Improved Snow Geese Algorithm, ISGA)求解23个经典函数测试集,MATLAB

一、改进型雪雁算法 雪雁算法&#xff08;Snow Geese Algorithm&#xff0c;SGA&#xff09;是2024年提出的一种新型元启发式算法&#xff0c;其灵感来源于雪雁的迁徙行为&#xff0c;特别是它们在迁徙过程中形成的独特“人字形”和“直线”飞行模式。该算法通过模拟雪雁的飞行…...

基于spring boot物流管理系统设计与实现(代码+数据库+LW)

摘 要 社会发展日新月异&#xff0c;用计算机应用实现数据管理功能已经算是很完善的了&#xff0c;但是随着移动互联网的到来&#xff0c;处理信息不再受制于地理位置的限制&#xff0c;处理信息及时高效&#xff0c;备受人们的喜爱。本次开发一套物流管理系统有管理员和用户…...

HTTP 和RESTful API 基础,答疑

一文搞懂RESTful API - bigsai - 博客园 1. API 路径 开头必须 /&#xff0c;表示绝对路径&#xff0c;不支持 . 或 ..&#xff08;相对路径&#xff09;。API 结尾 / 通常不需要&#xff0c;但部分框架会自动处理 / → 无 /。 ✅ 推荐 GET /api/v1/products # 资源集合…...

【数据挖掘】深度挖掘

【数据挖掘】深度挖掘 目录&#xff1a;1. 减少样本集的数量知识点示例 2. 对噪声比集剪枝知识点示例建立局部树代码示例&#xff08;使用 Python 和 scikit - learn 库构建局部决策树&#xff09;代码解释注意事项 最大超平面定义原理求解方法代码示例&#xff08;使用 Python…...

OpenGL(2)基于Qt做OpenGL开发

文章目录 一、基于Qt做OpenGL开发1、环境准备2、创建OpenGL窗口3、绘制基本图形 一、基于Qt做OpenGL开发 1、环境准备 确保你已经安装了 Qt 开发环境&#xff08;包含 Qt Creator&#xff09;&#xff0c;并且支持 OpenGL 开发。在创建 Qt 项目时&#xff0c;选择 “Qt Widget…...

使用JWT实现微服务鉴权

目录 一、微服务鉴权 1、思路分析 2、系统微服务签发token 3、网关过滤器验证token 4、测试鉴权功能 前言&#xff1a; 随着微服务架构的广泛应用&#xff0c;服务间的鉴权与安全通信成为系统设计的核心挑战之一。传统的集中式会话管理在分布式场景下面临性能瓶颈和扩展性…...

高并发内存池项目介绍

&#x1f493;博主CSDN主页&#xff1a;Am心若依旧409-CSDN博客&#x1f493; ⏩专栏分类:项目记录_⏪ &#x1f69a;代码仓库&#xff1a;青酒余成 &#x1f69a;   &#x1f339;关注我&#x1faf5;带你学习C   &#x1f51d;&#x1f51d; 1.前言 在经历一年多左右的时间…...

PHP会务会议系统小程序源码

&#x1f4c5; 会务会议系统 一款基于ThinkPHPUniapp框架&#xff0c;精心雕琢的会议管理微信小程序&#xff0c;专为各类高端会议场景量身打造。它犹如一把开启智慧殿堂的金钥匙&#xff0c;为会议流程优化、开支精细化管理、数量精准控制、标准严格设定以及供应商严格筛选等…...

Java中的常用类 --String

学习目标 掌握String常用方法掌握StringBuilder、StringBuffer了解正则 1.String ● String是JDK中提前定义好的类型 其所在的包是java.lang ,String翻译过来表示字符串类型&#xff0c;也就是说String类中已经提前定义好了很多方法都是用来处理字符串的&#xff0c;所以Str…...

PWM(脉宽调制)技术详解:从基础到应用实践示例

PWM&#xff08;脉宽调制&#xff09;技术详解&#xff1a;从基础到应用实践示例 目录 PWM&#xff08;脉宽调制&#xff09;技术详解&#xff1a;从基础到应用实践示例学前思考&#xff1a;一、PWM概述二、PWM的基本原理三、PWM的应用场景四、PWM的硬件配置与使用五、PWM的编程…...

Hutool - DB 连接池配置集成

在实际开发中&#xff0c;尤其是在高并发场景下&#xff0c;使用连接池来管理数据库连接是非常必要的&#xff0c;它可以显著提高数据库操作的性能和效率。Hutool - DB 支持集成多种常见的连接池&#xff0c;如 HikariCP、Druid 等。下面分别介绍如何将这两种连接池集成到 Huto…...

激光工控机在自动化生产线中有什么关键作用?

激光工控机作为自动化生产线的核心设备&#xff0c;通过高精度控制、快速响应和智能化集成&#xff0c;在提升效率、保障质量、实现柔性制造等方面发挥着不可替代的作用。以下是其关键作用的具体分析&#xff1a; 一、实现高效连续生产&#xff1a; 1.高速加工能力&#xff1…...

Visual Studio Code的下载安装与汉化

1.下载安装 Visual Studio Code的下载安装十分简单&#xff0c;在本电脑的应用商店直接下载安装----注意这是社区版-----一般社区版就足够用了---另外注意更改安装地址 2.下载插件 重启后就是中文版本了...

nlp|微调大语言模型初探索(3),qlora微调deepseek记录

前言 上篇文章记录了使用lora微调llama-1b,微调成功,但是微调llama-8b显存爆炸,这次尝试使用qlora来尝试微调参数体量更大的大语言模型,看看64G显存的极限在哪里。 1.Why QLora? QLoRA 在模型加载阶段通过 4-bit 量化大幅减少了模型权重的显存占用。QLoRA 通过 反量化到 …...

【全栈】SprintBoot+vue3迷你商城-细节解析(1):Token、Jwt令牌、Redis、ThreadLocal变量

【全栈】SprintBootvue3迷你商城-细节解析&#xff08;1&#xff09;&#xff1a;Token、Jwt令牌、Redis、ThreadLocal变量 往期的文章都在这里啦&#xff0c;大家有兴趣可以看一下 后端部分&#xff1a; 【全栈】SprintBootvue3迷你商城&#xff08;1&#xff09; 【全栈】…...

基于ffmpeg+openGL ES实现的视频编辑工具(一)

在深入钻研音视频编辑开发这片技术海洋时&#xff0c;相信不少开发者都和我有同样的感受&#xff1a;网络上关于音视频编辑工具实现的资料繁多&#xff0c;理论阐释细致入微&#xff0c;代码片段也随处可见。然而&#xff0c;一个显著的缺憾是&#xff0c;缺乏一个完整成型的 A…...

面试完整回答:SQL 分页查询中 limit 500000,10和 limit 10 速度一样快吗?

首先&#xff1a;在 SQL 分页查询中&#xff0c;LIMIT 500000, 10 和 LIMIT 10 的速度不会一样快&#xff0c;以下是原因和优化建议&#xff1a; 性能差异的原因 LIMIT 10&#xff1a; 只需要扫描前 10 条记录&#xff0c;然后返回结果。 性能非常高&#xff0c;因为数据库只…...

NVSentinel:Kubernetes AI集群的智能健康管理方案

1. 项目概述&#xff1a;NVSentinel 如何为 Kubernetes AI 集群提供智能健康管理在当今AI驱动的生产环境中&#xff0c;Kubernetes已成为GPU工作负载的事实标准平台。然而&#xff0c;管理这些集群中的GPU节点绝非易事——从确保训练任务持续进展到维持服务流量稳定&#xff0c…...

这些AI编曲软件到底强在哪,2026年度甄选5款AI编曲软件汇总,高质量助力音乐人制作编曲伴奏

在当今音乐创作领域&#xff0c;AI技术正逐渐崭露头角。传统的音乐编曲创作过程往往需要音乐人具备深厚的乐理知识和熟练掌握复杂的编曲软件操作技巧&#xff0c;这对于很多有创作想法但缺乏专业知识的人来说&#xff0c;无疑是一道难以跨越的门槛。而且创作过程耗时费力&#…...

为什么92%的AI PoC项目因容器隔离失效被叫停?Docker Sandbox 6步硬核配置手册(含GPU透传避坑指南)

更多请点击&#xff1a; https://intelliparadigm.com 第一章&#xff1a;Docker Sandbox 运行 AI 代码隔离技术配置总览 Docker Sandbox 是一种轻量级、可复现的容器化运行环境&#xff0c;专为安全执行第三方 AI 代码而设计。它通过命名空间&#xff08;namespaces&#xff…...

Akagi麻雀助手:终极指南 - 如何用AI提升你的雀魂麻将水平

Akagi麻雀助手&#xff1a;终极指南 - 如何用AI提升你的雀魂麻将水平 【免费下载链接】Akagi 支持雀魂、天鳳、麻雀一番街、天月麻將&#xff0c;能夠使用自定義的AI模型實時分析對局並給出建議&#xff0c;內建Mortal AI作為示例。 Supports Majsoul, Tenhou, Riichi City, Am…...

【MCP 2026医疗脱敏权威指南】:覆盖12类敏感字段、7大合规基线与3种动态策略配置实操手册

更多请点击&#xff1a; https://intelliparadigm.com 第一章&#xff1a;MCP 2026医疗脱敏规范演进与核心定位 MCP&#xff08;Medical Confidentiality Protocol&#xff09;2026 是中国信通院联合国家卫健委信息标准委员会于2024年Q4正式立项、2026年1月起强制实施的医疗数…...

Elasticsearch 客户端连接与节点选择机制深度解析:从 TransportClient 到高级负载均衡

Elasticsearch 客户端连接与节点选择机制深度解析&#xff1a;从 TransportClient 到高级负载均衡前言一、客户端与集群的连接模型概述1.1 两种连接角色1.2 连接阶段模型二、TransportClient&#xff08;传统方式&#xff0c;已废弃&#xff09;2.1 TransportClient 架构2.2 核…...

让Python三维数据可视化变得简单有趣:PyVista入门指南

让Python三维数据可视化变得简单有趣&#xff1a;PyVista入门指南 【免费下载链接】pyvista 3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK) 项目地址: https://gitcode.com/gh_mirrors/py/pyvista 还在为复杂的三…...

别再只用ffill了!用openpyxl预处理Excel合并单元格,让Pandas读取数据更准更稳

告别粗暴填充&#xff1a;用openpyxl精准拆解Excel合并单元格的进阶指南 每次看到同事用df[班级] df[班级].ffill()处理合并单元格时&#xff0c;我的手指都会不自觉地抽搐——这就像用锤子做心脏手术&#xff0c;简单粗暴却隐患无穷。上周团队就因此闹出笑话&#xff1a;把市…...

VinXiangQi:基于深度学习的智能象棋AI连线工具

VinXiangQi&#xff1a;基于深度学习的智能象棋AI连线工具 【免费下载链接】VinXiangQi Xiangqi syncing tool based on Yolov5 / 基于Yolov5的中国象棋连线工具 项目地址: https://gitcode.com/gh_mirrors/vi/VinXiangQi VinXiangQi是一款创新的开源象棋AI连线工具&…...

基于反思工作流的智能翻译代理:原理、实践与定制化应用

1. 项目概述&#xff1a;一个基于反思工作流的智能翻译代理最近在GitHub上看到一个挺有意思的项目&#xff0c;叫translation-agent&#xff0c;是吴恩达&#xff08;Andrew Ng&#xff09;团队开源的一个实验性项目。简单来说&#xff0c;它不是传统的“输入-输出”式机器翻译…...