Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is lua a dynamically typed language?

Tags:

types

torch

lua

Is lua a dynamically typed language?

If it is, why is there a difference between normal Tensor and CudaTensor?

For example:

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

and

b = torch.CudaTensor(5,5):zero()
like image 222
Collin HU Avatar asked Sep 21 '26 02:09

Collin HU


1 Answers

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

Chapter 2: Basic Concepts:

2.1 Values and Types:

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 and CudaTensor have nothing to do with Lua btw.. They're part of the third party library Torch. I haven't worked with torch yet but a torch.Tensor is most likely a Lua table or userdata.

Torch may provide it's own type() function to emulate more "types" though.

like image 130
Piglet Avatar answered Sep 23 '26 21:09

Piglet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!