0
0
PyTorchml~5 mins

First PyTorch computation - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is PyTorch?
PyTorch is a popular open-source library for machine learning that helps you work with tensors and build neural networks easily.
Click to reveal answer
beginner
What is a tensor in PyTorch?
A tensor is a multi-dimensional array, like a list of numbers, that PyTorch uses to store data for computations.
Click to reveal answer
beginner
How do you create a tensor with PyTorch?
You can create a tensor by calling torch.tensor() and passing a list of numbers, for example: torch.tensor([1, 2, 3]).
Click to reveal answer
beginner
What does the following PyTorch code do?
<pre>import torch
a = torch.tensor([2, 3])
b = torch.tensor([4, 5])
c = a + b</pre>
This code creates two tensors a and b, then adds them element-wise to get tensor c with values [6, 8].
Click to reveal answer
beginner
Why is PyTorch useful for machine learning?
PyTorch makes it easy to do math with tensors and build models that learn from data, using simple and clear code.
Click to reveal answer
What is the main data structure used in PyTorch for computations?
ADictionary
BList
CTensor
DDataFrame
How do you add two tensors a and b in PyTorch?
Aa + b
Ba.append(b)
Ca.concat(b)
Da.merge(b)
Which Python library do you import to use PyTorch?
Anumpy
Btensorflow
Csklearn
Dtorch
What will torch.tensor([1, 2, 3]) create?
AA list with values 1, 2, 3
BA tensor with values 1, 2, 3
CA Python integer
DA string
Which of these is NOT true about tensors?
ATensors are only for images
BTensors are used in PyTorch computations
CTensors store numbers
DTensors can have multiple dimensions
Explain how to create and add two tensors in PyTorch.
Think about how you create lists and add numbers, but with tensors.
You got /3 concepts.
    Describe why tensors are important in PyTorch and machine learning.
    Consider how data is handled in machine learning.
    You got /4 concepts.