0% found this document useful (0 votes)
32 views

PyTorch Notes

PyTorch is an open-source deep learning framework that features dynamic computation graphs and easy debugging, making it suitable for training deep neural networks. Key features include tensors, automatic differentiation, and a simple neural network implementation. An example of a basic neural network using PyTorch is provided, showcasing model definition, loss function, and optimizer setup.

Uploaded by

sexyydiro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

PyTorch Notes

PyTorch is an open-source deep learning framework that features dynamic computation graphs and easy debugging, making it suitable for training deep neural networks. Key features include tensors, automatic differentiation, and a simple neural network implementation. An example of a basic neural network using PyTorch is provided, showcasing model definition, loss function, and optimizer setup.

Uploaded by

sexyydiro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PyTorch (Deep Learning Framework)

PyTorch is an open-source deep learning framework known for its dynamic computation graphs
and easy debugging.

Key Features:

 Tensors and automatic differentiation


 Dynamic computational graph
 Training deep neural networks

Example: Simple Neural Network

import torch

import torch.nn as nn

import torch.optim as optim

# Defining a neural network

class SimpleNN(nn.Module):

def __init__(self):

super(SimpleNN, self).__init__()

self.fc1 = nn.Linear(10, 64)

self.fc2 = nn.Linear(64, 1)

def forward(self, x):

x = torch.relu(self.fc1(x))

return torch.sigmoid(self.fc2(x))

# Model initialization

model = SimpleNN()

criterion = nn.BCELoss()

optimizer = optim.Adam(model.parameters(), lr=0.001)

print(model)

You might also like