上QQ阅读APP看书,第一时间看更新
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The custom class has to implement two main functions, namely __len__(self) and __getitem__(self, idx)."
A block of code is set as follows:
x,y = get_data() # x - represents training data,y - represents target variables
w,b = get_weights() # w,b - Learnable parameters
for i in range(500):
y_pred = simple_network(x) # function which computes wx + b
loss = loss_fn(y,y_pred) # calculates sum of the squared differences of y and y_pred
if i % 50 == 0:
print(loss)
optimize(learning_rate) # Adjust w,b to minimize the loss
Any command-line input or output is written as follows:
conda install pytorch torchvision cuda80 -c soumith
Bold: Indicates a new term, an important word, or words that you see onscreen.
Warnings or important notes appear like this.
Tips and tricks appear like this.