{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

pytor Flashcards

(15 cards)

1
Q

pytorch: To create an integer tensor, type

A

torch.tensor([1,2,3])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

pytorch: To create a float tensor, type

A

torch.FloatTensor([1,2,3])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

pytorch: To reshape an existing tensor by choosing the column and row dimensions, type

A

my_tensor.view(10, 10)

Note: It will error if the existing tensor does not properly fit into the new shape’s slots.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

pytorch: To reshape an existing tensor by choosing the number of columns and then have the row number automatically accommodate it, type

A

my_tensor.view(10, -1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

pytorch: To create a tensor from a numpy array, type

A

my array = np.array([1, 2, 3])

my_tensor = torch.from_numpy(array)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

pytorch: Adding or multiplying two tensors

A

applies the operation to only the value in the same index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

pytorch: The dot product is when you

A

multiply two tensors and then sum all the resulting values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

pytorch: To create a tensor for 10 equally spaced numbers between 2 numbers, type

A

torch.linspace(0, 10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

pytorch: To plot a graph of 2 tensors, type

A

plt.plot(x.numpy(), v.numpy())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

pytorch: To create a 1 dimensional range in pytorch, type

A

torch.arange(1, 10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

pytorch: To get the dimensions of a tensor, type

A

my_tensor.dim()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

pytorch: To slice a 2 dimensional tensor, type

A

my_tensor[0, 0]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

pytorch: A 3 dimensional array can be imagined as

A

multiple separate 2 dimensional tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

pytorch: To multiply two tensors matrices, type

A

my_tensor_matrix_1 @ my_tensor_matrix_2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

pytorch: To set the seed, type

A

torch.manual_seed(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly