Hi, DEV community πββοΈ
In this post, I will abord some pytorch codes to help with your journey. Most of my knowledge comes from Freecodecamp tutorial, TechwithTim. The Cherno, Programing with Mosh and Fireship (all from youtube). They deserve credit for teaching me a lot of cool stuff.π₯°
- Imports
- General:
imports the root package, imports dataset representation and loading
import torch
from torch.utils.data import Dataset, DataLoader
- Neural Network API:
imports the computation graph, puts the tensor node in the computation graph, imports neural networks, layers ..., import optimizers and the hybrid frontend decorator plus tracing jit.
import torch.autograd as autograd
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.jit import script, trace
- Torchscript and JIT
torch.jit.trace()
@script
-ONNX
the last line prints a human-readable representation
torch.onnx.export(model,dummy data, xxxx.proto)
model= onnx.load("ModelName.proto")
onnx.checker.check_model(model)
onnx.helper.printable_graph(model.graph) #this one
-Vision
imports vision datasets. architect and transforms that can be composed
from torchvision import datasets, models, transforms
import torchvision.transforms as transforms
- Distributed Training
it will distribute the communication and the memory sharing processes
import torch.distributed as dist
from torch.multiprocessing import Process
- Data Utilities
- Datasets abstract class representing datasets, labelling the datasets in form of tensor and concatenation of them
Dataset
TensorDataset
Concat Dataset
- Data loaders and data samplers
DataLoader(dataset, batch_size=1, ...)
sampler.Sampler(dataset, ...)
sampler.XSampler where # Sequencial || Random || SubsetRandom ||
WeightedRandom || Batch || Distributed
Stay tuned for the part 2 β: .q. o(β§β½β¦)o .q.:β
Top comments (0)