lua 是动态类型语言吗?

Is lua a dynamically typed language?

lua 是动态类型语言吗?

如果是,为什么normal Tensor和CudaTensor有区别?

例如:

a = torch.Tensor(5,5):zero() 

b = torch.CudaTensor(5,5):zero()

https://www.lua.org/manual/5.3/manual.html#2.1

第 2 章:基本概念

2.1 值和类型:

Lua is a dynamically typed language. This means that variables do not have types; only values do. There are no type definitions in the language. All values carry their own type.

Tensor 和 CudaTensor 与 Lua 无关。顺便说一句,它们是第三方库 Torch 的一部分。我还没有使用过火炬,但 torch.Tensor 很可能是 Lua table 或用户数据。

不过,Torch 可能会提供自己的 type() 函数来模拟更多 "types"。