Now that you have a better idea of what a CNN is and how a classifier model looks like in
112
PyTorch doesn’t abstract everything to the extent that Keras does, so there’s a bit
more syntax involved. If you would like to explore this framework further, check out
Appendix B, where we cover the basics of PyTorch, its functionality, and apply it to the
models that you will explore in Chapter
7
.
Just like in Keras, however, you start by importing
the necessary modules and
defining your hyperparameters (Figure
3-54
).
In PyTorch, you must specify to torch that you want to use the GPU if it exists. In
Keras, since you are using tensorflow-gpu as the back end (what Keras runs on top of), it
is expected that you have a GPU, CUDA, and cuDNN installed.
Now configure your hyperparameters (Figure
3-55
).
Do'stlaringiz bilan baham: