Introduction to Tensors in Mojo🔥

  Рет қаралды 6,405

Modular

9 ай бұрын

In this video we'll take a closer look at the Tensor type in the Mojo🔥 standard library. We'll introduce the Tensor type, and go through an example where we'll implement vectorized element-wise matrix operations. We'll also show you examples of vectorized matrix-matrix, matrix-vector and matrix-scalar operations.
Code referenced in video: github.com/modularml/devrel-extras/tree/main/videos/introduction-to-tensors
Chapters:
00:00 What are Tensors? Tensors in PyTorch and NumPy
00:42 Introduction to Mojo🔥 Tensors
02:02 Create your first Mojo🔥 Tensor
03:45 Using Math standard library functions on Tensors -- naive way
08:07 Implementing vectorized Math operations on Tensors ⚡️
13:16 Vectorized matrix-matrix, matrix-vector, matrix-scalar operations
Download Mojo 🔥 - www.modular.com/mojo
Download VS Code Extension - marketplace.visualstudio.com/items?itemName=modular-mojotools.vscode-mojo
Join our Community! 🚀
Discord - discord.gg/modular
Github - github.com/modularml/mojo
X (aka Twitter) - x.com/modular_ai

Пікірлер: 30
@juliansteden2980
@juliansteden2980 9 ай бұрын
Really looking forward to using mojo in the future 🔥 Using a util function for something simple as printing a tensor seems very awkward. I would expect the print function to be able to do this (str/repr)
@user-ij2pv3qu6k
@user-ij2pv3qu6k 9 ай бұрын
Please hire some free lance educators to do more beginner level tutorials like hand written character recognition
@roanage
@roanage 9 ай бұрын
Awesome! Thanks for these demonstration videos :)
@grzegorzryznar5101
@grzegorzryznar5101 9 ай бұрын
Thanks for the video! Done very well!
@juliansteden2980
@juliansteden2980 9 ай бұрын
I see the „simd_width“ parameter being passed around a lot in the vectorized functions. As far as I understand this value is always the same in a running application because it depends on the processor architecture. In my naive mind it should be possible for the compiler to add/inject this value into the functions behind the scenes at compile time to avoid this „boilerplate“ :D ?
@IvoBalbaert
@IvoBalbaert 9 ай бұрын
It does just that already because it is an alias: alias simd_width: Int = simdwidthof[type]()
@RichBurgundy
@RichBurgundy 7 ай бұрын
For those that encounter an error when trying to import tensorutils and tensorprint: The built in print function now supports tensors. You do not need to import tensorprint. For example, if you follow this video, "print(t)" will now work just fine.
@seriouce4832
@seriouce4832 9 ай бұрын
If a matrix is 3x3, then t[0] would give the first row of the array in numpy (as if you would type t[0,...] or t[0,:] I think it is a bad idea if the behavior is fundamentally different already in these very basic and core functionalities
@reza8932
@reza8932 9 ай бұрын
It is an interesting language❤
@luizbarueri.contato
@luizbarueri.contato 9 ай бұрын
👍👍👍
@avihalevy5518
@avihalevy5518 9 ай бұрын
When will slices be supported? as in arr[:,3:6]?
@Bakobiibizo
@Bakobiibizo 9 ай бұрын
i want to use mojo in my tpu hub i have with gcp. I'd like to see parallelization implemented
@_ABDULGHANI
@_ABDULGHANI 9 ай бұрын
import tensorprint from tensorutils work fine after I copy the tensorutils to my workstation but when I try to import elemwise_transform I get this error: error: Expression [33]:1:26: package 'tensorutils' does not contain 'elemwise_transform' from tensorutils import (elemwise_transform, Anyone know how to solve it?
@_ABDULGHANI
@_ABDULGHANI 9 ай бұрын
Thank you for this video but I have a problem with tensorprint when I use it I don't get any error but I can't see any output. from random import rand from tensorutils import tensorprint t = rand[type](3, 3) tensorprint(t) any solution for that I have mojo 0.3
@modularinc
@modularinc 9 ай бұрын
The utility functions are available separately: github.com/modularml/mojo/tree/main/examples/blogs-videos/tensorutils
@_ABDULGHANI
@_ABDULGHANI 9 ай бұрын
Great thank you I download it to my work station and it work now@@modularinc
@Tferdz
@Tferdz 9 ай бұрын
Why use the dunder method instead of calling str(tensor)? Seems awkward Also overloading built-in keywords like type is never a good idea. I suggest dtype
@shashank.prasanna
@shashank.prasanna 9 ай бұрын
Good points, appreciate the feedback! Thanks!
@soracc_
@soracc_ 9 ай бұрын
dunder methods are used because `str` is not yet supported, and it's likely also blocked by traits(the language feature).
@sotasearcher
@sotasearcher 7 ай бұрын
even just print(t.shape()) works
@modularinc
@modularinc 7 ай бұрын
Now it does in the latest release v0.6 which introduced traits.
@sotasearcher
@sotasearcher 7 ай бұрын
@@modularinc touché :)
@user-rh1sw6ji6t
@user-rh1sw6ji6t 9 ай бұрын
when will mac and window version release?
@TheNaive
@TheNaive 2 ай бұрын
Why the file is .ipynb instead of .mojo
@Clarkezoneusa
@Clarkezoneusa 7 ай бұрын
How did you get the mojo jypiter notebook thingie going?
@kvertea
@kvertea 7 ай бұрын
only using vs code
@mojoloop
@mojoloop 2 ай бұрын
Just a qualitative observation, the mojo documentation does not have enough examples. At the end of each doc like the random module, actually show how to use some of the random functions like randint. I'm personally having a tough time understanding how to properly use some of the functions because there are barely any examples present.
@maxkosh4839
@maxkosh4839 9 ай бұрын
what about arrays? Do we have arrays now?
@mpmdean
@mpmdean 8 ай бұрын
Is matrix diagonalization going to be available soon?
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 66 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 27 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 11 МЛН
Мыла наелся
0:21
Pavlov_family_
Рет қаралды 4,2 МЛН
Вилка для консервов 🥒
0:51
Сан Тан
Рет қаралды 3,1 МЛН
Waka Waka 😁 #funnyshorts #rianashow
0:14
RianaShow
Рет қаралды 27 МЛН
БАБУШКИН КОМПОТ В СОЛО
0:19
PAVLOV
Рет қаралды 19 МЛН