Tensor Math Operations - Deep Learning with PyTorch 4

preview_player
Показать описание
In this video we'll look at basic Tensor Math Operations for Deep learning with PyTorch.

We'll look at regular math like Addition, Subtraction, Multiplication, Division, Remainders (Modulus), and Exponents.

I'll show you some shorthand as well as the actual functions for each.

I'll also show you a neat underscore trick for reassigning the outcome of out math.

#pytorch #codemy #JohnElder

Timecodes

0:00​​ - Introduction
1:31 - Create Two Tensors
2:08 - Tensor Addition
4:00 - Tensor Subtraction
4:52 - Tensor Multiplication
5:41 - Tensor Division
6:30 - Tensor Modulus Remainder
7:37 - Tensor Exponents
8:44 - Another Way To Write Math Functions
9:20 - Tensor Math Reassignment
11:45 - Conclusion
Рекомендации по теме
Комментарии
Автор

▶ Watch Deep Learning With Pytorch Playlist ✅ Subscribe To My YouTube Channel:
▶ See More At: ✅ Join My Facebook Group:
▶ Get The Code

Codemycom
Автор

Usually the reason to do inplace math operations (so the thing described in tensor reassignment) is to save memory. If you are not doing mathemethics inplace you need to create an entire third matrix for every operation you do (even though it's unlikely you'll actually use all your in between steps). Whereas doing it inplace you can just stick to the two existing matrici and overwrite one during the operation.

chaoscorchkdr
Автор

If you want to add and assign at the same time, you can also use tensor_a += tensor_b. Also works for other operations.

jardvanroest
Автор

Really nice that this toturial contains this begging stuffs and so helpful

X_Vampire
Автор

how do we do a dot product (as opposed to just multiply individual element multiplications).... ?

KumR
Автор

Can I create a tensor using torch but use that tensor in a keras/tensorflow code?

KumR
Автор

Also the python operation for power is **

xmoncocox
Автор

Amazing professor, a question what is the difference between pytorch and tensorFlow?
Which one do you consider easier?

wcsephj
Автор

Interesting thing this Tensor in Torch. Thanks for showing.
But good old map() does it all also (and no need for imports):
a = [1, 2, 3, 4]
b = [5, 6, 7, 8]

def sum_num(x, y):
return x + y

print(res := list(map(sum_num, a, b)))
[6, -4, 5, 0]

# to that
# One can include any math functions needed and get results by index. Profit!
def num_ops(x, y):
return [
int(x + y), int(x - y),
int(x * y), int(x / y)
]

print(res := list(map(num_ops, a, b))[3])
[12, -4, 32, 0]

samoylov
Автор

Please upload Pygame video

Love your videoes ❤

cyberdome
visit shbcf.ru