Torch7 Deep Learning Tutorial (iii)

Source: Internet
Author: User
  • Use of functions

    This is the definition of the function, the declaration of the keyword + defined function name + the name of the formal parameter, the blogger returns two values, the function of the specific functions in the back again

    This is the initialization of a 5x2 matrix, and the initial value is 1. Here's a way to initialize the matrix.

    This is to declare a 2x5 matrix before calling the fill () method whose values are all initialized to 4.

    Input a A A, a matrix into the addtensors function, note that here is the argument, the previous definition of a, B is a formal parameter, this is a bit C base should be divided into clear it. The printed result is a matrix that returns a matrix and AXB.

    This kind of writing is more like Matlab, and the returned a and AXB are assigned to c,d in order.

  • Cuda's tensor

    Sorry, my computer is not Nvidia's video card, here to fill it up later, do not see the results of the operation


Here is to call the Cuda () function, and then calculate the AXB matrix of the flight operation on it. The beginning of the Require ' Cutorch ' is the import Cuda operation package, similar to the C language include.

Next chapter, Getting started with the topic-Neural network

Torch7 Deep Learning Tutorial (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.