All Projects → mrdrozdov-github → pytorch-extras

mrdrozdov-github / pytorch-extras

Licence: other
Some extra features for pytorch.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to pytorch-extras

DeepCD
[ICCV17] DeepCD: Learning Deep Complementary Descriptors for Patch Representations
Stars: ✭ 39 (-18.75%)
Mutual labels:  torch
resnet.torch
an updated version of fb.resnet.torch with many changes.
Stars: ✭ 35 (-27.08%)
Mutual labels:  torch
vqa-soft
Accompanying code for "A Simple Loss Function for Improving the Convergence and Accuracy of Visual Question Answering Models" CVPR 2017 VQA workshop paper.
Stars: ✭ 14 (-70.83%)
Mutual labels:  torch
bittensor
Internet-scale Neural Networks
Stars: ✭ 97 (+102.08%)
Mutual labels:  torch
neuralBlack
A Multi-Class Brain Tumor Classifier using Convolutional Neural Network with 99% Accuracy achieved by applying the method of Transfer Learning using Python and Pytorch Deep Learning Framework
Stars: ✭ 36 (-25%)
Mutual labels:  torch
DeepClassifier
DeepClassifier is aimed at building general text classification model library.It's easy and user-friendly to build any text classification task.
Stars: ✭ 25 (-47.92%)
Mutual labels:  torch
neural-vqa-attention
❓ Attention-based Visual Question Answering in Torch
Stars: ✭ 96 (+100%)
Mutual labels:  torch
torch-asg
Auto Segmentation Criterion (ASG) implemented in pytorch
Stars: ✭ 42 (-12.5%)
Mutual labels:  torch
torch-lrcn
An implementation of the LRCN in Torch
Stars: ✭ 85 (+77.08%)
Mutual labels:  torch
Amber
Amber-ify LED torch.
Stars: ✭ 26 (-45.83%)
Mutual labels:  torch
FlowNetTorch
Torch implementation of Fischer et al. FlowNet training code
Stars: ✭ 27 (-43.75%)
Mutual labels:  torch
TorchGA
Train PyTorch Models using the Genetic Algorithm with PyGAD
Stars: ✭ 47 (-2.08%)
Mutual labels:  torch
tensorsem
Structural Equation Modeling using Torch
Stars: ✭ 36 (-25%)
Mutual labels:  torch
torchlib
Data structures, algorithms, and ML/NLP tools in Lua.
Stars: ✭ 22 (-54.17%)
Mutual labels:  torch
photontorch
Highly parallel simulation and optimization of photonic circuits in time and frequency domain based on the deep-learning framework PyTorch
Stars: ✭ 29 (-39.58%)
Mutual labels:  torch
Cross-View-Gait-Based-Human-Identification-with-Deep-CNNs
Code for 2016 TPAMI(IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE) A Comprehensive Study on Cross-View Gait Based Human Identification with Deep CNNs
Stars: ✭ 21 (-56.25%)
Mutual labels:  torch
Neural-Zoom
Infinite Zoom For Style Transfer
Stars: ✭ 34 (-29.17%)
Mutual labels:  torch
gans-collection.torch
Torch implementation of various types of GAN (e.g. DCGAN, ALI, Context-encoder, DiscoGAN, CycleGAN, EBGAN, LSGAN)
Stars: ✭ 53 (+10.42%)
Mutual labels:  torch
lettuce
Computational Fluid Dynamics based on PyTorch and the Lattice Boltzmann Method
Stars: ✭ 74 (+54.17%)
Mutual labels:  torch
GodlyTorch
[NOT MAINTAINED] An app that can control the intensity of the torch of your rooted android device.
Stars: ✭ 16 (-66.67%)
Mutual labels:  torch

pytorch-extras

pip install pytorch-extras

Usage

expand_along

expand_along(var, mask) - Useful for selecting a dynamic amount of items from different indexes using a byte mask. This is a bit like numpy.repeat.

import torch
import torch_extras
setattr(torch, 'expand_along', torch_extras.expand_along)

var = torch.Tensor([1, 0, 2])
mask = torch.ByteTensor([[True, True], [False, True], [False, False]])
torch.expand_along(var, mask)
# (1, 1, 0)

expand_dims

expand_dims(var, dim) - Is similar to numpy.expand_dims.

import torch
import torch_extras
setattr(torch, 'expand_dims', torch_extras.expand_dims)

var = torch.range(0, 9).view(-1, 2)
torch.expand_dims(var, 0).size()
# (1, 5, 2)

Note: Have recently found out about torch.unsqeeze, which has the same API and is probably a more effective method for expanding dimensions.

select_item

select_item(var, index) - Is similar to [var[row,col] for row, col in enumerate(index)].

import torch
import torch_extras
setattr(torch, 'select_item', torch_extras.select_item)

var = torch.range(0, 9).view(-1, 2)
index = torch.LongTensor([0, 0, 0, 1, 1])
torch.select_item(var, index)
# [0, 2, 4, 7, 9]

cast

cast(var, type) - Cast a Tensor to the given type.

import torch
import torch_extras
setattr(torch, 'cast', torch_extras.cast)

input = torch.FloatTensor(1)
target_type = type(torch.LongTensor(1))
type(torch.cast(input, target_type))
# <class 'torch.LongTensor'>

one_hot

one_hot(size, index) - Creates a matrix of one hot vectors.

import torch
import torch_extras
setattr(torch, 'one_hot', torch_extras.one_hot)

size = (3, 3)
index = torch.LongTensor([2, 0, 1]).view(-1, 1)
torch.one_hot(size, index)
# [[0, 0, 1], [1, 0, 0], [0, 1, 0]]

nll

nll(log_prob, label) - Is similar to nll_loss except does not return an aggregate.

import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torch_extras
setattr(torch, 'nll', torch_extras.nll)

input = Variable(torch.FloatTensor([[0.5, 0.2, 0.3], [0.1, 0.8, 0.1]]))
target = Variable(torch.LongTensor([1, 2]).view(-1, 1))
output = torch.nll(torch.log(input), target)
output.size()
# (2, 1)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].