PyTorch Tensor Methods – How to Create Tensors in Python

By freeCodeCamp.org - 2020-12-03

Description

PyTorch is an open-source Python-based library. It provides high flexibility and speed while building, training, and deploying deep learning models. At its core, PyTorch involves operations involving ...

Summary

  • PyTorch is an open-source Python-based library.
  • Like zeros(), passing an empty tuple or list gives a tensor of 0 dimension, having 1 as the sole element, whose data type is float.
  • The linspace() method This method returns a 1-D dimensional tensor, with elements from start (inclusive) to end (inclusive).
  • The eye() method This method returns a 2-D tensor with ones on the diagonal and zeros elsewhere.

 

Topics

  1. Backend (0.13)
  2. Machine_Learning (0.12)
  3. Stock (0.11)

Similar Articles

NoSQL: Updating Data In A MongoDB Database

By Code Wall - 2019-02-10

In this last article about MongoDB, we are going to complete our knowledge about how to write queries using this technology. In particular, we are going to focus on how […]

Python enumerate(): Simplify Looping With Counters

By realpython - 2020-12-15

Once you learn about for loops in Python, you know that using an index to access items in a sequence isn't very Pythonic. So what do you do when you need that index value? In this tutorial, you'll lea ...