Complete Pytorch Tensor Tutorial (Initializing Tensors, Math, Indexing, Reshaping)

Поділитися
Вставка
  • Опубліковано 21 лип 2024
  • In this tutorial we go through the basics you need to know about the basics of tensors and a lot of useful tensor operations. I believe knowing about these operations are an essential part of Pytorch and is a foundation that will help as you go further in your deep learning journey. Pytorch is in many ways an extension of NumPy with the ability to work on the GPU and these operations are very similar to what you would see in NumPy so knowing this will also allow you to quicker learn NumPy in the future.
    ❤️ Support the channel ❤️
    / @aladdinpersson
    Paid Courses I recommend for learning (affiliate links, no extra cost for you):
    ⭐ Machine Learning Specialization bit.ly/3hjTBBt
    ⭐ Deep Learning Specialization bit.ly/3YcUkoI
    📘 MLOps Specialization bit.ly/3wibaWy
    📘 GAN Specialization bit.ly/3FmnZDl
    📘 NLP Specialization bit.ly/3GXoQuP
    ✨ Free Resources that are great:
    NLP: web.stanford.edu/class/cs224n/
    CV: cs231n.stanford.edu/
    Deployment: fullstackdeeplearning.com/
    FastAI: www.fast.ai/
    💻 My Deep Learning Setup and Recording Setup:
    www.amazon.com/shop/aladdinpe...
    GitHub Repository:
    github.com/aladdinpersson/Mac...
    ✅ One-Time Donations:
    Paypal: bit.ly/3buoRYH
    ▶️ You Can Connect with me on:
    Twitter - / aladdinpersson
    LinkedIn - / aladdin-persson-a95384153
    Github - github.com/aladdinpersson
    OUTLINE
    0:00 - Introduction
    1:26 - Initializing a Tensor
    12:30 - Converting between tensor types
    15:10 - Array to Tensor Conversion
    16:26 - Tensor Math
    26:35 - Broadcasting Example
    28:38 - Useful Tensor Math operations
    35:15 - Tensor Indexing
    45:05 - Tensor Reshaping Dimensions (view, reshape, etc)
    54:45 - Ending words

