entry_point
stringlengths
1
65
original_triton_python_code
stringlengths
208
619k
optimised_triton_code
stringlengths
1.15k
275k
repo_name
stringlengths
7
115
module_name
stringlengths
1
65
synthetic
bool
1 class
uuid
int64
0
18.5k
licenses
listlengths
1
6
stars
int64
0
19.8k
sha
stringlengths
40
40
repo_link
stringlengths
72
180
ConcatClassifierHead
from _paritybench_helpers import _mock_config from torch.nn import Module import torch import torch.nn as nn import torch.nn class ConcatClassifierHead(Module): def __init__(self, config: 'dict'): super(ConcatClassifierHead, self).__init__() self.linear_layer_1 = nn.Linear(config['max_objects_per...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
SpyrosMouselinos/DeltaFormers
ConcatClassifierHead
false
5,857
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
RelateModule
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class RelateModule(nn.Module): def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=(3, 3), padding=1, dilation=(1, 1)) self.conv2 = nn.Conv2d(dim, dim, kerne...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
SpyrosMouselinos/DeltaFormers
RelateModule
false
5,858
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
MNIST_CNN
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class SqueezeLastTwo(nn.Module): """A module which squeezes the last two dimensions, ordinary squeeze can be a problem for batch size 1""" def __init__(self): super(SqueezeLastTwo, self).__init__() def for...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SirRob1997/DomainBed
MNIST_CNN
false
5,859
[ "MIT" ]
1
7399a2b0a63df48f4b67755a3f33901223d5c8fb
https://github.com/SirRob1997/DomainBed/tree/7399a2b0a63df48f4b67755a3f33901223d5c8fb
LanguageModelCriterion
import torch import torch.nn as nn from torch.autograd import * class LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): if target.ndim == 3: target = target.reshape(-1, target.shape[2]) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
SunZongdi/self-critical.pytorch
LanguageModelCriterion
false
5,861
[ "MIT" ]
1
6cecbeb949e68007b72e84198cf74f9fb288aeda
https://github.com/SunZongdi/self-critical.pytorch/tree/6cecbeb949e68007b72e84198cf74f9fb288aeda
RewardCriterion
import torch import torch.nn as nn from torch.autograd import * class RewardCriterion(nn.Module): def __init__(self): super(RewardCriterion, self).__init__() def forward(self, input, seq, reward): input = input.gather(2, seq.unsqueeze(2)).squeeze(2) input = input.reshape(-1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
SunZongdi/self-critical.pytorch
RewardCriterion
false
5,862
[ "MIT" ]
1
6cecbeb949e68007b72e84198cf74f9fb288aeda
https://github.com/SunZongdi/self-critical.pytorch/tree/6cecbeb949e68007b72e84198cf74f9fb288aeda
VNet
import torch import torch.nn as nn class VNet(nn.Module): def __init__(self, input_size, hidden_size, output_size=1): super(VNet, self).__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.relu1 = nn.ReLU(inplace=True) self.linear2 = nn.Linear(hidden_size, output_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Stranger469/wrench
VNet
false
5,863
[ "Apache-2.0" ]
1
ab717ac26a76649c8fdb946a28dffe7e682c80ba
https://github.com/Stranger469/wrench/tree/ab717ac26a76649c8fdb946a28dffe7e682c80ba
Attention
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import * class Attention(nn.Module): def __init__(self, opt): super(Attention, self).__init__() self.rnn_size = opt.rnn_size self.att_hid_size = opt.att_hid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SunZongdi/self-critical.pytorch
Attention
false
5,864
[ "MIT" ]
1
6cecbeb949e68007b72e84198cf74f9fb288aeda
https://github.com/SunZongdi/self-critical.pytorch/tree/6cecbeb949e68007b72e84198cf74f9fb288aeda
StackedAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class StackedAttention(nn.Module): def __init__(self, input_dim, hidden_dim): super(StackedAttention, self).__init__() self.Wv = nn.Conv2d(input_dim, hidden_dim, kernel_size=(1, 1), padding=(0, 0)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SpyrosMouselinos/DeltaFormers
StackedAttention
false
5,865
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): """ Convolutional Neural Network. """ def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 20, kernel_size=5, stride=1) self.fc1 = nn.Linear(8 * 8 * 20, 64) self.fc2 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
StanislawSwierc/Ax
CNN
false
5,866
[ "MIT" ]
1
175dff2294af4548ae258105346eeaca22a30197
https://github.com/StanislawSwierc/Ax/tree/175dff2294af4548ae258105346eeaca22a30197
BinaryLogisticRegressionLoss
import torch import torch.nn as nn def binary_logistic_regression_loss(reg_score, label, threshold=0.5, ratio_range=(1.05, 21), eps=1e-05): """Binary Logistic Regression Loss.""" label = label.view(-1) reg_score = reg_score.contiguous().view(-1) pmask = (label > threshold).float() num_positive...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
SvipRepetitionCounting/TransRAC
BinaryLogisticRegressionLoss
false
5,867
[ "Apache-2.0" ]
1
eec12553dfa1e2fde6356b0e2703c633d225feb3
https://github.com/SvipRepetitionCounting/TransRAC/tree/eec12553dfa1e2fde6356b0e2703c633d225feb3
Autoencoder
import torch class Autoencoder(torch.nn.Module): def __init__(self): super().__init__() self.conv1 = torch.nn.Conv2d(1, 8, 3, padding=1) self.conv2 = torch.nn.Conv2d(8, 8, 3, padding=1) self.conv3 = torch.nn.Conv2d(8, 16, 3, padding=1) self.conv4 = torch.nn.Conv2d(16, 16, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
SpaceMeerkat/CAE
Autoencoder
false
5,868
[ "MIT" ]
1
8c5e2fbe751810a87ca155d0e3d53797f52fd9ea
https://github.com/SpaceMeerkat/CAE/tree/8c5e2fbe751810a87ca155d0e3d53797f52fd9ea
InceptionA
import torch import torch.nn.functional as F class InceptionA(torch.nn.Module): def __init__(self, in_channels): super(InceptionA, self).__init__() self.branch1x1 = torch.nn.Conv2d(in_channels, 16, kernel_size=(1, 1)) self.branch_pool = torch.nn.Conv2d(in_channels, 24, kernel_size=(1, 1))...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
StarsStation/DeepLearning
InceptionA
false
5,869
[ "MIT" ]
1
a4c833af93652069f19a8c6f0b1e42cde64bbb79
https://github.com/StarsStation/DeepLearning/tree/a4c833af93652069f19a8c6f0b1e42cde64bbb79
DotProductAttention
import math import torch from torch import nn def masked_softmax(X, valid_len): """Perform softmax by filtering out some elements.""" if valid_len is None: return nn.functional.softmax(X, dim=-1) else: shape = X.shape if valid_len.dim() == 1: valid_len = torch.repeat_in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
StevenJokess/d2l-en-read
DotProductAttention
false
5,870
[ "MIT" ]
1
71b0f35971063b9fe5f21319b8072d61c9e5a298
https://github.com/StevenJokess/d2l-en-read/tree/71b0f35971063b9fe5f21319b8072d61c9e5a298
Linear_dynamics
import torch import torch.utils.data from torch import nn class Linear_dynamics(nn.Module): def __init__(self, device='cpu'): super(Linear_dynamics, self).__init__() self.time = nn.Parameter(torch.ones(1) * 0.7) self.device = device self def forward(self, x, v): retur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
SuperXiang/GMN
Linear_dynamics
false
5,871
[ "MIT" ]
1
b74364e5b9f424b63a5ce63a207a6e4a067d7d3b
https://github.com/SuperXiang/GMN/tree/b74364e5b9f424b63a5ce63a207a6e4a067d7d3b
ContrastiveLoss
import torch from torchvision.transforms import functional as F import torch.nn as nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin: 'float'...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Swall0w/cougar
ContrastiveLoss
false
5,872
[ "MIT" ]
1
9161b2b1d0c256f4bb952ec190351684f28ec1b7
https://github.com/Swall0w/cougar/tree/9161b2b1d0c256f4bb952ec190351684f28ec1b7
SeqFC1
import torch import torch.nn as nn import torch.nn.functional as F class SeqFC1(nn.Module): """ Neural network definition """ def __init__(self, size): super(SeqFC1, self).__init__() self.size = size self.fc1 = nn.Linear(in_features=self.size, out_features=16) self.fc2 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Thibaud-Ardoin/Dial-a-Ride
SeqFC1
false
5,873
[ "MIT" ]
1
7d9b3cd904d3194dccad31fec2533e2cf58cad0c
https://github.com/Thibaud-Ardoin/Dial-a-Ride/tree/7d9b3cd904d3194dccad31fec2533e2cf58cad0c
Net_BP
import torch import torch.nn.functional as F class Net_BP(torch.nn.Module): def __init__(self, n_features, n_hidden=50, n_output=1): super(Net_BP, self).__init__() self.hidden = torch.nn.Linear(n_features, n_hidden) self.predict = torch.nn.Linear(n_hidden, n_output) def forward(self,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Tappai/PV_prediction
Net_BP
false
5,874
[ "Apache-2.0" ]
1
2ff1e1af183a28f07ebc2ec2979488eb8e246813
https://github.com/Tappai/PV_prediction/tree/2ff1e1af183a28f07ebc2ec2979488eb8e246813
DQN
import torch import torch.nn as nn class DQN(nn.Module): def __init__(self, size, upscale_factor, layer_size, channels): super(DQN, self).__init__() self.relu = nn.ReLU() self.fc1 = nn.Linear(in_features=size ** 2, out_features=layer_size) self.fc2 = nn.Linear(in_features=layer_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Thibaud-Ardoin/Dial-a-Ride
DQN
false
5,875
[ "MIT" ]
1
7d9b3cd904d3194dccad31fec2533e2cf58cad0c
https://github.com/Thibaud-Ardoin/Dial-a-Ride/tree/7d9b3cd904d3194dccad31fec2533e2cf58cad0c
SameModule
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class SameModule(nn.Module): def __init__(self, dim): super().__init__() self.conv = nn.Conv2d(dim + 1, 1, kernel_size=(1, 1)) torch.nn.init.kaiming_normal_(self.conv.weight) self.dim = dim def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SpyrosMouselinos/DeltaFormers
SameModule
false
5,876
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
FC1
import torch import torch.nn as nn import torch.nn.functional as F class FC1(nn.Module): """ Neural network definition """ def __init__(self, size, hidden_layers): super(FC1, self).__init__() self.size = size self.hidden_layers = hidden_layers self.fc1 = nn.Linear(in_featu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Thibaud-Ardoin/Dial-a-Ride
FC1
false
5,877
[ "MIT" ]
1
7d9b3cd904d3194dccad31fec2533e2cf58cad0c
https://github.com/Thibaud-Ardoin/Dial-a-Ride/tree/7d9b3cd904d3194dccad31fec2533e2cf58cad0c
HyperLinear
import math import torch import torch.nn.functional as F import torch.nn as nn class HyperLinear(nn.Module): def __init__(self, in_features, out_features, num_hparams, bias=True): super(HyperLinear, self).__init__() self.in_features = in_features self.out_features = out_features s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
ThrunGroup/implicit-hyper-opt
HyperLinear
false
5,878
[ "MIT" ]
1
fe4ac539c947ca8083049d23c5f1f67f44cd09f0
https://github.com/ThrunGroup/implicit-hyper-opt/tree/fe4ac539c947ca8083049d23c5f1f67f44cd09f0
DQN
import torch import torch.nn as nn import torch.nn.functional as F class DQN(nn.Module): def __init__(self, input_size, hidden_1_size, hidden_2_size, output_size): super().__init__() self.fc1 = nn.Linear(input_size, hidden_1_size) self.fc2 = nn.Linear(hidden_1_size, hidden_2_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
TejaswiniMedi/DRL
DQN
false
5,879
[ "MIT" ]
1
d4a694c5e505822e6e8627be52afd0ccc60f80ef
https://github.com/TejaswiniMedi/DRL/tree/d4a694c5e505822e6e8627be52afd0ccc60f80ef
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedForward(nn.Module): """A two-feed-forward-layer module. Parameters ---------- d_model : int embed_dim. d_inner : int dff. dropout : float dropout rate. """ def __init__(s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
TaoranJ/PC-RNN
PositionwiseFeedForward
false
5,880
[ "MIT" ]
1
f360b464cf68737fefd5e6093e55056838693b1b
https://github.com/TaoranJ/PC-RNN/tree/f360b464cf68737fefd5e6093e55056838693b1b
Switch
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn.init import kaiming_normal def ZeroInitializer(param): shape = param.size() init = np.zeros(shape).astype(np.float32) param.data.set_(torch.from_numpy(init)) def Linear(initializer=kaiming_normal, bias_in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
TaoMiner/eesc
Switch
false
5,881
[ "Apache-2.0" ]
1
fa0ca532333cad2262d20707899f97a6c8a99cfb
https://github.com/TaoMiner/eesc/tree/fa0ca532333cad2262d20707899f97a6c8a99cfb
PerOutputClassifierHead
from _paritybench_helpers import _mock_config from torch.nn import Module import torch import torch.nn as nn import torch.nn class PerOutputClassifierHead(Module): def __init__(self, config: 'dict'): super(PerOutputClassifierHead, self).__init__() self.linear_layer_1 = nn.Linear(config['hidden_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
SpyrosMouselinos/DeltaFormers
PerOutputClassifierHead
false
5,882
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, board_width, board_height): super(Net, self).__init__() self.board_width = board_width self.board_height = board_height self.conv1 = nn.Conv2d(4, 32, kernel_size=3, padding=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SummitChen/ComputationalAdvertisement
Net
false
5,883
[ "MIT" ]
1
05a9e8bd82ca834219121de4257185d63f592d78
https://github.com/SummitChen/ComputationalAdvertisement/tree/05a9e8bd82ca834219121de4257185d63f592d78
VAE
import torch from torch import nn from torch.nn import functional as F class VAE(nn.Module): def __init__(self): super(VAE, self).__init__() self.fc1 = nn.Linear(84 * 84, 400) self.fc21 = nn.Linear(400, 20) self.fc22 = nn.Linear(400, 20) self.fc3 = nn.Linear(20, 400) ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
TannerSorensen/speech_production_manifolds
VAE
false
5,884
[ "MIT" ]
1
0dcc2c099ad0e1e157c7f108e28f5957d4ac2f48
https://github.com/TannerSorensen/speech_production_manifolds/tree/0dcc2c099ad0e1e157c7f108e28f5957d4ac2f48
down
import torch from torch.functional import F import torch.nn as nn import torch.nn.functional as F class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Thomasedv/AI_Interpolation
down
false
5,885
[ "MIT" ]
1
cee51d92185a43a60797785554ee1ae924e5da0d
https://github.com/Thomasedv/AI_Interpolation/tree/cee51d92185a43a60797785554ee1ae924e5da0d
BMNLoss
import torch import torch.nn.functional as F import torch.nn as nn def binary_logistic_regression_loss(reg_score, label, threshold=0.5, ratio_range=(1.05, 21), eps=1e-05): """Binary Logistic Regression Loss.""" label = label.view(-1) reg_score = reg_score.contiguous().view(-1) pmask = (label > thr...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_ma...
SvipRepetitionCounting/TransRAC
BMNLoss
false
5,886
[ "Apache-2.0" ]
1
eec12553dfa1e2fde6356b0e2703c633d225feb3
https://github.com/SvipRepetitionCounting/TransRAC/tree/eec12553dfa1e2fde6356b0e2703c633d225feb3
L1_Charbonnier_loss
import torch import torch.nn as nn class L1_Charbonnier_loss(nn.Module): """L1 Charbonnierloss.""" def __init__(self): super(L1_Charbonnier_loss, self).__init__() self.eps = 1e-06 def forward(self, X, Y): diff = torch.add(X, -Y) error = torch.sqrt(diff * diff + self.eps) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Tiger1994/LapSRN
L1_Charbonnier_loss
false
5,887
[ "MIT" ]
1
4f2222ebad97ad6730fe352f5a3c8a06f0f61e7a
https://github.com/Tiger1994/LapSRN/tree/4f2222ebad97ad6730fe352f5a3c8a06f0f61e7a
FC2
import torch import torch.nn as nn import torch.nn.functional as F class FC2(nn.Module): """ Neural network definition """ def __init__(self, size): super(FC2, self).__init__() self.size = size self.fc1 = nn.Linear(in_features=self.size ** 2, out_features=128) self.fc2 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Thibaud-Ardoin/Dial-a-Ride
FC2
false
5,888
[ "MIT" ]
1
7d9b3cd904d3194dccad31fec2533e2cf58cad0c
https://github.com/Thibaud-Ardoin/Dial-a-Ride/tree/7d9b3cd904d3194dccad31fec2533e2cf58cad0c
NeuralNetMultiplePositionalArguments
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class NeuralNetMultiplePositionalArguments(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArguments, self).__init__() self.fc1 = torch.nn.Linear(input_size, h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
TingGong1/onnxruntime
NeuralNetMultiplePositionalArguments
false
5,889
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
HuggingfaceFastGelu
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class HuggingfaceFastGelu(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(x * 0.7978845608 * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx import torch.utils.checkpoint assert_size_str...
TingGong1/onnxruntime
HuggingfaceFastGelu
false
5,890
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
IIDIsotropicGaussianUVLoss
import math import torch import torch.utils.data from torch import nn import torch.nn.functional as F class IIDIsotropicGaussianUVLoss(nn.Module): """ Loss for the case of iid residuals with isotropic covariance: $Sigma_i = sigma_i^2 I$ The loss (negative log likelihood) is then: $1/2 sum_{i=1}^n ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import math...
TinBacon/FastAutoAugmentation
IIDIsotropicGaussianUVLoss
false
5,891
[ "Apache-2.0" ]
1
011e4e348fd9a937a29df11695dc71410f555d0a
https://github.com/TinBacon/FastAutoAugmentation/tree/011e4e348fd9a937a29df11695dc71410f555d0a
IndepAnisotropicGaussianUVLoss
import math import torch import torch.utils.data from torch import nn import torch.nn.functional as F class IndepAnisotropicGaussianUVLoss(nn.Module): """ Loss for the case of independent residuals with anisotropic covariances: $Sigma_i = sigma_i^2 I + r_i r_i^T$ The loss (negative log likelihood) is ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import math...
TinBacon/FastAutoAugmentation
IndepAnisotropicGaussianUVLoss
false
5,892
[ "Apache-2.0" ]
1
011e4e348fd9a937a29df11695dc71410f555d0a
https://github.com/TinBacon/FastAutoAugmentation/tree/011e4e348fd9a937a29df11695dc71410f555d0a
BVNet
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class BVNet(nn.Module): """ Baseline REINFORCE - Value Calculating Network """ def __init__(self, input_size): super(BVNet, self).__init__() self.input_size = input_size self.fc1 = nn.Linear(inp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SpyrosMouselinos/DeltaFormers
BVNet
false
5,893
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
MegatronFastGelu
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class MegatronFastGelu(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def g...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx import torch.utils.checkpoint assert_size_str...
TingGong1/onnxruntime
MegatronFastGelu
false
5,894
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
MegatronGelu
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class MegatronGelu(torch.nn.Module): def forward(self, x): return x * 0.5 * (torch.erf(x / 1.41421) + 1.0) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx import torch.utils.checkpoint assert_size_str...
TingGong1/onnxruntime
MegatronGelu
false
5,895
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
SelfAttention
import torch import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, embed_size, heads): super(SelfAttention, self).__init__() self.embed_size = embed_size self.heads = heads self.head_dim = embed_size // heads assert self.head_dim * heads == embed_size, '...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Thibaud-Ardoin/Dial-a-Ride
SelfAttention
false
5,896
[ "MIT" ]
1
7d9b3cd904d3194dccad31fec2533e2cf58cad0c
https://github.com/Thibaud-Ardoin/Dial-a-Ride/tree/7d9b3cd904d3194dccad31fec2533e2cf58cad0c
NeuralNetPartialNoGradModel
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class NeuralNetPartialNoGradModel(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetPartialNoGradModel, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size).requir...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
TingGong1/onnxruntime
NeuralNetPartialNoGradModel
false
5,897
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
KLLoss
import torch from torch import Tensor class KLLoss(torch.nn.KLDivLoss): def __init__(self, batch_wise=False): super(KLLoss, self).__init__(reduction='batchmean') self.batch_wise = batch_wise def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor: if self.batch_wise: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
Tomoya-K-0504/deepSELF
KLLoss
false
5,898
[ "MIT" ]
1
0e5a7d0169b3e9edcb5c8d9802140a84ce5cb69a
https://github.com/Tomoya-K-0504/deepSELF/tree/0e5a7d0169b3e9edcb5c8d9802140a84ce5cb69a
SANet
import torch import torch.nn as nn import torch.backends.cudnn def calc_mean_std(feat, eps=1e-05): size = feat.size() assert len(size) == 4 N, C = size[:2] feat_var = feat.view(N, C, -1).var(dim=2) + eps feat_std = feat_var.sqrt().view(N, C, 1, 1) feat_mean = feat.view(N, C, -1).mean(dim=2).vi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TimandXiyu/SANet-style-transfer-
SANet
false
5,899
[ "MIT" ]
1
91c3dd1344d1dded61aa2e79618240a49345b40e
https://github.com/TimandXiyu/SANet-style-transfer-/tree/91c3dd1344d1dded61aa2e79618240a49345b40e
LayerNorm
import torch import torch.nn as nn import torch.nn import torch.onnx import torch.utils.checkpoint class LayerNorm(nn.Module): def __init__(self, hidden_size, epsilon, cast_fp16=True, formula=0): super().__init__() self.layer_norm = nn.LayerNorm(hidden_size, eps=epsilon) self.layer_norm.b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn import torch.onnx import torch.utils.chec...
TingGong1/onnxruntime
LayerNorm
false
5,900
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
AttentionSeq2Vec
from torch.nn import Module import torch from torch.nn import Linear from typing import Optional from torch.nn import Tanh def masked_softmax(vector: 'torch.FloatTensor', mask: 'torch.ByteTensor'): """ 计算带有 masked 的 softmax :param vector: shape: (B, seq_len) :param mask: shape: (B, seq_len), :retu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
Tiffany-HONG/easytext
AttentionSeq2Vec
false
5,901
[ "MIT" ]
1
9c717d11240d96fab98b0532084ebb5c093d55bd
https://github.com/Tiffany-HONG/easytext/tree/9c717d11240d96fab98b0532084ebb5c093d55bd
NeuralNetNonDifferentiableOutput
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class NeuralNetNonDifferentiableOutput(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetNonDifferentiableOutput, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
TingGong1/onnxruntime
NeuralNetNonDifferentiableOutput
false
5,902
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
Normalize
import torch from torch import Tensor class Normalize(torch.nn.Module): def forward(self, x: 'Tensor'): return (x - x.mean()) / x.std() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
Tomoya-K-0504/deepSELF
Normalize
false
5,903
[ "MIT" ]
1
0e5a7d0169b3e9edcb5c8d9802140a84ce5cb69a
https://github.com/Tomoya-K-0504/deepSELF/tree/0e5a7d0169b3e9edcb5c8d9802140a84ce5cb69a
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency(torch. nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TingGong1/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
false
5,904
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
PositionalScaledDotProductAttention
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F class PositionalScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention with optional positional encodings """ def __init__(self, temperature, positional_encoding=None, attn_dropout=0.1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TomerRonen34/MeshCNN
PositionalScaledDotProductAttention
false
5,905
[ "MIT" ]
1
8c50f3804c48044b78572d652a42184640e904d9
https://github.com/TomerRonen34/MeshCNN/tree/8c50f3804c48044b78572d652a42184640e904d9
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
import torch import torch.nn import torch.onnx import torch.utils.checkpoint class NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TingGong1/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
false
5,906
[ "MIT" ]
1
435010ab6873974803591fa22262ed8b3e36e44d
https://github.com/TingGong1/onnxruntime/tree/435010ab6873974803591fa22262ed8b3e36e44d
ScaledDotProductAttention
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention from https://github.com/jadore801120/attention-is-all-you-need-pytorch by Yu-Hsiang Huang """ def __init__(self,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TomerRonen34/MeshCNN
ScaledDotProductAttention
false
5,907
[ "MIT" ]
1
8c50f3804c48044b78572d652a42184640e904d9
https://github.com/TomerRonen34/MeshCNN/tree/8c50f3804c48044b78572d652a42184640e904d9
ConvPredictor
import torch import torch.nn as nn class ConvPredictor(nn.Module): def __init__(self, input_dim, output_dim, groups): super(ConvPredictor, self).__init__() self.feature_maps = input_dim self.groups = groups self.output_dim = output_dim self.conv = nn.Conv1d(in_channels=sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
TomScheffers/Residual-Prediction-Networks-using-Pytorch
ConvPredictor
false
5,908
[ "MIT" ]
1
c0e8b60c188414d71c389a0fd034f50017c24a93
https://github.com/TomScheffers/Residual-Prediction-Networks-using-Pytorch/tree/c0e8b60c188414d71c389a0fd034f50017c24a93
L2Norm
import torch import torch.nn as nn import torch.nn.init as init import torch.utils.data from numpy.random import * class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma = scale or None self.eps = 1e-1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.init as init import torch.utils.data from...
Tony-Khor/PyTorch-From-Zero-to-All
L2Norm
false
5,909
[ "MIT" ]
1
d8f9b6d81fe390dee93a887f342dc818553e61b3
https://github.com/Tony-Khor/PyTorch-From-Zero-to-All/tree/d8f9b6d81fe390dee93a887f342dc818553e61b3
Pooling
import torch import torch.nn as nn class Pooling(nn.Module): """ Implementation of pooling for PoolFormer --pool_size: pooling size """ def __init__(self, pool_size=3): super().__init__() self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size // 2, count_incl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
TranNhiem/MVAR_SSL
Pooling
false
5,910
[ "MIT" ]
1
339964db4d40f06a92866675ff99ef67cd968cca
https://github.com/TranNhiem/MVAR_SSL/tree/339964db4d40f06a92866675ff99ef67cd968cca
Transform
import torch import torch.nn as nn import torch.backends.cudnn def calc_mean_std(feat, eps=1e-05): size = feat.size() assert len(size) == 4 N, C = size[:2] feat_var = feat.view(N, C, -1).var(dim=2) + eps feat_std = feat_var.sqrt().view(N, C, 1, 1) feat_mean = feat.view(N, C, -1).mean(dim=2).vi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TimandXiyu/SANet-style-transfer-
Transform
false
5,911
[ "MIT" ]
1
91c3dd1344d1dded61aa2e79618240a49345b40e
https://github.com/TimandXiyu/SANet-style-transfer-/tree/91c3dd1344d1dded61aa2e79618240a49345b40e
VGG16
import torch import numpy as np import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F class Normalize: def __init__(self, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)): self.mean = mean self.std = std def undo(self, imgarr): proc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
SharhadBashar/1-stage-wseg
VGG16
false
5,913
[ "Apache-2.0" ]
1
83bf13444f5039ffed2de1605f09b3f90b525586
https://github.com/SharhadBashar/1-stage-wseg/tree/83bf13444f5039ffed2de1605f09b3f90b525586
L2Norm
import torch import torch.nn as nn class L2Norm(nn.Module): """Channel-wise L2 normalization.""" def __init__(self, in_channels): super(L2Norm, self).__init__() self.weight = nn.Parameter(torch.randn(in_channels)) def forward(self, x): """out = weight * x / sqrt(\\sum x_i^2)""" ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
TropComplique/ssd-pytorch
L2Norm
false
5,914
[ "MIT" ]
1
e91af875c65dc64a21b838a6645fc803ef690dcf
https://github.com/TropComplique/ssd-pytorch/tree/e91af875c65dc64a21b838a6645fc803ef690dcf
UnitNorm
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class UnitNorm(nn.Module): def forward(self, x): x = nn.functional.normalize(x, dim=1) return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[],...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
UMBCvision/CMSF
UnitNorm
false
5,915
[ "MIT" ]
1
4aaac1833a0c8cfd67aa05762e43478983d74c08
https://github.com/UMBCvision/CMSF/tree/4aaac1833a0c8cfd67aa05762e43478983d74c08
Whitening2d
import torch import torch.nn as nn from torch.cuda.amp import custom_fwd from torch.nn.functional import conv2d class Whitening2d(nn.Module): def __init__(self, output_dim: 'int', eps: 'float'=0.0): """Layer that computes hard whitening for W-MSE using the Cholesky decomposition. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
TranNhiem/MVAR_SSL
Whitening2d
false
5,916
[ "MIT" ]
1
339964db4d40f06a92866675ff99ef67cd968cca
https://github.com/TranNhiem/MVAR_SSL/tree/339964db4d40f06a92866675ff99ef67cd968cca
UpsampleConv2d
import torch import torch.nn.functional as F import torch.nn as nn class UpsampleConv2d(nn.Module): """ Avoid checkerboard patterns by upsampling the image and convolving. https://distill.pub/2016/deconv-checkerboard/ """ def __init__(self, in_channels, out_channels, kernel_size, stride, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
TrueMatthewKirkham/face-preserving-style-transfer
UpsampleConv2d
false
5,917
[ "MIT" ]
1
ae8a9509570227ea52776fba85658022124c886c
https://github.com/TrueMatthewKirkham/face-preserving-style-transfer/tree/ae8a9509570227ea52776fba85658022124c886c
LayerNormChannel
import torch import torch.nn as nn class LayerNormChannel(nn.Module): """ LayerNorm only for Channel Dimension. Input: tensor in shape [B, C, H, W] """ def __init__(self, num_channels, eps=1e-05): super().__init__() self.weight = nn.Parameter(torch.ones(num_channels)) self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
TranNhiem/MVAR_SSL
LayerNormChannel
false
5,918
[ "MIT" ]
1
339964db4d40f06a92866675ff99ef67cd968cca
https://github.com/TranNhiem/MVAR_SSL/tree/339964db4d40f06a92866675ff99ef67cd968cca
MarginRankingLearningLoss
import torch from torch import nn import torch.nn.functional as F class MarginRankingLearningLoss(nn.Module): def __init__(self, margin=1.0): super(MarginRankingLearningLoss, self).__init__() self.margin = margin def forward(self, inputs, targets): random = torch.randperm(inputs.size...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guard...
VKCOM/TopicsDataset
MarginRankingLearningLoss
false
5,919
[ "MIT" ]
1
149919321ba61a8f17b22f62f60f4aedec43d72b
https://github.com/VKCOM/TopicsDataset/tree/149919321ba61a8f17b22f62f60f4aedec43d72b
GumbelQuantizer
import torch import torch.nn as nn from torch.nn import functional as F class GumbelQuantizer(nn.Module): def __init__(self, input_dim, num_latents, embedding_dim): super().__init__() self.embedding_dim = embedding_dim self.num_latents = num_latents self.proj = nn.Conv2d(input_dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TobiasNorlund/vq-vae
GumbelQuantizer
false
5,920
[ "Apache-2.0" ]
1
bdfc35f35491e8d4877a13f7f84d6cbdcc69daa0
https://github.com/TobiasNorlund/vq-vae/tree/bdfc35f35491e8d4877a13f7f84d6cbdcc69daa0
Conv1dSamePadding
import torch from torch import nn import torch.nn.functional as F def conv1d_same_padding(input, weight, bias, stride, dilation, groups): kernel, dilation, stride = weight.size(2), dilation[0], stride[0] l_out = l_in = input.size(2) padding = (l_out - 1) * stride - l_in + dilation * (kernel - 1) + 1 i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.nn.functional as F assert_size_stride = torch....
UlysseCoteAllard/LongShortNetworkBipolar
Conv1dSamePadding
false
5,921
[ "Apache-2.0" ]
1
f6d146b967b4747f02d6589a0483d6c67394ee87
https://github.com/UlysseCoteAllard/LongShortNetworkBipolar/tree/f6d146b967b4747f02d6589a0483d6c67394ee87
ResidualBlock
import torch import torch.nn as nn class ResidualBlock(nn.Module): """Redisual network block for style transfer.""" def __init__(self, nchannels): """Create a block of a residual network.""" super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(nchannels, nchannels, kernel_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TrueMatthewKirkham/face-preserving-style-transfer
ResidualBlock
false
5,922
[ "MIT" ]
1
ae8a9509570227ea52776fba85658022124c886c
https://github.com/TrueMatthewKirkham/face-preserving-style-transfer/tree/ae8a9509570227ea52776fba85658022124c886c
MultiHeadAttention
import torch import numpy as np import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F class PositionalEncoding(nn.Module): def __init__(self, max_pos, d_k): super().__init__() self.w_rpr = nn.Linear(d_k, max_pos + 1, bias=False) def __call__(self, q, dist...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TomerRonen34/MeshCNN
MultiHeadAttention
false
5,923
[ "MIT" ]
1
8c50f3804c48044b78572d652a42184640e904d9
https://github.com/TomerRonen34/MeshCNN/tree/8c50f3804c48044b78572d652a42184640e904d9
FFN
import torch from torch import nn import torch.nn.functional as F class FFN(nn.Module): def __init__(self, d): super().__init__() self.fc_1 = nn.Linear(2 * d, 4 * d) self.drop = nn.Dropout(0.1) self.fc_2 = nn.Linear(4 * d, d) def forward(self, x_1, x_2): x = self.fc_1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
VKCOM/TopicsDataset
FFN
false
5,924
[ "MIT" ]
1
149919321ba61a8f17b22f62f60f4aedec43d72b
https://github.com/VKCOM/TopicsDataset/tree/149919321ba61a8f17b22f62f60f4aedec43d72b
GSAHelper
import torch from torch import nn class GSAHelper(nn.Module): def __init__(self, d): super().__init__() self.d = d self.fc_k = nn.Linear(self.d, self.d) self.fc_q = nn.Linear(self.d, self.d) self.fc_kq = nn.Linear(self.d, self.d) def forward(self, k, q): m = k...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
VKCOM/TopicsDataset
GSAHelper
false
5,925
[ "MIT" ]
1
149919321ba61a8f17b22f62f60f4aedec43d72b
https://github.com/VKCOM/TopicsDataset/tree/149919321ba61a8f17b22f62f60f4aedec43d72b
PoolFormerBlock
import math import torch import warnings import torch.nn as nn def _no_grad_trunc_normal_(tensor, mean, std, a, b): """Copy & paste from PyTorch official master until it's in a few official releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf """ def n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
TranNhiem/MVAR_SSL
PoolFormerBlock
false
5,926
[ "MIT" ]
1
339964db4d40f06a92866675ff99ef67cd968cca
https://github.com/TranNhiem/MVAR_SSL/tree/339964db4d40f06a92866675ff99ef67cd968cca
ActorCritic
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def log_normal_density(x, mean, log_std, std): """returns guassian density given x on log scale""" variance = std.pow(2) log_density = -(x - mean).pow(2) / (2 * variance) - 0.5 * np.log(2 * np.pi ) - ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Tzenthin/pytorch-ppo-sac-HalfCheetah-v2
ActorCritic
false
5,927
[ "MIT" ]
1
282a4104ec577056a141909e29dc97ed425a566c
https://github.com/Tzenthin/pytorch-ppo-sac-HalfCheetah-v2/tree/282a4104ec577056a141909e29dc97ed425a566c
AttentionPool2d
import torch from torch import nn from torch.nn import functional as F class AttentionPool2d(nn.Module): def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads: 'int', output_dim: 'int'=None): super().__init__() self.positional_embedding = nn.Parameter(torch.randn(spacial_dim ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Vaishaal/CLIP
AttentionPool2d
false
5,928
[ "MIT" ]
1
16adcf2a5ff41d6a3f1bb45165aa348031fdbafe
https://github.com/Vaishaal/CLIP/tree/16adcf2a5ff41d6a3f1bb45165aa348031fdbafe
AttnBahd
import torch from torch import nn as nn class AttnBahd(nn.Module): def __init__(self, encoder_out_dim, decoder_hid_dim, attn_dim=None): """ Attention mechanism :param encoder_out_dim: Dimension of hidden states of the encoder h_j :param decoder_hid_dim: Dimension of the hidden sta...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
UKPLab/acl2018-msr-workshop-binlin
AttnBahd
false
5,929
[ "Apache-2.0" ]
1
9b8021dfa14a8bc131df117fa9985699fc8cedea
https://github.com/UKPLab/acl2018-msr-workshop-binlin/tree/9b8021dfa14a8bc131df117fa9985699fc8cedea
GSA
import torch from torch import nn class GSAHelper(nn.Module): def __init__(self, d): super().__init__() self.d = d self.fc_k = nn.Linear(self.d, self.d) self.fc_q = nn.Linear(self.d, self.d) self.fc_kq = nn.Linear(self.d, self.d) def forward(self, k, q): m = k...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
VKCOM/TopicsDataset
GSA
false
5,930
[ "MIT" ]
1
149919321ba61a8f17b22f62f60f4aedec43d72b
https://github.com/VKCOM/TopicsDataset/tree/149919321ba61a8f17b22f62f60f4aedec43d72b
CpuSpeedModel
import torch import torch.nn as nn class CpuSpeedModel(nn.Module): def __init__(self, input_size, output_size): super(CpuSpeedModel, self).__init__() hidden_size = 100 self.linear1 = nn.Linear(input_size, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
VVKot/mlinsecond-general-cpu
CpuSpeedModel
false
5,931
[ "MIT" ]
1
d3e08027dc3152b5c88c2e5bf4b365eedbdcb0d1
https://github.com/VVKot/mlinsecond-general-cpu/tree/d3e08027dc3152b5c88c2e5bf4b365eedbdcb0d1
SinkhornKnopp
import torch import torch.distributed as dist class SinkhornKnopp(torch.nn.Module): def __init__(self, num_iters: 'int'=3, epsilon: 'float'=0.05, world_size: 'int'=1): """Approximates optimal transport using the Sinkhorn-Knopp algorithm. A simple iterative method to approach the double s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
TranNhiem/MVAR_SSL
SinkhornKnopp
false
5,932
[ "MIT" ]
1
339964db4d40f06a92866675ff99ef67cd968cca
https://github.com/TranNhiem/MVAR_SSL/tree/339964db4d40f06a92866675ff99ef67cd968cca
WeightNet
import torch import torch.nn as nn class WeightNet(nn.Module): """WeightNet in Temporal interlace module. The WeightNet consists of two parts: one convolution layer and a sigmoid function. Following the convolution layer, the sigmoid function and rescale module can scale our output to the range (0, 2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
VisualAnalysisOfHumans/LOVEU_TRACK1_TOP3_SUBMISSION
WeightNet
false
5,933
[ "MIT" ]
1
6f4d1c7e6883d6b0664fcd04265f437247afab54
https://github.com/VisualAnalysisOfHumans/LOVEU_TRACK1_TOP3_SUBMISSION/tree/6f4d1c7e6883d6b0664fcd04265f437247afab54
ResidualSequential
import torch import torch.optim import torch.nn as nn import torch.nn.init class ResidualSequential(nn.Sequential): def __init__(self, *args): super(ResidualSequential, self).__init__(*args) def forward(self, x): out = super(ResidualSequential, self).forward(x) x_ = None if o...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.optim import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_...
Volodimirich/DL-in-denoising-MCT-rock-images
ResidualSequential
false
5,934
[ "MIT" ]
1
0201d42a45221e4e0faaf50c59bf48c435bcdc82
https://github.com/Volodimirich/DL-in-denoising-MCT-rock-images/tree/0201d42a45221e4e0faaf50c59bf48c435bcdc82
TorchModule
import torch import torch.nn class TorchLinearModule(torch.nn.Module): def __init__(self, in_size, out_size): super(TorchLinearModule, self).__init__() self._linear = torch.nn.Linear(in_size, out_size) def forward(self, x): return self._linear(x) class TorchModule(torch.nn.Module):...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn ass...
VedPatwardhan/ivy
TorchModule
false
5,935
[ "Apache-2.0" ]
1
7b2105fa8cf38879444a1029bfaa7f0b2f27717a
https://github.com/VedPatwardhan/ivy/tree/7b2105fa8cf38879444a1029bfaa7f0b2f27717a
TVLoss
import torch from torch import Tensor import torch.utils.data import torch.utils.data.dataset import torch import torch.nn as nn import torch.utils.data.distributed class TVLoss(nn.Module): """Regularization loss based on Li FeiFei.""" def __init__(self, weight: 'Tensor') ->None: """The weight inform...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import Tensor import torch.utils.data import torch.utils.data.dataset import torch import torch.nn as nn import torch.utils.data....
Tubbz-alt/SRGAN-PyTorch-2
TVLoss
false
5,936
[ "Apache-2.0" ]
1
c1a01c99287a6212a3dc76ac17baafcf1c9f3013
https://github.com/Tubbz-alt/SRGAN-PyTorch-2/tree/c1a01c99287a6212a3dc76ac17baafcf1c9f3013
OffsetNet
import torch import torch.nn as nn class OffsetNet(nn.Module): """OffsetNet in Temporal interlace module. The OffsetNet consists of one convolution layer and two fc layers with a relu activation following with a sigmoid function. Following the convolution layer, two fc layers and relu are applied to ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VisualAnalysisOfHumans/LOVEU_TRACK1_TOP3_SUBMISSION
OffsetNet
false
5,937
[ "MIT" ]
1
6f4d1c7e6883d6b0664fcd04265f437247afab54
https://github.com/VisualAnalysisOfHumans/LOVEU_TRACK1_TOP3_SUBMISSION/tree/6f4d1c7e6883d6b0664fcd04265f437247afab54
CombinedPooling
import torch import torch.optim import torch.utils.data import torch.nn as nn import torch.nn.parallel import torch.utils.data.distributed class CombinedPooling(nn.Module): def __init__(self): super().__init__() self.max_pooling = nn.AdaptiveMaxPool2d(1) self.avg_pooling = nn.AdaptiveAvgP...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.optim import torch.utils.data import torch.nn as nn import torch.nn.parallel...
VisualComputingInstitute/CROWDBOT_perception
CombinedPooling
false
5,938
[ "MIT" ]
1
df98f3f658c39fb3fa4ac0456f1214f7918009f6
https://github.com/VisualComputingInstitute/CROWDBOT_perception/tree/df98f3f658c39fb3fa4ac0456f1214f7918009f6
SEModule
import torch import torch.nn as nn class SEModule(nn.Module): def __init__(self, channels, reduction=1 / 16): super().__init__() self.avg_pool = nn.AdaptiveAvgPool3d(1) self.bottleneck = self._round_width(channels, reduction) self.fc1 = nn.Conv3d(channels, self.bottleneck, kernel_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VisualAnalysisOfHumans/LOVEU_TRACK1_TOP3_SUBMISSION
SEModule
false
5,939
[ "MIT" ]
1
6f4d1c7e6883d6b0664fcd04265f437247afab54
https://github.com/VisualAnalysisOfHumans/LOVEU_TRACK1_TOP3_SUBMISSION/tree/6f4d1c7e6883d6b0664fcd04265f437247afab54
PointWiseFeedForward
import torch class PointWiseFeedForward(torch.nn.Module): def __init__(self, hidden_units, dropout_rate): super(PointWiseFeedForward, self).__init__() self.conv1 = torch.nn.Conv1d(hidden_units, hidden_units, kernel_size=1) self.dropout1 = torch.nn.Dropout(p=dropout_rate) self.relu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Vivdaddy/recsys-filterbubbles
PointWiseFeedForward
false
5,940
[ "MIT" ]
1
d21639bce515ffef5ba2db530dc2505eee1f83c0
https://github.com/Vivdaddy/recsys-filterbubbles/tree/d21639bce515ffef5ba2db530dc2505eee1f83c0
SigmaL1SmoothLoss
import torch from torch import nn class SigmaL1SmoothLoss(nn.Module): def forward(self, pred, targ): reg_diff = torch.abs(targ - pred) reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow( reg_diff, 2), reg_diff - 1 / 18) return reg_loss.mean() def get_inputs():...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
VrunArya/Hacktoberfest2021
SigmaL1SmoothLoss
false
5,941
[ "MIT" ]
1
5e739e52310dabf8b131abe5ecf906e13711b9d6
https://github.com/VrunArya/Hacktoberfest2021/tree/5e739e52310dabf8b131abe5ecf906e13711b9d6
ChebConv
import torch import torch.nn as nn import torch.nn.init as init class ChebConv(nn.Module): """ The ChebNet convolution operation. :param in_c: int, number of input dim :param out_c: int, number of output dim :param K: int, the order of Chebyshev Polynomial,切比雪夫展开多少阶 """ def __init__(self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
V-cyberpunk-01/GNN
ChebConv
false
5,942
[ "MIT" ]
1
25a6b24f4d8fad626af33f98e189b221c50406cd
https://github.com/V-cyberpunk-01/GNN/tree/25a6b24f4d8fad626af33f98e189b221c50406cd
Loss_fn
import torch import torch.nn as nn class Loss_fn(nn.Module): def __init__(self, eps=0.001): super().__init__() self.eps = eps def forward(self, ip, target): diff = ip - target loss = torch.mean(torch.sqrt(diff * diff + self.eps * self.eps)) return loss def get_input...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Vrushank264/Low-Light-Enhancement
Loss_fn
false
5,943
[ "MIT" ]
1
3c13a10a16eab8183b8fbd0c063d9815b662259a
https://github.com/Vrushank264/Low-Light-Enhancement/tree/3c13a10a16eab8183b8fbd0c063d9815b662259a
TemporallyBatchedAdditiveAttention
import torch import torch.nn as nn import torch.nn.functional as F class AdditiveAttention(nn.Module): def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim, internal_dim=None): super(AdditiveAttention, self).__init__() if internal_dim is None: internal_dim = i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Vision-CAIR/UnlikelihoodMotionForecasting
TemporallyBatchedAdditiveAttention
false
5,944
[ "MIT" ]
1
556d6a3ed3e4e0e2d88108d7dbb48933313b58aa
https://github.com/Vision-CAIR/UnlikelihoodMotionForecasting/tree/556d6a3ed3e4e0e2d88108d7dbb48933313b58aa
FocalLoss2d
import torch import torch.nn as nn class FocalLoss2d(nn.Module): def __init__(self, alpha=0.25, gamma=2, ignore_index=None, reduction= 'mean', **kwargs): super(FocalLoss2d, self).__init__() self.alpha = alpha self.gamma = gamma self.smooth = 1e-06 self.ignore_index...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
WHU-YH-jx/bionetwork_segmentation
FocalLoss2d
false
5,945
[ "MIT" ]
1
556c5b61a1a3784875b31eacb8c6bb418d70ee9a
https://github.com/WHU-YH-jx/bionetwork_segmentation/tree/556c5b61a1a3784875b31eacb8c6bb418d70ee9a
SpatialAttention
import torch import torch.nn as nn class CompressChannels(nn.Module): """ Compresses the input channels to 2 by concatenating the results of Global Average Pooling(GAP) and Global Max Pooling(GMP). HxWxC => HxWx2 """ def forward(self, x): return torch.cat((torch.max(x, 1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Vrushank264/Low-Light-Enhancement
SpatialAttention
false
5,946
[ "MIT" ]
1
3c13a10a16eab8183b8fbd0c063d9815b662259a
https://github.com/Vrushank264/Low-Light-Enhancement/tree/3c13a10a16eab8183b8fbd0c063d9815b662259a
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, input, target): smooth = 1e-05 num = target.size(0) input = input.view(num, -1) target = target.view(num, -1) intersection = input * target ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
WHU-YH-jx/bionetwork_segmentation
DiceLoss
false
5,947
[ "MIT" ]
1
556c5b61a1a3784875b31eacb8c6bb418d70ee9a
https://github.com/WHU-YH-jx/bionetwork_segmentation/tree/556c5b61a1a3784875b31eacb8c6bb418d70ee9a
DiffLoss
import torch import torch.nn as nn import torch.utils.checkpoint class DiffLoss(nn.Module): def __init__(self): super(DiffLoss, self).__init__() def forward(self, input1, input2): batch_size = input1.size(0) input1 = input1.view(batch_size, -1) input2 = input2.view(batch_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Wang-Chuanyu/MMSA
DiffLoss
false
5,948
[ "MIT" ]
1
2a720530c369e68656102287edb651780e827135
https://github.com/Wang-Chuanyu/MMSA/tree/2a720530c369e68656102287edb651780e827135
BBoxTransform
import torch from torch import nn import torch.onnx class BBoxTransform(nn.Module): def forward(self, anchors, regression): """ decode_box_outputs adapted from https://github.com/google/automl/blob/master/efficientdet/anchors.py Args: anchors: [batchsize, boxes, (y1, x1, y2, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.onnx assert_size_stride = torch._C._dyn...
Wabinab/eye_of_ml
BBoxTransform
false
5,949
[ "Apache-2.0" ]
1
9c475ddf4e56d84bc5a23d871d59169bc6061ab0
https://github.com/Wabinab/eye_of_ml/tree/9c475ddf4e56d84bc5a23d871d59169bc6061ab0
MSE
import torch import torch.nn as nn import torch.utils.checkpoint class MSE(nn.Module): def __init__(self): super(MSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) mse = torch.sum(diffs.pow(2)) / n return ms...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.checkpoint assert_size_stride = torch._C._dynamo...
Wang-Chuanyu/MMSA
MSE
false
5,950
[ "MIT" ]
1
2a720530c369e68656102287edb651780e827135
https://github.com/Wang-Chuanyu/MMSA/tree/2a720530c369e68656102287edb651780e827135
AdditiveAttention
import torch import torch.nn as nn import torch.nn.functional as F class AdditiveAttention(nn.Module): def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim, internal_dim=None): super(AdditiveAttention, self).__init__() if internal_dim is None: internal_dim = i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Vision-CAIR/UnlikelihoodMotionForecasting
AdditiveAttention
false
5,951
[ "MIT" ]
1
556d6a3ed3e4e0e2d88108d7dbb48933313b58aa
https://github.com/Vision-CAIR/UnlikelihoodMotionForecasting/tree/556d6a3ed3e4e0e2d88108d7dbb48933313b58aa
CapsuleLoss
import torch from torch import nn import torch.nn.functional as F class CapsuleLoss(nn.Module): def __init__(self): super(CapsuleLoss, self).__init__() def forward(self, output, target): class_loss = (target * F.relu(0.9 - output) + 0.5 * (1 - target) * F.relu(output - 0.1)).mean...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
WdBlink/AugMix-3DOCUNet-Brats2019
CapsuleLoss
false
5,952
[ "MIT" ]
1
125c6c8682b51a550eeac9173d13d0a211576abc
https://github.com/WdBlink/AugMix-3DOCUNet-Brats2019/tree/125c6c8682b51a550eeac9173d13d0a211576abc
DDPGConvBody
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class DDPGConvBody(nn.Module): def __init__(self, in_channels=4): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Sohojoe/UdacityDeepRL-Project2
DDPGConvBody
false
5,953
[ "MIT" ]
1
7137eea0b606ea32d00424d23130ff213f03ecf1
https://github.com/Sohojoe/UdacityDeepRL-Project2/tree/7137eea0b606ea32d00424d23130ff213f03ecf1
CustomKLLoss
import torch from torch.nn.modules.loss import _Loss class CustomKLLoss(_Loss): """ KL_Loss = (|dot(mean , mean)| + |dot(std, std)| - |log(dot(std, std))| - 1) / N N is the total number of image voxels """ def __init__(self, *args, **kwargs): super(CustomKLLoss, self).__init__() def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
WdBlink/AugMix-3DOCUNet-Brats2019
CustomKLLoss
false
5,954
[ "MIT" ]
1
125c6c8682b51a550eeac9173d13d0a211576abc
https://github.com/WdBlink/AugMix-3DOCUNet-Brats2019/tree/125c6c8682b51a550eeac9173d13d0a211576abc
SIMSE
import torch import torch.nn as nn import torch.utils.checkpoint class SIMSE(nn.Module): def __init__(self): super(SIMSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) simse = torch.sum(diffs).pow(2) / n ** 2 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.checkpoint assert_size_stride = torch._C._dynamo...
Wang-Chuanyu/MMSA
SIMSE
false
5,955
[ "MIT" ]
1
2a720530c369e68656102287edb651780e827135
https://github.com/Wang-Chuanyu/MMSA/tree/2a720530c369e68656102287edb651780e827135
GridAttentionBlock
import torch import torch.nn.functional as F import torch.nn as nn class GridAttentionBlock(nn.Module): def __init__(self, in_channels): super(GridAttentionBlock, self).__init__() self.inter_channels = in_channels self.in_channels = in_channels self.gating_channels = in_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
WHU-YH-jx/bionetwork_segmentation
GridAttentionBlock
false
5,956
[ "MIT" ]
1
556c5b61a1a3784875b31eacb8c6bb418d70ee9a
https://github.com/WHU-YH-jx/bionetwork_segmentation/tree/556c5b61a1a3784875b31eacb8c6bb418d70ee9a
Relu_Caps
import torch from torch import nn import torch.nn.functional as F class Relu_Caps(nn.Module): def __init__(self, num_C, num_D, theta=0.2, eps=0.0001): super(Relu_Caps, self).__init__() self.num_C = num_C self.num_D = num_D self.theta = theta self.eps = eps def forward...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
WdBlink/AugMix-3DOCUNet-Brats2019
Relu_Caps
false
5,957
[ "MIT" ]
1
125c6c8682b51a550eeac9173d13d0a211576abc
https://github.com/WdBlink/AugMix-3DOCUNet-Brats2019/tree/125c6c8682b51a550eeac9173d13d0a211576abc
DiceLoss
import torch from torch import nn from torch.autograd import Variable def compute_per_channel_dice(input, target, epsilon=1e-05, ignore_index= None, weight=None): assert input.size() == target.size( ), "'input' and 'target' must have the same shape" if ignore_index is not None: mask = targ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
WdBlink/AugMix-3DOCUNet-Brats2019
DiceLoss
false
5,958
[ "MIT" ]
1
125c6c8682b51a550eeac9173d13d0a211576abc
https://github.com/WdBlink/AugMix-3DOCUNet-Brats2019/tree/125c6c8682b51a550eeac9173d13d0a211576abc