Recent Posts by admin
Advantage of using LogSoftmax vs Softmax vs Crossentropyloss in PyTorch
The workaround is to use log probability instead of probability, which takes care to make the calculation numerically stable. The reformulated version allows us to evaluate softmax with only small numerical errors even when z contains extremely large or extremely negative numbers.
How to create a Contiguous tensor in Pytorch?
Contiguous tensors are convenient because we can visit them efficiently in order without jumping around in the storage. It improves data locality and improves performance because of the way memory access works on modern CPUs. This advantage of course depends on the way algorithms visit.
Create DataLoader with collate_fn() for variable-length input in PyTorch.
A custom collate_fn can be used to customize collation, e.g., padding sequential data to a max length of a batch.collate_fn is called with a list of data samples at each time. It is expected to collate the input samples into a batch for yielding from the data loader iterator.