КОМЕНТАРІ • 95

  • @zahraanvari5726
    @zahraanvari5726 3 роки тому +5

    Very detailed, structured and helpful video! Thank you so much!

  • @sayfriends87
    @sayfriends87 3 роки тому +2

    It's an awesome video series!
    I will definitely watch all videos of this course.
    Thanks a lot! :)

  • @mamotivated
    @mamotivated 3 роки тому +5

    This was a solid video and I am happy to have watched it before diving into other stuff.

  • @sebi_alo
    @sebi_alo 2 роки тому +4

    I'm italian and I was able to follow the entire tutorial without subtitle. Very very clear. This video is brilliant

  • @anshulthakur3806
    @anshulthakur3806 3 роки тому +2

    This tutorial is really useful. Great explanation in tutorial with covering every important aspect related to pytorch tensor basics in one video. Thanks a lot.😀

  • @anantdev2766
    @anantdev2766 3 роки тому +3

    This tutorial is clearly best on the internet!!

  • @maryfrancesgleason9415
    @maryfrancesgleason9415 2 місяці тому

    Absolutely the best intro video to Pytorch tensor operations on the internet. Comprehensive, clear, to-the-point. Well done Aladdin! Note to UA-cam search algorithm: rank this first.

  • @daiversetech8000
    @daiversetech8000 2 роки тому

    I really like the way you deliver the intuition along with the syntax. Great content....

  • @vaisuliafu3342
    @vaisuliafu3342 3 роки тому +1

    Great video, will be passing this onto to others as well. Cheers!

  • @rahulseetharaman4525
    @rahulseetharaman4525 4 роки тому +2

    Really comprehensive and imo one of the best video tutorials for pytorch on youtube.

    • @AladdinPersson
      @AladdinPersson  4 роки тому +1

      Really appreciate you saying that, thank you!

  • @YTian-xg2cz
    @YTian-xg2cz 3 роки тому +1

    Thanks so much! Just cannot stop watching!

  • @kiranraghavendra481
    @kiranraghavendra481 3 роки тому +3

    This has been reallyyyy useful. Thank you and keep up the good work man!!!

  • @paulntalo1425
    @paulntalo1425 2 роки тому

    Am very grateful for this resource. compact and easy to understand in one go. Thank you

  • @dushansilva1
    @dushansilva1 3 роки тому

    This was really awesome! helped me understand the basics :) thanks!

  • @ashfakyeafi2702
    @ashfakyeafi2702 2 роки тому

    i am new to pytorch. This video is a great practical example of tensor. thanks for making this.

  • @codewithyouml8994
    @codewithyouml8994 3 роки тому

    I have completed the full video, in order to see the full stuffs, as they are really needed. The videos are awesome, now its time to make the hands dirty with ur neural nets playlist. Cheers

  • @saravanannatarajan6515
    @saravanannatarajan6515 2 роки тому

    Great tutorial, nice content and flow. Highly recommend for beginners.

  • @uxirofkgor
    @uxirofkgor 2 роки тому

    best. gonna finish this course within 1 month. Thx for ur video mate.

  • @rohitkukreja8704
    @rohitkukreja8704 3 роки тому +1

    I Cannot thank you enough friend, You deserve a lot lot success, to me you are anyway more successful than most of the people on UA-cam, God Bless you bro !!
    Keep working on Amazing Stuff.
    Your Yolo Video is Amazing.
    Loved your work.

    • @AladdinPersson
      @AladdinPersson  3 роки тому +1

      Thanks a lot for your kind words friend 🙏

  • @x2t2cx
    @x2t2cx 2 роки тому

    Exactly what I was looking for, thanks.

  • @yee-seng-chan
    @yee-seng-chan 3 роки тому +16

    This is like a Tensor cheat sheet. Often we just learn about the tensor operations that we encounter in practice, and this is a very nice and concise summary!

  • @1chimaruGin0_0
    @1chimaruGin0_0 4 роки тому

    It was simple but effective. Thank you sir

  • @yixianwang863
    @yixianwang863 3 роки тому

    Great video! Thank you!

  • @jianweitang4790
    @jianweitang4790 4 роки тому +7

    Thank you for your videos. I've been confused about 'bmm' untill you tell it is the abbreivation of 'batch matrix multiplication' XD. I did not get bored at all even it is an 1 hour video. I like this tutorial and it can be good prerequisite for future advanced videos. I would like to see more videos about NLP tasks like NER and sentiment analysis using BERT/Transformers in the future. Videos of coding show the process of your thinking, and you've done good explanations. I learn a lot from them. Thank you.

    • @AladdinPersson
      @AladdinPersson  4 роки тому +3

      Haha yeah bmm is definitely confusing but when you understand it it's quite a simple operation really! I appreciate you saying that, the video can be perceived incredibly information heavy but I guess that doesn't always correlate with boring. I definitely think understanding tensor operations should be seen as a prerequisite for more advanced concepts because we use these operations all the time. Will try to do videos on those topics in the future I'm sure, thanks for the comment :)

  • @devnull711
    @devnull711 10 місяців тому

    Great work, thank you!

  • @kiddliu3767
    @kiddliu3767 3 роки тому

    Nice video!! Learn a lot from this, and I notice that you have code completation for squeeze() and unsqueeze() which dose not work in my pycharm, do I need some extra pulgin or sepcific settings?

  • @jayvnathan6496
    @jayvnathan6496 3 роки тому

    Thank you Aladdin. Great video series, extremely valuable. I wish you success in all of your endeavors. God bless you my friend.

  • @ragibshahriar187
    @ragibshahriar187 3 роки тому

    Very clear video!

  • @anmolgautam9572
    @anmolgautam9572 3 роки тому

    Thank You for the lesson .

  • @chientruong926
    @chientruong926 3 роки тому

    Thank you so much for your great video!!!

  • @emrulhasan5646
    @emrulhasan5646 2 роки тому

    This is an amazing tutorial on tensor operation. Thank you very much. Can you make a video on Huggingface?

  • @gsaidheeraj2229
    @gsaidheeraj2229 2 роки тому

    Nice Work, Thanks bro.

  • @minasoftware
    @minasoftware Рік тому

    thank you, great content.

  • @heyman620
    @heyman620 3 роки тому

    You should talk more about mm vs dot.
    Great video :)

  • @hrithicksen3644
    @hrithicksen3644 3 роки тому

    Kudos for your effort

  • @euphoriess
    @euphoriess 2 роки тому +1

    nice video
    when making example of diag(), I think you can use something like this
    x = torch.diag(torch.rand(3))
    so the viewer will not confuse with eye()

  • @devk6177
    @devk6177 3 роки тому

    Great video series, following it to brush up pytorch coding. Could you provide an example of how the max,sum,min etc. will work for a 3 dimensional tensor?

    • @devk6177
      @devk6177 3 роки тому

      This article explains it clearly for 3d tensors towardsdatascience.com/understanding-dimensions-in-pytorch-6edf9972d3be

  • @Ramm165
    @Ramm165 4 роки тому +1

    Hi many thanks for the video can you do an in-depth video on how to initialise the weight matrices for CNN and lstms

    • @AladdinPersson
      @AladdinPersson  4 роки тому +1

      There are different Initialization methods like kaiming, Xavier, etc. But you don't have to worry about this really, Pytorch uses these for default Initialization anyways. Some papers use more specific Initialization schemes and then you might have to do some tweaks, but I don't think this topic needs an entire video on it at least not right now, and these would be a more theoretical/concept video rather than what my channel is mostly about which is highly practical and implementation heavy

  • @sayantanbhattacharya3035
    @sayantanbhattacharya3035 3 роки тому +1

    great tutorial

  • @niveyoga3242
    @niveyoga3242 3 роки тому

    You are incredible!

  • @goelnikhils
    @goelnikhils Рік тому

    Amazing Video

  • @charudattamanwatkar8340
    @charudattamanwatkar8340 2 роки тому

    22:04 you can also do matrix multiplication as x3 = x1 @ x2

  • @devindoinmonkmode
    @devindoinmonkmode 5 місяців тому

    appreciate it man

  • @user-jg7ki4ml8w
    @user-jg7ki4ml8w 3 роки тому

    can you make course about computer vision with tensorflow and pytorch becuse your work is very good thank you

  • @codewithyouml8994
    @codewithyouml8994 3 роки тому

    Can u pls try to make a video describing ur journey from a beginner to a level where u can now implement a full raw research paper to code. Like how much time did it took, ur ups and downs etc..... please. Thanks. Cheers.

  • @kaanefe4266
    @kaanefe4266 2 роки тому

    absolute legent

  • @yantinghuang7491
    @yantinghuang7491 3 роки тому +1

    Thanks for the great video! One minor point: t = t + x seems would not generate a new copy. I used id() to check the memory address and seems like the old t and new t share the same address.

    • @AladdinPersson
      @AladdinPersson  3 роки тому

      Oh ok!

    • @hamzajaved5283
      @hamzajaved5283 2 роки тому

      I realise I'm replying to a very old comment, but using id() as you indicated, I found that it did produce a new address so was indeed a copy? Perhaps it depends on Python / Pytorch version?

  • @eduardovelardepolar5754
    @eduardovelardepolar5754 3 роки тому

    Great video

  • @Japneets1
    @Japneets1 3 роки тому

    Quite helpful

  • @eggwarrior5630
    @eggwarrior5630 2 роки тому

    I have a genuie question to ask. May I know what is the difference between torch.eye and torch.diag? Since they both is to create a diagonal shape of the value. Thanks in advance

  • @rajatsharma6137
    @rajatsharma6137 3 роки тому

    you are in the wrong field bro.. you should be a magician! respect from my core..

  • @fabryperot8081
    @fabryperot8081 3 роки тому

    I am gonna like the video and I am gonna give you a huge thumbs up :D

  • @Yazdah
    @Yazdah 4 роки тому +1

    Perfect :)

  • @arashabdi4052
    @arashabdi4052 3 роки тому

    Thank you so much for your great job. just there is one question, in pycharm autocompletion is not finding the _TensorBase part, I mean when I am typing: x = torch.tensor([sth]) then I expect to have x.float(), x.shape and so on but the float, shape, and ... is not suggested by pycharm/ autocomplete but the code is working. what you think the problem is?

  • @user-yt1uo1ub9e
    @user-yt1uo1ub9e Рік тому

    Thanks for the video! Can you tell me the name of your font in PyCharm? :)

  • @azizulhakim1534
    @azizulhakim1534 4 роки тому +1

    very very useful Video

  • @user-ri4ry4le2j
    @user-ri4ry4le2j 4 роки тому

    This video covers my lack of knowledge. Thanks!

  • @mohdkashif7295
    @mohdkashif7295 3 роки тому +1

    At 18:56 ,now for division it's torch.div(x,y)

  • @aigaurav5024
    @aigaurav5024 3 роки тому

    Thanks

  • @asaadanaam3163
    @asaadanaam3163 2 роки тому

    Awesome

  • @GoDDamnHosTile
    @GoDDamnHosTile 3 роки тому

    At 43:40, 0 is not unique yet it returns as unique. I tried it and it does the same for me. I wonder what causes this.

  • @parthchokhra7298
    @parthchokhra7298 4 роки тому

    Hey, great video there. Can we get an object detection video from scratch? How they are different from classification? That would be great :)

    • @AladdinPersson
      @AladdinPersson  4 роки тому +2

      Will look into it more :) Can't say it's next but will definitely do it and hopefully it doesn't take too long

  • @user-qb9ev5cx6d
    @user-qb9ev5cx6d Рік тому

    good video

  • @prajwol_poudel
    @prajwol_poudel 2 роки тому

    can't figure out the math behind batch matrix multiplication and broadcasting multiplication.

  • @yannickpezeu3419
    @yannickpezeu3419 3 роки тому

    Thanks Aladdin

  • @ehza
    @ehza 2 роки тому

    Nice

  • @roomo7time
    @roomo7time 3 роки тому

    itd been perfect if u explained gather. or do u explain it elsewhere? anyway good video!

  • @h3r3mii
    @h3r3mii Рік тому

    Could you do an advanced video ;p ? Thanks

  • @badavaththarun7006
    @badavaththarun7006 3 роки тому +1

    is x1 @ x2 same as x1.mm(x2) ?

  • @masoudhashemian5629
    @masoudhashemian5629 2 роки тому

    greate

  • @omnesomnibus2845
    @omnesomnibus2845 3 роки тому

    Good video, but I think it's unnecessarily confusing to use 'tensor' as a variable name (12:43) when it is also a special notation for making tensors.

  • @user-lt9px4qo7g
    @user-lt9px4qo7g 4 місяці тому

    太强了

  • @SuperLastkick
    @SuperLastkick 3 роки тому

    Hola, I'd like to know if there is a discord available or not ?

    • @AladdinPersson
      @AladdinPersson  3 роки тому

      Yes there is :) if you connect your youtube to your discord it should automatically add you, I think. Let me know if it doesn't work

    • @SuperLastkick
      @SuperLastkick 3 роки тому

      @@AladdinPersson
      i just did it but does not work for me 🥺

  • @jdcrunchman999
    @jdcrunchman999 Рік тому

    You are not executing some of these functions, why? I want to see what they do.

  • @thecros1076
    @thecros1076 4 роки тому

    Sir what are your future plans for the channel what do you plan ahed?

    • @AladdinPersson
      @AladdinPersson  4 роки тому +1

      I'm not entirely sure, I think I will do a couple videos in the upcoming days on quick tips and on problems I commonly notice which could save time debugging and understanding for people learning about Pytorch. Following that I'm going to learn and share my experience on other topics like object detection

    • @thecros1076
      @thecros1076 4 роки тому

      @@AladdinPersson truly excited ❤️❤️❤️ waiting for all of it🔥🔥🔥

  • @gol197884266
    @gol197884266 Рік тому

    Joya😊