Ad

Wednesday, March 13, 2019

Flatten, Reshape, and Squeeze Explained - Tensors for Deep Learning with...





Matrix is a rank 2 tensor. There are two axis one is an array, one is individual numbers.
Check the dimensions of tensors using .size() or .shape()
Obtain the rank of the tensor by checking the length of its shape
len(tensor.shape) #returns 2 for matrix
number of elements in the tensor, is the product of the component values in the shape torch.tensor(my_tensor.shape).prod()
my_tensor.numel() #number of elements
number of elements is important in reshaping
reshaping does not change underlining data just change the shape

3 comments:


  1. Thanks to visit here.

    When you shop jewelry online at QVC, you'll discover a huge assortment of women's jewelry, including fine and fashion rings, bracelets, necklaces, earrings, charms, pendants, and pins. You'll find fabulous women's jewelry designs in 14K and 18K gold, sterling silver, stainless ...

    For shopping click hehe Jewelry shop

    ReplyDelete
  2. Great Post!
    Thanks a lot for sharing!
    I found this blog to be very useful!!
    Software Testing training in Bangalore

    ReplyDelete

Understand the Softmax Function in Minutes

Reposted from Uniqtech's Medium publication with permission. This is retrieved on May 14 2019. Uniqtech may have a newer version. Unde...