Tutorial 4 Flashcards

1
Q

What is torch.device() used for?

A

A torch.device is an object representing the device on which a torch.Tensor is or will be allocated.

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

What is torch.cuda.is_available() used for?

A

It is used to check if a GPU is present. Returns True if so.

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

What class do you have to inherit from when creating a custom neural network?

A

nn.Module()

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

Which functions do you have to override?

A

def __init__() and def __forward()

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

What is def __init__() for?

A

This function is used to define all of your layers.

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

What is def __forward__() for?

A

This function is used to define the forward pass of your neural net.

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

What does model.children() return?

A

Returns all the submodules of the model in the form of a generator

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

What can you do with model.apply(f(n))

A

Apply a specific function to all the children of the model. An example is resetting the weights.

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

How do you reset all the weights of a model?

A

You create a function called weight_reset(m):, which does an m.reset_parameters() call. Then you feed this function to model.apply()

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