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
_Transition
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from torchvision.transforms import * class _Transition(nn.Module): def __init__(self, in_channels, args): super(_Transit...
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 import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from torchvisi...
HelenR6/robustness-1
_Transition
false
11,142
[ "Apache-2.0" ]
0
5527250df02195dff37628a9d76ae7d76c3c51d1
https://github.com/HelenR6/robustness-1/tree/5527250df02195dff37628a9d76ae7d76c3c51d1
EmbedNet
from _paritybench_helpers import _mock_config import torch from torchvision.transforms import functional as F import torch.utils.data from torch import nn import torch.nn.functional as F class EmbedNet(nn.Module): def __init__(self, cfg): super(EmbedNet, self).__init__() self.embed_conv1 = nn.Con...
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.utils.data from ...
ZJU-lishuang/mega.pytorch
EmbedNet
false
11,143
[ "BSD-2-Clause" ]
0
d655e51084d0cbeaf8ab46f63491191dfe3a1ab9
https://github.com/ZJU-lishuang/mega.pytorch/tree/d655e51084d0cbeaf8ab46f63491191dfe3a1ab9
VGGBase
import torch import torchvision from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data def decimate(tensor, m): """ Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value. This is used when we conve...
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 torchvision from torch...
mosevg/ssd
VGGBase
false
11,144
[ "MIT" ]
0
8fd9f6cc376c027427531bcf475188ae43c4b2d6
https://github.com/mosevg/ssd/tree/8fd9f6cc376c027427531bcf475188ae43c4b2d6
SSD300
import torch import torchvision from torch import nn import torch.nn.functional as F from math import sqrt from itertools import product as product import torch.optim import torch.utils.data def decimate(tensor, m): """ Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value. This...
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....
mosevg/ssd
SSD300
false
11,145
[ "MIT" ]
0
8fd9f6cc376c027427531bcf475188ae43c4b2d6
https://github.com/mosevg/ssd/tree/8fd9f6cc376c027427531bcf475188ae43c4b2d6
Model
from torch.nn import Module import torch import torch.nn.functional from torch.nn.parameter import Parameter from torch.nn.modules import Module import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed from torch.nn import Parameter from torch.nn import Module class Mode...
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.nn import Module import torch.nn.functional from torch.nn.parameter import Parameter from torch.nn.modules import Module import t...
DeanChan/apex
Model
false
11,146
[ "BSD-3-Clause" ]
0
a03267e5e1209f559a6671da56c479a216f418d1
https://github.com/DeanChan/apex/tree/a03267e5e1209f559a6671da56c479a216f418d1
Normalize
import torch from torch import nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm) return out 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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Alan-Paul/ECN
Normalize
false
11,147
[ "Apache-2.0" ]
0
5e9a9081ff0c1e36cc0381df3ce9038a79a537e9
https://github.com/Alan-Paul/ECN/tree/5e9a9081ff0c1e36cc0381df3ce9038a79a537e9
GlobalAvgPool2d
import torch import torch.nn as nn import torch.nn.functional as F class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): N = x.data.size(0) C = x.data.size(1) H = x.data.size(2) W = x.data.size(3) x...
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...
Abdul-Mukit/ssp_with_hand_tracking
GlobalAvgPool2d
false
11,148
[ "MIT" ]
0
04429ac9789283694a9176b94f70ab4e5a8c0727
https://github.com/Abdul-Mukit/ssp_with_hand_tracking/tree/04429ac9789283694a9176b94f70ab4e5a8c0727
velocity_adding_neuron
import torch import torch.nn as nn class velocity_adding_neuron(nn.Module): def __init__(self, weight): super(velocity_adding_neuron, self).__init__() self.w = weight self.nl = nn.Tanh() def forward(self, x): return self.nl(self.w * x) def get_inputs(): return [torch.ra...
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_...
AgamChopra/simulation-in-a-box
velocity_adding_neuron
false
11,149
[ "MIT" ]
0
2a346a2fc83d79e542b64f1bd45c338d27a1934d
https://github.com/AgamChopra/simulation-in-a-box/tree/2a346a2fc83d79e542b64f1bd45c338d27a1934d
Sum
import torch import torch.nn as nn class Sum(nn.Module): def __init__(self, n, weight=False): super(Sum, self).__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=True ) ...
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...
Alex-Beh/hand_tracking
Sum
false
11,150
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
BCEBlurWithLogitsLoss
import torch import torch.nn as nn class BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super(BCEBlurWithLogitsLoss, self).__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): loss = self.loss_f...
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 torc...
Alex-Beh/hand_tracking
BCEBlurWithLogitsLoss
false
11,151
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
Relu
from torch.nn import Module import torch class Relu(Module): def forward(self, inp): return inp.clamp_min(0.0) - 0.5 def bwd(self, out, inp): inp.g = (inp > 0).float() * out.g 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.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
Akramz/Impractical-DL
Relu
false
11,152
[ "MIT" ]
0
ff909e369fb765c0857800925e39c433057ae8ac
https://github.com/Akramz/Impractical-DL/tree/ff909e369fb765c0857800925e39c433057ae8ac
Mse
from torch.nn import Module import torch class Mse(Module): def forward(self, inp, targ): return (inp.squeeze() - targ).pow(2).mean() def bwd(self, out, inp, targ): inp.g = 2 * (inp.squeeze() - targ).unsqueeze(-1) / targ.shape[0] def get_inputs(): return [torch.rand([4, 4, 4, 4]), torc...
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.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
Akramz/Impractical-DL
Mse
false
11,153
[ "MIT" ]
0
ff909e369fb765c0857800925e39c433057ae8ac
https://github.com/Akramz/Impractical-DL/tree/ff909e369fb765c0857800925e39c433057ae8ac
pheramon_output_neuron
import torch import torch.nn as nn class pheramon_output_neuron(nn.Module): def __init__(self, weight): super(pheramon_output_neuron, self).__init__() self.w = weight self.nl = nn.Sigmoid() def forward(self, x): return self.nl(self.w * x) def get_inputs(): return [torch...
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...
AgamChopra/simulation-in-a-box
pheramon_output_neuron
false
11,154
[ "MIT" ]
0
2a346a2fc83d79e542b64f1bd45c338d27a1934d
https://github.com/AgamChopra/simulation-in-a-box/tree/2a346a2fc83d79e542b64f1bd45c338d27a1934d
MaxPoolStride1
import torch import torch.nn as nn import torch.nn.functional as F class MaxPoolStride1(nn.Module): def __init__(self): super(MaxPoolStride1, self).__init__() def forward(self, x): x = F.max_pool2d(F.pad(x, (0, 1, 0, 1), mode='replicate'), 2, stride=1) return x 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Abdul-Mukit/ssp_with_hand_tracking
MaxPoolStride1
false
11,155
[ "MIT" ]
0
04429ac9789283694a9176b94f70ab4e5a8c0727
https://github.com/Abdul-Mukit/ssp_with_hand_tracking/tree/04429ac9789283694a9176b94f70ab4e5a8c0727
GeM
import torch import torch.nn as nn from torch.nn.parameter import Parameter def gem(x, p=3, eps=1e-06): return nn.functional.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x .size(-1))).pow(1.0 / p) class GeM(nn.Module): def __init__(self, p=3, eps=1e-06): super(GeM, self).__init__() ...
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 from t...
AlessandroRigoli/project_vg
GeM
false
11,156
[ "MIT" ]
0
cb1323bee60cdb4108fe0aab68791321c7974832
https://github.com/AlessandroRigoli/project_vg/tree/cb1323bee60cdb4108fe0aab68791321c7974832
Expand
import torch import torch.nn as nn class Expand(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, s, s, C // s ** 2, H, W) x = x.permute(0, 3, 4, 1, 5, 2).contigu...
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...
Alex-Beh/hand_tracking
Expand
false
11,157
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
SigmoidFocalClassificationLoss
import torch import torch.nn as nn class SigmoidFocalClassificationLoss(nn.Module): """ Sigmoid focal cross entropy loss. """ def __init__(self, gamma: 'float'=2.0, alpha: 'float'=0.25): """ Args: gamma: Weighting parameter to balance loss for hard and easy examples. ...
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 torc...
AhmedMoamen62/OpenPCDet
SigmoidFocalClassificationLoss
false
11,158
[ "Apache-2.0" ]
0
4d61d099819f40096f795def2c012990d03711cd
https://github.com/AhmedMoamen62/OpenPCDet/tree/4d61d099819f40096f795def2c012990d03711cd
Classify
import torch import torch.nn as nn def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class Classify(nn.Module): def __init__(self, c1, c2, k=1, s=1, p=None, g=1): super(Classify, self).__init__() self.aap = nn.AdaptiveAvgP...
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...
Alex-Beh/hand_tracking
Classify
false
11,159
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
L2Norm
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product import torch.nn.init as init class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma = scale or None ...
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 from math import sqrt as sqrt from itertools import produ...
AbhiprayaDash/models
L2Norm
false
11,160
[ "Apache-2.0" ]
0
ed679a701ccb5891ca4a02f9379c636c50cb9209
https://github.com/AbhiprayaDash/models/tree/ed679a701ccb5891ca4a02f9379c636c50cb9209
Net
import torch import torch.nn as nn import torch.nn.functional as functional class Net(nn.Module): def __init__(self): super().__init__() self.layer1 = nn.Linear(28 ** 2, 64) self.layer2 = nn.Linear(64, 10) def forward(self, x): x = x.view(-1, 28 ** 2) x = self.layer1(...
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_...
AlexTaguchi/ml-tutorial
Net
false
11,161
[ "MIT" ]
0
5b2693cd1648a72e9bcd6cee1223eedadba4b837
https://github.com/AlexTaguchi/ml-tutorial/tree/5b2693cd1648a72e9bcd6cee1223eedadba4b837
Hardswish
import torch import torch.nn as nn import torch.nn.functional as F class Hardswish(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Alex-Beh/hand_tracking
Hardswish
false
11,162
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
Contract
import torch import torch.nn as nn class Contract(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, C, H // s, s, W // s, s) x = x.permute(0, 3, 5, 1, 2, 4).conti...
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...
Alex-Beh/hand_tracking
Contract
false
11,163
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
ShuffleBlock
import torch import torch.nn as nn class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.size(...
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...
AlexHoffman9/HAET-2021-competition-baseline-code
ShuffleBlock
false
11,164
[ "MIT" ]
0
1d71c94c68c9903854eceda6caf07442930caa44
https://github.com/AlexHoffman9/HAET-2021-competition-baseline-code/tree/1d71c94c68c9903854eceda6caf07442930caa44
WeightedCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class WeightedCrossEntropyLoss(nn.Module): """ Transform input to fit the fomation of PyTorch offical cross entropy loss with anchor-wise weighting. """ def __init__(self): super(WeightedCrossEntropyLoss, self).__init__() ...
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 ...
AhmedMoamen62/OpenPCDet
WeightedCrossEntropyLoss
false
11,165
[ "Apache-2.0" ]
0
4d61d099819f40096f795def2c012990d03711cd
https://github.com/AhmedMoamen62/OpenPCDet/tree/4d61d099819f40096f795def2c012990d03711cd
MemoryEfficientMish
import torch import torch.nn as nn import torch.nn.functional as F class MemoryEfficientMish(nn.Module): class F(torch.autograd.Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) return x.mul(torch.tanh(F.softplus(x))) @staticmethod d...
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, math as tl_math import torch.nn as nn import torch.nn.functional as F assert_s...
Alex-Beh/hand_tracking
MemoryEfficientMish
false
11,166
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
ConvAutoencoder
import torch from torch import nn class ConvAutoencoder(nn.Module): def __init__(self, enc_dim=10, channels=1, strides=1): super().__init__() self.conv1 = nn.Conv1d(channels, enc_dim, 7, strides, padding=0) self.dropout = nn.Dropout(0.2) self.t_conv1 = nn.ConvTranspose1d(enc_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
AlexMetsai/pytorch-time-series-autoencoder
ConvAutoencoder
false
11,167
[ "MIT" ]
0
460e364edcb7c7a84d2e544a22cd48f51cdda4aa
https://github.com/AlexMetsai/pytorch-time-series-autoencoder/tree/460e364edcb7c7a84d2e544a22cd48f51cdda4aa
L2Norm
import torch import torch.nn as nn import torch.nn.functional as F class L2Norm(nn.Module): def __init__(self, dim=1): super().__init__() self.dim = dim def forward(self, x): return F.normalize(x, p=2, dim=self.dim) 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
AlessandroRigoli/project_vg
L2Norm
false
11,168
[ "MIT" ]
0
cb1323bee60cdb4108fe0aab68791321c7974832
https://github.com/AlessandroRigoli/project_vg/tree/cb1323bee60cdb4108fe0aab68791321c7974832
MemoryEfficientSwish
import torch import torch.nn as nn class MemoryEfficientSwish(nn.Module): class F(torch.autograd.Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) return x * torch.sigmoid(x) @staticmethod def backward(ctx, grad_output): ...
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...
Alex-Beh/hand_tracking
MemoryEfficientSwish
false
11,169
[ "Apache-2.0" ]
0
40ac39e10ed5815d9400d6a87149015ad6ab9686
https://github.com/Alex-Beh/hand_tracking/tree/40ac39e10ed5815d9400d6a87149015ad6ab9686
PositionwiseFeedForward
import torch import torch.nn.functional as F import torch.nn as nn class PositionwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.1): super().__init__() self.w_1 = nn.Linear(d_in, d_hid) self.w_2 = nn.Linear(d_hid, d_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....
AbubakrHassan/attention-is-all-you-need-pytorch
PositionwiseFeedForward
false
11,170
[ "MIT" ]
0
2bf9a477dea6271b082556069f3665ffed2745cd
https://github.com/AbubakrHassan/attention-is-all-you-need-pytorch/tree/2bf9a477dea6271b082556069f3665ffed2745cd
RSoftmax
import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization class RSoftmax(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input. """ def __init__(self, radix...
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 ...
AlexanderDokuchaev/mmsegmentation
RSoftmax
false
11,171
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
Conv2dDynamicSamePadding
import math import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization class Conv2dDynamicSamePadding(nn.Conv2d): """2D Convolutions like TensorFlow, for a dynamic image size. The padding is operated in forward function by calculating dynamically. """ ...
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 import torch._C import torch.serialization assert_size_str...
AlexanderDokuchaev/mmsegmentation
Conv2dDynamicSamePadding
false
11,172
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
orientation_neuron
import torch import torch.nn as nn class orientation_neuron(nn.Module): def __init__(self, weight): super(orientation_neuron, self).__init__() self.w = weight self.nl = nn.Sigmoid() def forward(self, x): return self.nl(self.w * x) * 360.0 def get_inputs(): return [torch...
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...
AgamChopra/simulation-in-a-box
orientation_neuron
false
11,173
[ "MIT" ]
0
2a346a2fc83d79e542b64f1bd45c338d27a1934d
https://github.com/AgamChopra/simulation-in-a-box/tree/2a346a2fc83d79e542b64f1bd45c338d27a1934d
Attention
import torch from torch import nn class Attention(nn.Module): """ Attention Network. """ def __init__(self, encoder_dim, decoder_dim, attention_dim): """ :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_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....
AlexMeinke/serverless-hosting-of-image-captioning
Attention
false
11,174
[ "MIT" ]
0
2b539561ac600e6a502ac4ecb25948a50e26cc54
https://github.com/AlexMeinke/serverless-hosting-of-image-captioning/tree/2b539561ac600e6a502ac4ecb25948a50e26cc54
GLU
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class GLU(nn.Module): def __init__(self): super(GLU, self).__init__() def forward(self, x): nc = x.size(1) assert nc % 2 == 0, 'channels dont divide 2!' nc = int(nc / 2) 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 import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
Abrantex/finegan
GLU
false
11,175
[ "BSD-2-Clause" ]
0
0d60105fd81abaa945cebb2232dbed703fe319f0
https://github.com/Abrantex/finegan/tree/0d60105fd81abaa945cebb2232dbed703fe319f0
PPMConcat
import torch import torch.nn as nn import torch._C import torch.serialization class PPMConcat(nn.ModuleList): """Pyramid Pooling Module that only concat the features of each layer. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. """ def __init__(sel...
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 import torch._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
AlexanderDokuchaev/mmsegmentation
PPMConcat
false
11,176
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
SE
import torch import torch.nn as nn import torch.nn.functional as F class SE(nn.Module): """Squeeze-and-Excitation block.""" def __init__(self, in_planes, se_planes): super(SE, self).__init__() self.se1 = nn.Conv2d(in_planes, se_planes, kernel_size=1, bias=True) self.se2 = nn.Conv2d(se...
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_...
AlexHoffman9/HAET-2021-competition-baseline-code
SE
false
11,177
[ "MIT" ]
0
1d71c94c68c9903854eceda6caf07442930caa44
https://github.com/AlexHoffman9/HAET-2021-competition-baseline-code/tree/1d71c94c68c9903854eceda6caf07442930caa44
Network
import torch class Network(torch.nn.Module): def __init__(self): super(Network, self).__init__() self.conv1 = torch.nn.Conv2d(1, 64, kernel_size=5) self.conv2 = torch.nn.Conv2d(64, 512, kernel_size=5) self.fc1 = torch.nn.Linear(2048, 256) self.fc2 = torch.nn.Linear(256, 12...
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....
AbrahamAcosta/leaves_cnn
Network
false
11,178
[ "MIT" ]
0
e6be28ef696dc427aa50c7d4581a29a05d1e7a94
https://github.com/AbrahamAcosta/leaves_cnn/tree/e6be28ef696dc427aa50c7d4581a29a05d1e7a94
TD3Critic
import torch import torch.nn as nn import torch.nn.functional as F class TD3Critic(nn.Module): def __init__(self, state_dim, action_dim): super(TD3Critic, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, 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 import ...
AkiraHero/rlll
TD3Critic
false
11,179
[ "MIT" ]
0
f86e1105600629d29b8dca7a7483e7dcb8253056
https://github.com/AkiraHero/rlll/tree/f86e1105600629d29b8dca7a7483e7dcb8253056
TD3Actor
import torch import torch.nn as nn import torch.nn.functional as F class TD3Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(TD3Actor, self).__init__() self.l1 = nn.Linear(state_dim, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, action_d...
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....
AkiraHero/rlll
TD3Actor
false
11,180
[ "MIT" ]
0
f86e1105600629d29b8dca7a7483e7dcb8253056
https://github.com/AkiraHero/rlll/tree/f86e1105600629d29b8dca7a7483e7dcb8253056
InputInjection
import torch import torch.nn as nn import torch._C import torch.serialization class InputInjection(nn.Module): def __init__(self, ratio): super().__init__() self.pool = nn.ModuleList() for i in range(0, ratio): self.pool.append(nn.AvgPool2d(3, stride=2, padding=1)) def fo...
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 import torch._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
AlexanderDokuchaev/mmsegmentation
InputInjection
false
11,181
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
EncoderLayer
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
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....
AbubakrHassan/attention-is-all-you-need-pytorch
EncoderLayer
false
11,182
[ "MIT" ]
0
2bf9a477dea6271b082556069f3665ffed2745cd
https://github.com/AbubakrHassan/attention-is-all-you-need-pytorch/tree/2bf9a477dea6271b082556069f3665ffed2745cd
ExampleBackbone
import torch import torch.nn as nn import torch._C import torch.serialization class ExampleBackbone(nn.Module): def __init__(self): super(ExampleBackbone, self).__init__() self.conv = nn.Conv2d(3, 3, 3) def init_weights(self, pretrained=None): pass def forward(self, x): ...
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 import torch._C import torch.serialization assert_size_str...
AlexanderDokuchaev/mmsegmentation
ExampleBackbone
false
11,183
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
DecoderLayer
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
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....
AbubakrHassan/attention-is-all-you-need-pytorch
DecoderLayer
false
11,184
[ "MIT" ]
0
2bf9a477dea6271b082556069f3665ffed2745cd
https://github.com/AbubakrHassan/attention-is-all-you-need-pytorch/tree/2bf9a477dea6271b082556069f3665ffed2745cd
UpSample
import torch import torch.nn as nn import torch._C import torch.serialization class UpSample(nn.Module): def __init__(self, n_chan, factor=2): super(UpSample, self).__init__() out_chan = n_chan * factor * factor self.proj = nn.Conv2d(n_chan, out_chan, 1, 1, 0) self.up = nn.PixelSh...
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 import torch._C import torch.serialization assert_size_str...
AlexanderDokuchaev/mmsegmentation
UpSample
false
11,185
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
IOU
import torch def _iou(pred, target, size_average=True): b = pred.shape[0] IoU = 0.0 for i in range(0, b): Iand1 = torch.sum(target[i, :, :, :] * pred[i, :, :, :]) Ior1 = torch.sum(target[i, :, :, :]) + torch.sum(pred[i, :, :, :] ) - Iand1 IoU1 = Iand1 / Ior1 IoU...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
AlvinWen428/BASNet
IOU
false
11,186
[ "MIT" ]
0
2af21e0333204b8adcb9565b33a0bf72f5471db5
https://github.com/AlvinWen428/BASNet/tree/2af21e0333204b8adcb9565b33a0bf72f5471db5
AngularPWConv
import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization def normalize(x, dim, p=2, eps=1e-12): if torch.onnx.is_in_onnx_export(): return OnnxLpNormalization.apply(x, dim, p, eps) else: return F.normalize(x, dim=dim, p=p, eps=eps) class On...
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....
AlexanderDokuchaev/mmsegmentation
AngularPWConv
false
11,187
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
EdgeGateFree
import torch import torch.nn as nn from torch.nn import Parameter class EdgeGateFree(nn.Module): """ Calculate gates for each edge in message passing. The gates are free parameters. Note: This will make the parameters depend on the number of edges, which will limit the model to work on...
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.nn import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = to...
AnchoretY/botnet-detection
EdgeGateFree
false
11,188
[ "MIT" ]
0
e2066ff314f1ea2ccbf4c10ddff819f344a2b715
https://github.com/AnchoretY/botnet-detection/tree/e2066ff314f1ea2ccbf4c10ddff819f344a2b715
Encoding
import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization class Encoding(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels). Ar...
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 ...
AlexanderDokuchaev/mmsegmentation
Encoding
false
11,189
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
DiceLoss
import functools import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "...
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 functools impor...
AlexanderDokuchaev/mmsegmentation
DiceLoss
false
11,190
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
PSPModule
import torch import torch.nn as nn import torch._C import torch.serialization class PSPModule(nn.Module): """Reference: https://github.com/MendelXu/ANN """ methods = {'max': nn.AdaptiveMaxPool2d, 'avg': nn.AdaptiveAvgPool2d} def __init__(self, sizes=(1, 3, 6, 8), method='max'): super().__init...
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._C import torch.serialization assert_size_stride = tor...
AlexanderDokuchaev/mmsegmentation
PSPModule
false
11,191
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
Model
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor'): return x * y def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Archermmt/tvm
Model
false
11,192
[ "Apache-2.0" ]
0
8b900cec1a9c3cb453e159db4d497ebeb26ed289
https://github.com/Archermmt/tvm/tree/8b900cec1a9c3cb453e159db4d497ebeb26ed289
UpsamplingBilinear
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class UpsamplingBilinear(nn.Module): def __init__(self): super().__init__() self.quant = QuantStub() self.dequant = DeQuantStub() def forward(self, x): x = 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 import triton_helpers import torch.nn as nn from torch.quantization import QuantStub from torch.quantization im...
Archermmt/tvm
UpsamplingBilinear
false
11,193
[ "Apache-2.0" ]
0
8b900cec1a9c3cb453e159db4d497ebeb26ed289
https://github.com/Archermmt/tvm/tree/8b900cec1a9c3cb453e159db4d497ebeb26ed289
Hswish
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class Hswish(nn.Module): def __init__(self, add_stub=False): super().__init__() self.quant = QuantStub() self.dequant = DeQuantStub() self.add_stub = add_stub ...
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 from torch.quantization import QuantStub from torch.quantization im...
Archermmt/tvm
Hswish
false
11,194
[ "Apache-2.0" ]
0
8b900cec1a9c3cb453e159db4d497ebeb26ed289
https://github.com/Archermmt/tvm/tree/8b900cec1a9c3cb453e159db4d497ebeb26ed289
SEModule
import torch import torch.nn as nn import torch.nn.functional as F class SEModule(nn.Module): def __init__(self, planes, compress_rate): super(SEModule, self).__init__() self.conv1 = nn.Conv2d(planes, planes // compress_rate, kernel_size =1, stride=1, bias=True) self.conv2 = 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_...
AlexTintin/Face_Recognition_CV_Project
SEModule
false
11,195
[ "MIT" ]
0
6becb159dd3d8f547d617983bd422e3f2a9fb52e
https://github.com/AlexTintin/Face_Recognition_CV_Project/tree/6becb159dd3d8f547d617983bd422e3f2a9fb52e
GCN
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __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....
AlexHeffner/pygcn
GCN
false
11,196
[ "MIT" ]
0
514f4329209a3bf9c75beba97af42d2c1bf8c129
https://github.com/AlexHeffner/pygcn/tree/514f4329209a3bf9c75beba97af42d2c1bf8c129
TverskyLoss
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization def get_class_weight(class_weight): """Get class weight for loss function. Args: class_weight (list[float] | str | None): If class_weight is a str, take it as a...
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 numpy as np imp...
AlexanderDokuchaev/mmsegmentation
TverskyLoss
false
11,197
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
ScaledDotProductAttention
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
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....
AbubakrHassan/attention-is-all-you-need-pytorch
ScaledDotProductAttention
false
11,198
[ "MIT" ]
0
2bf9a477dea6271b082556069f3665ffed2745cd
https://github.com/AbubakrHassan/attention-is-all-you-need-pytorch/tree/2bf9a477dea6271b082556069f3665ffed2745cd
ResNeXtBottleneck
import torch import torch.nn as nn import torch.nn.functional as F class ResNeXtBottleneck(nn.Module): def __init__(self, in_channels=256, out_channels=256, stride=1, cardinality=32, dilate=1): super(ResNeXtBottleneck, self).__init__() D = out_channels // 2 self.out_channels = out...
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...
AlexWang000/AlacGAN
ResNeXtBottleneck
false
11,199
[ "MIT" ]
0
3b9df7c25c3e95b7727b00fa789cab0cf7d46266
https://github.com/AlexWang000/AlacGAN/tree/3b9df7c25c3e95b7727b00fa789cab0cf7d46266
MultiHeadAttention
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
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....
AbubakrHassan/attention-is-all-you-need-pytorch
MultiHeadAttention
false
11,200
[ "MIT" ]
0
2bf9a477dea6271b082556069f3665ffed2745cd
https://github.com/AbubakrHassan/attention-is-all-you-need-pytorch/tree/2bf9a477dea6271b082556069f3665ffed2745cd
MulScalarNegative
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class MulScalarNegative(nn.Module): def __init__(self): super().__init__() self.float_op = nn.quantized.FloatFunctional() self.quant = QuantStub() self.dequant = ...
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.quantization import QuantStub from torch.quantization import DeQuantStub assert_size_stride = torch._C._dyn...
Archermmt/tvm
MulScalarNegative
false
11,201
[ "Apache-2.0" ]
0
8b900cec1a9c3cb453e159db4d497ebeb26ed289
https://github.com/Archermmt/tvm/tree/8b900cec1a9c3cb453e159db4d497ebeb26ed289
AvgConsensus
import torch import torch.nn as nn class AvgConsensus(nn.Module): """Average consensus module. Args: dim (int): Decide which dim consensus function to apply. Default: 1. """ def __init__(self, dim=1): super().__init__() self.dim = dim def forward(self, x): ...
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...
Alexis-Fab/mmaction2
AvgConsensus
false
11,202
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
Hsigmoid
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class Hsigmoid(nn.Module): def __init__(self, add_stub=False): super().__init__() self.quant = QuantStub() self.dequant = DeQuantStub() self.add_stub = add_stub ...
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 from torch.quantization import QuantStub from torch.quantization im...
Archermmt/tvm
Hsigmoid
false
11,203
[ "Apache-2.0" ]
0
8b900cec1a9c3cb453e159db4d497ebeb26ed289
https://github.com/Archermmt/tvm/tree/8b900cec1a9c3cb453e159db4d497ebeb26ed289
FeedForward_NN
import torch import torch.nn as nn class FeedForward_NN(nn.Module): def __init__(self, input_size, hidden_layer, output_size): super(FeedForward_NN, self).__init__() self.layer1 = nn.Linear(input_size, hidden_layer) self.relu = nn.ReLU() self.layer2 = nn.Linear(hidden_layer, outpu...
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_...
AqibJavaid899/PyTorch_Models
FeedForward_NN
false
11,204
[ "MIT" ]
0
cf81f6ef5d81aed76dca3f1a15be1a308b5d450f
https://github.com/AqibJavaid899/PyTorch_Models/tree/cf81f6ef5d81aed76dca3f1a15be1a308b5d450f
SpatialGatherModule
import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization class SpatialGatherModule(nn.Module): """Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted method to aggregate the context. ...
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....
AlexanderDokuchaev/mmsegmentation
SpatialGatherModule
false
11,205
[ "Apache-2.0" ]
0
0c443ee370cce6227661b802184072174c4e3f64
https://github.com/AlexanderDokuchaev/mmsegmentation/tree/0c443ee370cce6227661b802184072174c4e3f64
BalancedL1Loss
import functools import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tenso...
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 functools impor...
AtticusJohnson/mmdetection
BalancedL1Loss
false
11,206
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
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...
Alexis-Fab/mmaction2
WeightNet
false
11,207
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
NN
import torch import torch.nn as nn class NN(nn.Module): def __init__(self, input, hidden, output): super(NN, self).__init__() self.lin1 = nn.Linear(input, hidden) self.lin2 = nn.Linear(hidden, output) def forward(self, X): out = torch.sigmoid(self.lin1(X)) out = torch...
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...
AqibJavaid899/PyTorch_Models
NN
false
11,208
[ "MIT" ]
0
cf81f6ef5d81aed76dca3f1a15be1a308b5d450f
https://github.com/AqibJavaid899/PyTorch_Models/tree/cf81f6ef5d81aed76dca3f1a15be1a308b5d450f
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...
AnimeshGurjar/ivy
TorchModule
false
11,209
[ "Apache-2.0" ]
0
e598872d96b8f7a1db461f005bec99cd0400ecec
https://github.com/AnimeshGurjar/ivy/tree/e598872d96b8f7a1db461f005bec99cd0400ecec
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 ...
Alexis-Fab/mmaction2
BinaryLogisticRegressionLoss
false
11,210
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
CrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
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 ...
AtticusJohnson/mmdetection
CrossEntropyLoss
false
11,211
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
OutConv
import torch import torch.nn as nn class OutConv(nn.Module): def __init__(self, in_channels, out_channels): super(OutConv, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch....
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...
AtharvBhat/EstimateDepth
OutConv
false
11,212
[ "MIT" ]
0
f440a9e8372ca2346cae8634f396bac06d004bf7
https://github.com/AtharvBhat/EstimateDepth/tree/f440a9e8372ca2346cae8634f396bac06d004bf7
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_...
Alexis-Fab/mmaction2
OffsetNet
false
11,213
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
PFF
import torch import torch.nn as nn class PFF(nn.Module): def __init__(self, model_dimension, width_mult=4): super().__init__() self.linear1 = nn.Linear(model_dimension, width_mult * model_dimension) self.linear2 = nn.Linear(width_mult * model_dimension, model_dimension) self.norm ...
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....
AmitNikhade/MyTransformer
PFF
false
11,214
[ "Apache-2.0" ]
0
d717ee1db59ba60bb6b3f1b8a705f6ebed6df1e5
https://github.com/AmitNikhade/MyTransformer/tree/d717ee1db59ba60bb6b3f1b8a705f6ebed6df1e5
BertLayerNorm
import torch import torch.nn as nn class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_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 libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AterhiM/BERT-E2E-ABSA
BertLayerNorm
false
11,215
[ "Apache-2.0" ]
0
9266a851fd1d7164eb0fc422d3f5eb02e474080b
https://github.com/AterhiM/BERT-E2E-ABSA/tree/9266a851fd1d7164eb0fc422d3f5eb02e474080b
GHMR
import torch import torch.nn as nn class GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper "Gradient Harmonized Single-stage Detector" https://arxiv.org/abs/1811.05181 Args: mu (float): The parameter for the Authentic Smooth L1 loss. bins ...
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 torc...
AtticusJohnson/mmdetection
GHMR
false
11,216
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
SEModule
import torch import torch.nn as nn class SEModule(nn.Module): def __init__(self, channels, reduction): super().__init__() self.avg_pool = nn.AdaptiveAvgPool3d(1) self.bottleneck = self._round_width(channels, reduction) self.fc1 = nn.Conv3d(channels, self.bottleneck, kernel_size=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_...
Alexis-Fab/mmaction2
SEModule
false
11,217
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
GHMC
import torch import torch.nn as nn import torch.nn.functional as F def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero((labels >= 0) & (labels < label_channels), as_tuple=False).squeeze() if inds.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 math as tl_math import torch.nn as nn ...
AtticusJohnson/mmdetection
GHMC
false
11,218
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
EmbedE
import torch from torch import nn from torch.functional import F class EmbedE(nn.Module): def __init__(self, l_in, l_h, l_g): super(EmbedE, self).__init__() self.fc = nn.Linear(l_in, l_h * l_g) def forward(self, h): h = F.relu(self.fc(h)) return h def get_inputs(): 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 import triton_helpers from torch import nn assert_s...
AnnaNikitaML/GraphConvolutionalNetwork
EmbedE
false
11,219
[ "MIT" ]
0
2f3153b82fad10cdd33d261a77e08f77fa37d36a
https://github.com/AnnaNikitaML/GraphConvolutionalNetwork/tree/2f3153b82fad10cdd33d261a77e08f77fa37d36a
ConvWS2d
import torch import torch.nn as nn import torch.nn.functional as F def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c_in, 1, 1, 1) std = weight...
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 ...
AtticusJohnson/mmdetection
ConvWS2d
false
11,220
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
ConvTemporalGraphical
import torch import torch.nn as nn class ConvTemporalGraphical(nn.Module): """The basic module for applying a graph convolution. Args: in_channels (int): Number of channels in the input sequence data out_channels (int): Number of channels produced by the convolution kernel_size (int):...
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...
Alexis-Fab/mmaction2
ConvTemporalGraphical
false
11,221
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
L1Loss
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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 functools impor...
AtticusJohnson/mmdetection
L1Loss
false
11,222
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
Model
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): super(Model, self).__init__() self.layer1 = nn.Linear(input_dim, hidden_dim) self.sigmoid = nn.Sigmoid() self.layer2 = nn.Linear(hidden_dim, output_dim) def forwa...
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...
AyushSomani001/CreditCardFraud
Model
false
11,223
[ "MIT" ]
0
015d4992e543889edb6a47ba13d997ace8d1c51c
https://github.com/AyushSomani001/CreditCardFraud/tree/015d4992e543889edb6a47ba13d997ace8d1c51c
GlobalAvgPool2d
import torch import torch.nn as nn class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): in_size = inputs.size() return inputs.view((in_size[0],...
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...
AwaleSajil/BiSeNet
GlobalAvgPool2d
false
11,224
[ "MIT" ]
0
2724941ef4052224c5581e6e42389e71a7c5cd5d
https://github.com/AwaleSajil/BiSeNet/tree/2724941ef4052224c5581e6e42389e71a7c5cd5d
L2Norm
import torch import torch.nn as nn class L2Norm(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): super(L2Norm, self).__init__() self.n_dims = n_dims self.weight = nn.Parameter(torch.Tensor(self.n_dims)) self.eps = eps self.scale = scale def forward(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_...
AtticusJohnson/mmdetection
L2Norm
false
11,225
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
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...
Alexis-Fab/mmaction2
BMNLoss
false
11,226
[ "Apache-2.0" ]
0
6f76bb465a7164f907318cf58f77fc3d613f8f0f
https://github.com/Alexis-Fab/mmaction2/tree/6f76bb465a7164f907318cf58f77fc3d613f8f0f
AffineChannel2d
import torch import torch.utils.data from torch import nn class AffineChannel2d(nn.Module): """ A simple channel-wise affine transformation operation """ def __init__(self, num_channels, eps=1e-05): super().__init__() self.num_channels = num_channels self.eps = eps self.weight...
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._...
BUPT-PRIV/detectron2
AffineChannel2d
false
11,227
[ "Apache-2.0" ]
0
3163664cd5f43d50ea1966f410dc82410b9ccbf4
https://github.com/BUPT-PRIV/detectron2/tree/3163664cd5f43d50ea1966f410dc82410b9ccbf4
Accuracy
import torch import torch.nn.functional as F import torch.nn as nn class Accuracy(nn.Module): def __init__(self): super().__init__() def forward(self, prediction, target, mask=None, token_dim=-1, sequence_dim=-2): prediction = F.softmax(prediction, token_dim).argmax(sequence_dim) ...
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 ...
BShennette/Pno-ai
Accuracy
false
11,228
[ "MIT" ]
0
486434bfb40887d06e3d12a66831b9e0e7d020c2
https://github.com/BShennette/Pno-ai/tree/486434bfb40887d06e3d12a66831b9e0e7d020c2
TripletLoss
import torch import torch.nn as nn import torch.nn.functional as F class TripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin): super(TripletLoss, self).__init__() self.margin = margin ...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AytacKahveci/siamese-triplet
TripletLoss
false
11,229
[ "BSD-3-Clause" ]
0
09860e36d934bb1773a4d49dbad183a5152cb0b0
https://github.com/AytacKahveci/siamese-triplet/tree/09860e36d934bb1773a4d49dbad183a5152cb0b0
ContrastiveLoss
import torch import torch.nn as nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): """ Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise """ def __init__(self, margin): super(ContrastiveLo...
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...
AytacKahveci/siamese-triplet
ContrastiveLoss
false
11,230
[ "BSD-3-Clause" ]
0
09860e36d934bb1773a4d49dbad183a5152cb0b0
https://github.com/AytacKahveci/siamese-triplet/tree/09860e36d934bb1773a4d49dbad183a5152cb0b0
MSELoss
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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 functools import torch.nn as nn import torch.nn.functional as F assert_size_stride...
AtticusJohnson/mmdetection
MSELoss
false
11,231
[ "Apache-2.0" ]
0
d8d89bafcce13d3b32b1fb3366be3bb9830546c2
https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5, 120) ...
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_...
AlexHoffman9/HAET-2021-competition-baseline-code
Net
false
11,232
[ "MIT" ]
0
1d71c94c68c9903854eceda6caf07442930caa44
https://github.com/AlexHoffman9/HAET-2021-competition-baseline-code/tree/1d71c94c68c9903854eceda6caf07442930caa44
ConvNet
import torch import torch.nn as nn import torch.nn.functional as F class ConvNet(nn.Module): def __init__(self): super(ConvNet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5,...
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_...
AndrewAltimit/Scene-Classification-AWS-Serverless
ConvNet
false
11,234
[ "MIT" ]
0
caa4bff102987338dcfa597b9ec1638e6e5e63f5
https://github.com/AndrewAltimit/Scene-Classification-AWS-Serverless/tree/caa4bff102987338dcfa597b9ec1638e6e5e63f5
CustomizedLayer
import torch import torch.nn as nn import torch.utils.data class CustomizedLayer(nn.Module): def __init__(self, in_dim): super().__init__() self.in_dim = in_dim self.scale = nn.Parameter(torch.Tensor(self.in_dim)) self.bias = nn.Parameter(torch.Tensor(self.in_dim)) def forwar...
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.utils.data assert_size_stride = torch._C._dy...
B06901052/Torch-Pruning
CustomizedLayer
false
11,235
[ "MIT" ]
0
43c99e1ea6039c7641e01cd7527492d69bfce35a
https://github.com/B06901052/Torch-Pruning/tree/43c99e1ea6039c7641e01cd7527492d69bfce35a
DoubleResolutionLayer
import torch import torch.nn as nn class DoubleResolutionLayer(nn.Module): def forward(self, x): x = nn.functional.interpolate(x, scale_factor=2, mode='nearest') 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
BeningSobariah/ark-stroller
DoubleResolutionLayer
false
11,236
[ "Apache-2.0" ]
0
af2036a1726523d5aca9b1040bfc1fad5c3420f2
https://github.com/BeningSobariah/ark-stroller/tree/af2036a1726523d5aca9b1040bfc1fad5c3420f2
Net
from torch.nn import Module import torch from torch.nn import Conv2d from torch.nn import Dropout2d from torch.nn import Linear from torch.nn.functional import relu from torch.nn.functional import max_pool2d from torch.nn.functional import log_softmax from torch import flatten class Net(Module): def __init__(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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AhmetTavli/Olivetti-CNN
Net
false
11,237
[ "MIT" ]
0
174747382f17e02c0e5f964d08a449429ac6fbd8
https://github.com/AhmetTavli/Olivetti-CNN/tree/174747382f17e02c0e5f964d08a449429ac6fbd8
IIDIsotropicGaussianUVLoss
import math import torch import torch.utils.data import torch.nn.functional as F from torch import nn 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...
BUPT-PRIV/detectron2
IIDIsotropicGaussianUVLoss
false
11,238
[ "Apache-2.0" ]
0
3163664cd5f43d50ea1966f410dc82410b9ccbf4
https://github.com/BUPT-PRIV/detectron2/tree/3163664cd5f43d50ea1966f410dc82410b9ccbf4
IndepAnisotropicGaussianUVLoss
import math import torch import torch.utils.data import torch.nn.functional as F from torch import nn 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...
BUPT-PRIV/detectron2
IndepAnisotropicGaussianUVLoss
false
11,239
[ "Apache-2.0" ]
0
3163664cd5f43d50ea1966f410dc82410b9ccbf4
https://github.com/BUPT-PRIV/detectron2/tree/3163664cd5f43d50ea1966f410dc82410b9ccbf4
SpatialPyramidPooling
import torch import torch.nn as nn class SpatialPyramidPooling(nn.Module): def __init__(self, pool_sizes=[5, 9, 13]): super(SpatialPyramidPooling, self).__init__() self.maxpools = nn.ModuleList([nn.MaxPool2d(pool_size, 1, pool_size // 2) for pool_size in pool_sizes]) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Arcofcosmos/MyYolov4_Pytorch
SpatialPyramidPooling
false
11,240
[ "MIT" ]
0
14c445503d0fc69b8a8b64ecdc87256ac4c1fce1
https://github.com/Arcofcosmos/MyYolov4_Pytorch/tree/14c445503d0fc69b8a8b64ecdc87256ac4c1fce1
PixelNormLayer
import torch import torch.nn as nn class PixelNormLayer(nn.Module): def __init__(self): super(PixelNormLayer, self).__init__() def forward(self, x): return x / torch.sqrt(torch.mean(x ** 2, dim=1, keepdim=True) + 1e-08) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
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_...
BeningSobariah/ark-stroller
PixelNormLayer
false
11,241
[ "Apache-2.0" ]
0
af2036a1726523d5aca9b1040bfc1fad5c3420f2
https://github.com/BeningSobariah/ark-stroller/tree/af2036a1726523d5aca9b1040bfc1fad5c3420f2
Convolution
import torch import torch.nn as nn class Convolution(nn.Module): def __init__(self, c_in, c_out): super().__init__() self.conv = nn.Conv2d(c_in, c_out, 3, stride=1, padding=1) self.relu = nn.ReLU(True) def forward(self, x): return self.relu(self.conv(x)) def get_inputs(): ...
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_...
Baymine/Dassl
Convolution
false
11,242
[ "MIT" ]
0
0836fb1f08393e2204326618e783d796741f657e
https://github.com/Baymine/Dassl/tree/0836fb1f08393e2204326618e783d796741f657e