The goal of this blog is to introduce the introduction of torch
Bloggers use the Itorch interface to write, the following images to show the code.
If you can't remember the name of the method can be in the Itorch Point "tab" key will have intelligent input, similar to MATLAB
- Simple Introduction to String,numbers,tables
The action of the string is a single quotation mark, and then the print () function in the second row is a bit like the cout in C + +, which can be displayed according to the type of input to be printed, the input string, followed by input to other data formats. Because the torch is interactive, and Matlab very much like so directly hit a can also show the output.
B is to declare an array type that is similar to an array, without assigning an initial value that appears empty when printed.
Assign a value to the array, the first array element is the string A, the second is integer 30, the same call to print () and a direct hit B, printing the same effect. It is important to note that the output here is printed together with the array sequence number and the set element.
Then take a look at a simple loop, this is the LUA array for loop, in the "#" to add the loop to use the array name, the default is the form of i++ loop, can be changed to i = i + 2 or other forms, concrete see experience
This is not a two-time printing element, so the first array element "Hello" and the third one should be printed, but the array has no third so the result is as
The above two graphs, should be able to better explain the cycle
Torch Deep Learning Tutorial (i)