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
Clamp
import torch from torch import nn class Clamp(nn.Module): """Clamp energy output""" def forward(self, x): x = torch.clamp(x, min=0, max=30) 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
abdalazizrashid/idao-21-baseline
Clamp
false
18,229
[ "Apache-2.0" ]
7
649c2c70a1754b09fa06bf2264d7e8217b3e10f0
https://github.com/abdalazizrashid/idao-21-baseline/tree/649c2c70a1754b09fa06bf2264d7e8217b3e10f0
Conv2dBlock
import torch import numpy as np import torch.nn.functional as F from torch import nn import torch.optim def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super().__init__() self.num_...
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...
agermanidis/HiDT
Conv2dBlock
false
18,230
[ "BSD-3-Clause" ]
4
69192bb26785fc4e05038c45d05f2f880dd362d0
https://github.com/agermanidis/HiDT/tree/69192bb26785fc4e05038c45d05f2f880dd362d0
BasicConv
import torch import torch.nn as nn import torch.utils.model_zoo class BasicConv(nn.Module): def __init__(self, in_feature, out_feature, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=False, bias=False): super(BasicConv, self).__init__() self.conv = nn.Conv2d(in_feat...
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 ...
agusgun/EDSR-PyTorch
BasicConv
false
18,231
[ "MIT" ]
6
38ff657e2c4e2f148d38b8792bacdf8d81f8bf9f
https://github.com/agusgun/EDSR-PyTorch/tree/38ff657e2c4e2f148d38b8792bacdf8d81f8bf9f
NormalizeOutput
import torch import torch.nn.functional as F from torch import nn import torch.optim class NormalizeOutput(nn.Module): """ Module that scales the input tensor to the unit norm w.r.t. the specified axis. Actually, the module analog of `torch.nn.functional.normalize` """ def __init__(self, dim=1, p...
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 import ...
agermanidis/HiDT
NormalizeOutput
false
18,232
[ "BSD-3-Clause" ]
4
69192bb26785fc4e05038c45d05f2f880dd362d0
https://github.com/agermanidis/HiDT/tree/69192bb26785fc4e05038c45d05f2f880dd362d0
CmapPafHead
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
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.utils.data import torch.nn import torch.optim assert_size_stride = ...
ajsampathk/trt_pose
CmapPafHead
false
18,233
[ "MIT" ]
7
592e038cacaf43b6a502b759a035a4e7cae9db9e
https://github.com/ajsampathk/trt_pose/tree/592e038cacaf43b6a502b759a035a4e7cae9db9e
LinearModel
import torch import torch.utils.data import torch.nn import torch.optim class LinearModel(torch.nn.Module): def __init__(self, _in, out): super(LinearModel, self).__init__() self.input = torch.nn.Linear(_in, _in) self.hidden_1 = torch.nn.Linear(_in, out) self.hidden_2 = torch.nn.L...
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.utils.data import torch.nn import torch.optim assert_size_stride = ...
ajsampathk/trt_pose
LinearModel
false
18,234
[ "MIT" ]
7
592e038cacaf43b6a502b759a035a4e7cae9db9e
https://github.com/ajsampathk/trt_pose/tree/592e038cacaf43b6a502b759a035a4e7cae9db9e
XnorConv
import torch import torch.multiprocessing import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.autograd as autograd import torch.nn.functional as F class BinarizeWeight(autograd.Function): @staticmethod def forward(ctx, sco...
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.multiprocessing import torch.nn as nn import torch.nn.parallel impo...
adityakusupati/LLC-2.0
XnorConv
false
18,235
[ "MIT" ]
10
38608bbaa425b15dcf5c971000b7a1b08120fb5c
https://github.com/adityakusupati/LLC-2.0/tree/38608bbaa425b15dcf5c971000b7a1b08120fb5c
SphereLoss
import torch import torch.utils.data import torch.nn as nn from torchvision.transforms import * class SphereLoss(nn.Module): def __init__(self, in_feats, n_classes, scale=14, *args, **kwargs): super(SphereLoss, self).__init__(*args, **kwargs) self.scale = scale self.cross_entropy = nn.Cro...
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....
ace19-dev/image-retrieval-pytorch
SphereLoss
false
18,236
[ "MIT" ]
9
19bd4ae5efea5b6184c345f693646bcd9a0fc8cf
https://github.com/ace19-dev/image-retrieval-pytorch/tree/19bd4ae5efea5b6184c345f693646bcd9a0fc8cf
minibatch_discriminator
import torch import torch.nn as nn class minibatch_discriminator(nn.Module): def __init__(self, num_channels, B_dim, C_dim): super(minibatch_discriminator, self).__init__() self.B_dim = B_dim self.C_dim = C_dim self.num_channels = num_channels T_init = torch.randn(num_chan...
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....
aditya30394/Reverse-Image-Captioning
minibatch_discriminator
false
18,237
[ "MIT" ]
5
a6e427624a64f28d08e5629f48850ff001e48d02
https://github.com/aditya30394/Reverse-Image-Captioning/tree/a6e427624a64f28d08e5629f48850ff001e48d02
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=0, eps=1e-07): super(DiceLoss, self).__init__() self.smooth = smooth self.eps = eps def forward(self, output, target): return 1 - (2 * torch.sum(output * target) + self.smooth) / (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 from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
adriangrepo/segmentl
DiceLoss
false
18,238
[ "MIT" ]
5
9b520bf6cfd005eef9bba3db36ee6b3bb373b085
https://github.com/adriangrepo/segmentl/tree/9b520bf6cfd005eef9bba3db36ee6b3bb373b085
Accuracy
import torch import torch.nn as nn class Accuracy(nn.Module): def __init__(self, threshold=0.5): super().__init__() self.threshold = threshold def forward(self, y_true, y_pred): preds = (y_pred > self.threshold).int() return (preds == y_true).sum().float() / len(preds) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
alessandroferrari/defeatcovid19-net-pytorch
Accuracy
false
18,239
[ "MIT" ]
9
fe9ed82563709bae92524093c3bc0bb887fbdf6d
https://github.com/alessandroferrari/defeatcovid19-net-pytorch/tree/fe9ed82563709bae92524093c3bc0bb887fbdf6d
Hswish
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class Hsigmoid(nn.Module): def __init__(self, inplace=True, add_stub=False): super().__init__() self.float_op = nn.quantized.FloatFunctional() self.relu6 = nn.ReLU6(inpla...
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...
akosik-anyvision/incubator-tvm
Hswish
false
18,240
[ "Apache-2.0" ]
9
e1b11712ac09c32614483d24a4c7e0245ee4cb4b
https://github.com/akosik-anyvision/incubator-tvm/tree/e1b11712ac09c32614483d24a4c7e0245ee4cb4b
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, inplace=True, add_stub=False): super().__init__() self.float_op = nn.quantized.FloatFunctional() self.relu6 = nn.ReLU6(inpla...
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...
akosik-anyvision/incubator-tvm
Hsigmoid
false
18,241
[ "Apache-2.0" ]
9
e1b11712ac09c32614483d24a4c7e0245ee4cb4b
https://github.com/akosik-anyvision/incubator-tvm/tree/e1b11712ac09c32614483d24a4c7e0245ee4cb4b
RNNModel
import torch class RNNCell(torch.nn.Module): def __init__(self, input_channels: 'int', hidden_channels: 'int', non_linearity: 'str'): """Manual implementation of a cell of the RNN, necessary when non_linearity is 'sigmoid' since torch.nn.RNNCell accepts only 'tanh' or 'relu' activations ...
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 assert_size_stride ...
afermanian/rnn-kernel
RNNModel
false
18,242
[ "Apache-2.0" ]
5
8c4400c33e61081bfc162fa26d088827cee1028b
https://github.com/afermanian/rnn-kernel/tree/8c4400c33e61081bfc162fa26d088827cee1028b
BucketingEmbedding
import torch import torch.nn as nn class BucketingEmbedding(nn.Module): def __init__(self, min_val, max_val, count, dim, use_log_scale=False): super().__init__() self.min_val = min_val self.max_val = max_val self.count = count self.dim = dim self.use_log_scale = us...
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...
aimagelab/LoCoNav
BucketingEmbedding
false
18,243
[ "MIT" ]
9
00faf0d22d68a5ac8a4896381f97f2b472613ace
https://github.com/aimagelab/LoCoNav/tree/00faf0d22d68a5ac8a4896381f97f2b472613ace
SpatialAttentionLayer
import torch import torch.nn as nn import torch.utils.model_zoo class BasicConv(nn.Module): def __init__(self, in_feature, out_feature, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=False, bias=False): super(BasicConv, self).__init__() self.conv = nn.Conv2d(in_feat...
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 ...
agusgun/EDSR-PyTorch
SpatialAttentionLayer
false
18,244
[ "MIT" ]
6
38ff657e2c4e2f148d38b8792bacdf8d81f8bf9f
https://github.com/agusgun/EDSR-PyTorch/tree/38ff657e2c4e2f148d38b8792bacdf8d81f8bf9f
RewardModel
import torch import torch.nn as nn from torch.nn import functional as F class RewardModel(nn.Module): def __init__(self, hidden_size, state_size, node_size, act_fn='relu'): super().__init__() self.act_fn = getattr(F, act_fn) self.fc_1 = nn.Linear(hidden_size + state_size, node_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 from to...
alec-tschantz/planet
RewardModel
false
18,245
[ "MIT" ]
7
bf68722993c93129263bb9606a582d24cb4f2a58
https://github.com/alec-tschantz/planet/tree/bf68722993c93129263bb9606a582d24cb4f2a58
GLU
import torch import torch.utils.data import torch.nn as nn import torch from torchvision.transforms import functional as F 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) ...
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 import torch.nn as nn import torch import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size...
adymaharana/VLCStoryGan
GLU
false
18,246
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
Bridge
import torch import torch.nn as nn import torch.nn.functional as F class Bridge(nn.Sequential): def __init__(self, in_channels, out_channels): super(Bridge, self).__init__() self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1) self.act1 = nn.LeakyReLU(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 import torch.nn as nn import ...
aiarjun/Monocular-Depth-Estimation
Bridge
false
18,247
[ "MIT" ]
6
5989673f1b6d865f822a342448172b374968c234
https://github.com/aiarjun/Monocular-Depth-Estimation/tree/5989673f1b6d865f822a342448172b374968c234
MinibatchStdDev
from torch.nn import Module import torch from torch import Tensor from typing import List class MinibatchStdDev(Module): """ Minibatch standard deviation layer for the discriminator Args: group_size: Size of each group into which the batch is split num_new_features: number of additional fe...
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.nn import Module assert_size_stride = torch._C._dynamo.guards.assert...
akanimax/open-styleganv2-pytorch
MinibatchStdDev
false
18,248
[ "MIT" ]
7
243f12e335698293a0008d60c8b136d9f80cdacf
https://github.com/akanimax/open-styleganv2-pytorch/tree/243f12e335698293a0008d60c8b136d9f80cdacf
Vgg16
import torch import torch.nn.functional as F from torch import nn import torch.optim class Vgg16(nn.Module): def __init__(self): super().__init__() self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=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 import t...
agermanidis/HiDT
Vgg16
false
18,249
[ "BSD-3-Clause" ]
4
69192bb26785fc4e05038c45d05f2f880dd362d0
https://github.com/agermanidis/HiDT/tree/69192bb26785fc4e05038c45d05f2f880dd362d0
ConvDecoder
import torch import torch.nn as nn from torch.nn import functional as F class ConvDecoder(nn.Module): def __init__(self, hidden_size, state_size, embedding_size, act_fn='relu'): super().__init__() self.act_fn = getattr(F, act_fn) self.embedding_size = embedding_size self.fc_1 = nn...
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 from to...
alec-tschantz/planet
ConvDecoder
false
18,250
[ "MIT" ]
7
bf68722993c93129263bb9606a582d24cb4f2a58
https://github.com/alec-tschantz/planet/tree/bf68722993c93129263bb9606a582d24cb4f2a58
CSAM
import torch import torch.nn as nn class CSAM(nn.Module): """ Compact Spatial Attention Module """ def __init__(self, channels): super(CSAM, self).__init__() mid_channels = 4 self.relu1 = nn.ReLU() self.conv1 = nn.Conv2d(channels, mid_channels, kernel_size=1, padding=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 import torch.nn as nn assert_...
ZitongYu/pidinet
CSAM
false
18,251
[ "MIT" ]
5
15cdf9fb056549934877675bf7571b427f86db55
https://github.com/ZitongYu/pidinet/tree/15cdf9fb056549934877675bf7571b427f86db55
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False) self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4) self.size = 9 * 9...
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_...
aklein1995/Pong_REINFORCE
Policy
false
18,252
[ "MIT" ]
4
3b57777fd3ab6e98c8a1191989bd65140e19fc6e
https://github.com/aklein1995/Pong_REINFORCE/tree/3b57777fd3ab6e98c8a1191989bd65140e19fc6e
PcamPool
import torch from torch import nn class PcamPool(nn.Module): def __init__(self): super(PcamPool, self).__init__() def forward(self, feat_map, logit_map): assert logit_map is not None prob_map = torch.sigmoid(logit_map) weight_map = prob_map / prob_map.sum(dim=2, keepdim=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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
alinstein/X_RAY
PcamPool
false
18,253
[ "MIT" ]
4
35a39761d3b11ce9e47509025054f25e5f26aab9
https://github.com/alinstein/X_RAY/tree/35a39761d3b11ce9e47509025054f25e5f26aab9
ODEfunc
import torch import torch.nn as nn def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() 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 import triton_helpers from torch._inductor.runtime....
agrimsharma20/Deep-Continuous-Networks
ODEfunc
false
18,254
[ "MIT" ]
4
6c2b46dea5d0d7f25682d2fb55c4d5386e30997c
https://github.com/agrimsharma20/Deep-Continuous-Networks/tree/6c2b46dea5d0d7f25682d2fb55c4d5386e30997c
LxmertAttentionOutput
import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel class LxmertAttentionOutput(nn.Module): def __init__(self, hidden_size, hidden_dropout_prob): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.LayerNorm = nn.LayerNorm(...
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.utils....
adymaharana/VLCStoryGan
LxmertAttentionOutput
false
18,255
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
BertSelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_a...
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....
adymaharana/VLCStoryGan
BertSelfAttention
false
18,256
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
BertPredictionHead
from _paritybench_helpers import _mock_config import math import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT"s gelu is slightly different (and gives slightly different ...
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....
adymaharana/VLCStoryGan
BertPredictionHead
false
18,257
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
PreActResPath
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class PreActResPath(nn.Module): def __init__(self, in_features, config, super_block): super(PreActResPath, self).__init__() self.number_layers = config['num_layers'] self.activate_dropout = True if config['ac...
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_...
ArlindKadra/DeepLearning
PreActResPath
false
18,258
[ "Apache-2.0" ]
4
4e9ffe39bbb8722ca658522e6b6d26c6f2291ef6
https://github.com/ArlindKadra/DeepLearning/tree/4e9ffe39bbb8722ca658522e6b6d26c6f2291ef6
LogSumExpPool
import torch from torch import nn class LogSumExpPool(nn.Module): def __init__(self, gamma): super(LogSumExpPool, self).__init__() self.gamma = gamma def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Te...
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...
alinstein/X_RAY
LogSumExpPool
false
18,259
[ "MIT" ]
4
35a39761d3b11ce9e47509025054f25e5f26aab9
https://github.com/alinstein/X_RAY/tree/35a39761d3b11ce9e47509025054f25e5f26aab9
BertPredictionHeadTransform
from _paritybench_helpers import _mock_config import math import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT"s gelu is slightly different (and gives slightly different ...
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 ...
adymaharana/VLCStoryGan
BertPredictionHeadTransform
false
18,260
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
NumPredictor
import torch import torch.nn.functional as F import torch.nn as nn class NumPredictor(nn.Module): def __init__(self, latent_dim): self.latent_dim = latent_dim super(NumPredictor, self).__init__() self.reg_1 = nn.Linear(self.latent_dim, 1) def forward(self, x): x = F.relu(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 import torch.nn as nn assert_...
alibaba/FederatedScope
NumPredictor
false
18,261
[ "Apache-2.0" ]
9
fcf6d237624769ea094cfd68803901622f14fc23
https://github.com/alibaba/FederatedScope/tree/fcf6d237624769ea094cfd68803901622f14fc23
CAModule
import torch from torch import nn class CAModule(nn.Module): """ Re-implementation of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* code reference: https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py """ ...
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...
alinstein/X_RAY
CAModule
false
18,262
[ "MIT" ]
4
35a39761d3b11ce9e47509025054f25e5f26aab9
https://github.com/alinstein/X_RAY/tree/35a39761d3b11ce9e47509025054f25e5f26aab9
CmapPafHeadAttention
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
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.utils....
ajsampathk/trt_pose
CmapPafHeadAttention
false
18,263
[ "MIT" ]
7
592e038cacaf43b6a502b759a035a4e7cae9db9e
https://github.com/ajsampathk/trt_pose/tree/592e038cacaf43b6a502b759a035a4e7cae9db9e
AveragedHausdorffLoss
import torch import torch.nn as nn def cdist(x, y): """ Input: x is a Nxd Tensor y is a Mxd Tensor Output: dist is a NxM matrix where dist[i,j] is the norm between x[i,:] and y[j,:] i.e. dist[i,j] = ||x[i,:]-y[j,:]|| """ differences = x.unsqueeze(1) - y.unsqueeze(0) 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
adriangrepo/segmentl
AveragedHausdorffLoss
false
18,264
[ "MIT" ]
5
9b520bf6cfd005eef9bba3db36ee6b3bb373b085
https://github.com/adriangrepo/segmentl/tree/9b520bf6cfd005eef9bba3db36ee6b3bb373b085
GCN
import math import torch import torch.nn as nn from torch.nn import functional as F class GraphConvLayer(nn.Module): """ A Graph Convolution Layer as per https://arxiv.org/pdf/1609.02907.pdf with Glorot initialisation """ def __init__(self, in_features: 'int', out_filters: 'int', dropout_ratio: 'floa...
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 math import torch.nn a...
alecokas/swahili-text-gcn
GCN
false
18,265
[ "MIT" ]
4
14b8196b30baac2a05c869a1f6c17a912d1adcea
https://github.com/alecokas/swahili-text-gcn/tree/14b8196b30baac2a05c869a1f6c17a912d1adcea
ConvLayer
from _paritybench_helpers import _mock_config import torch import torch.nn.functional as F import torch.nn as nn class ConvLayer(nn.Module): """Conv layer for qa output""" def __init__(self, config): """ Args: config (ModelArguments): ModelArguments """ super().__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 import torch.nn as nn assert_...
Amber-Chaeeunk/Open-Domain-Question-Answering
ConvLayer
false
18,266
[ "MIT" ]
5
725e369a4409c54bf11bcfb9db53865d8fc1f935
https://github.com/Amber-Chaeeunk/Open-Domain-Question-Answering/tree/725e369a4409c54bf11bcfb9db53865d8fc1f935
PatchEmbedding
import torch from torch import Tensor from torch import nn class PatchEmbedding(nn.Module): """Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, embed_dim=768): super().__init__() assert img_size % patch_size == 0, 'Image size must be divisible by patch 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
alhamami/Object-Detection-And-Tracking
PatchEmbedding
false
18,267
[ "MIT" ]
5
a211a1dc103e812c539cd0ee16a2da4251943bed
https://github.com/alhamami/Object-Detection-And-Tracking/tree/a211a1dc103e812c539cd0ee16a2da4251943bed
BertPooler
from _paritybench_helpers import _mock_config import torch from torch import nn class BertPooler(nn.Module): def __init__(self, config): super(BertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, 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.triton_helpers import libdevice from torch import n...
Ahren09/FinerFact
BertPooler
false
18,268
[ "MIT" ]
9
68df3799fbfadd56fa69b019ca6fba0c482f21d3
https://github.com/Ahren09/FinerFact/tree/68df3799fbfadd56fa69b019ca6fba0c482f21d3
BertSelfOutput
from _paritybench_helpers import _mock_config import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel 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). ...
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.utils....
adymaharana/VLCStoryGan
BertSelfOutput
false
18,269
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
ClassAttention
import torch from torch import Tensor from torch import nn class ClassAttention(nn.Module): """ClassAttention as in CaiT """ def __init__(self, dim: 'int', heads: 'int'): super().__init__() self.num_heads = heads self.scale = (dim // heads) ** -0.5 self.qkv = nn.Linear(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....
alhamami/Object-Detection-And-Tracking
ClassAttention
false
18,270
[ "MIT" ]
5
a211a1dc103e812c539cd0ee16a2da4251943bed
https://github.com/alhamami/Object-Detection-And-Tracking/tree/a211a1dc103e812c539cd0ee16a2da4251943bed
IdentityMappingZero
import torch import torch.nn as nn class IdentityMappingZero(nn.Module): def __init__(self, out_channels: 'int', stride: 'int') ->None: super(IdentityMappingZero, self).__init__() self.out_channels = out_channels self.stride = stride pad_value = self.out_channels // 4 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
alvarobartt/understanding-resnet
IdentityMappingZero
false
18,271
[ "MIT" ]
6
1e95aba607bf3fead740affb9ceafb7fde3ee0c6
https://github.com/alvarobartt/understanding-resnet/tree/1e95aba607bf3fead740affb9ceafb7fde3ee0c6
Neumann
import math import torch import torch.nn as nn class Neumann(nn.Module): def __init__(self, n_features, depth, residual_connection, mlp_depth, init_type): super().__init__() self.depth = depth self.n_features = n_features self.residual_connection = residual_connection ...
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 math import torch.nn a...
alexprz/NeuMiss
Neumann
false
18,272
[ "BSD-3-Clause" ]
9
bf4f68ba4dd29b51ec3de9d6eef85deecebfa68d
https://github.com/alexprz/NeuMiss/tree/bf4f68ba4dd29b51ec3de9d6eef85deecebfa68d
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedForward(nn.Module): """ Two-layer position-wise feed-forward neural network. """ def __init__(self, d_in, d_hid, dropout=0.1, normalize_before=True): super().__init__() self.normalize_before = normalize_b...
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 ...
alipay/Pyraformer
PositionwiseFeedForward
false
18,273
[ "Apache-2.0" ]
7
84af4dbd93b7b96975b5034f0dde412005260123
https://github.com/alipay/Pyraformer/tree/84af4dbd93b7b96975b5034f0dde412005260123
XCA
import torch from torch import Tensor import torch.nn.functional as F from torch import nn class XCA(nn.Module): """ Cross-Covariance Attention (XCA) operation where the channels are updated using a weighted sum. The weights are obtained from the (softmax normalized) Cross-covariance matrix (Q^T K \\in 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....
alhamami/Object-Detection-And-Tracking
XCA
false
18,274
[ "MIT" ]
5
a211a1dc103e812c539cd0ee16a2da4251943bed
https://github.com/alhamami/Object-Detection-And-Tracking/tree/a211a1dc103e812c539cd0ee16a2da4251943bed
BackwardsNet
import torch from torch import nn class BackwardsNet(nn.Module): def __init__(self, h, ydim): super().__init__() self.loss = torch.nn.CrossEntropyLoss() self.fc1 = torch.nn.Linear(2 * h, h) self.fc2 = torch.nn.Linear(h, ydim) def forward(self, phiPrev, phi, atn): 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
alexandonian/neural-mmo
BackwardsNet
false
18,275
[ "MIT" ]
4
a4879c3399971ede81b64f507ee81706ba0d3366
https://github.com/alexandonian/neural-mmo/tree/a4879c3399971ede81b64f507ee81706ba0d3366
QuadraticModel
import torch class QuadraticModel(torch.nn.Module): def __init__(self, in_channels, class_num): super(QuadraticModel, self).__init__() x = torch.ones((in_channels, 1)) self.x = torch.nn.parameter.Parameter(x.uniform_(-10.0, 10.0).float()) def forward(self, A): return torch.su...
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...
alibaba/FederatedScope
QuadraticModel
false
18,276
[ "Apache-2.0" ]
9
fcf6d237624769ea094cfd68803901622f14fc23
https://github.com/alibaba/FederatedScope/tree/fcf6d237624769ea094cfd68803901622f14fc23
Net
import torch import torch.nn as nn class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 3, kernel_size=7, stride=1, bias=False, padding=3) self.conv2 = nn.Conv2d(3, 3, kernel_size=7, stride=1, bias=False, padding=3) ...
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...
alirezadavoudi/tensorflow-vs-pytorch
Net
false
18,277
[ "MIT" ]
4
1c0ccda8004591f3f29d4787d7b3bbfbc397523f
https://github.com/alirezadavoudi/tensorflow-vs-pytorch/tree/1c0ccda8004591f3f29d4787d7b3bbfbc397523f
BlurPool2d
import torch from torch.nn import * import torch.nn as nn class BlurPool2d(nn.Sequential): """Blur Pooling Layer (MaxPool2d replacement) See: https://richzhang.github.io/antialiased-cnns/ Paper: https://arxiv.org/abs/1904.11486 """ __constants__ = ['in_features'] _blur_kernel = torch.tensor([[...
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 * import...
aktgpt/brevis
BlurPool2d
false
18,278
[ "MIT" ]
8
0c3dcabd241ea50cafbc2012250804e1ecb7555e
https://github.com/aktgpt/brevis/tree/0c3dcabd241ea50cafbc2012250804e1ecb7555e
ResNetModel
import torch from typing import Dict from abc import abstractmethod from torch import nn import torch.nn.functional as F class DetectionModel(nn.Module): """ Base class describing any single object detection model """ def __init__(self, params: '{}'): self._params = params assert para...
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 typing import Dict from ...
aethersis/VisualEyeTracker
ResNetModel
false
18,279
[ "MIT" ]
7
53723bd68972954249b53d6ba0ac1cbe93b8844f
https://github.com/aethersis/VisualEyeTracker/tree/53723bd68972954249b53d6ba0ac1cbe93b8844f
TopkMSELoss
import torch class TopkMSELoss(torch.nn.Module): def __init__(self, topk) ->None: super().__init__() self.topk = topk self.criterion = torch.nn.MSELoss(reduction='none') def forward(self, output, label): losses = self.criterion(output, label).mean(2).mean(1) losses = ...
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...
alipay/Pyraformer
TopkMSELoss
false
18,280
[ "Apache-2.0" ]
7
84af4dbd93b7b96975b5034f0dde412005260123
https://github.com/alipay/Pyraformer/tree/84af4dbd93b7b96975b5034f0dde412005260123
MMTensorNorm
import torch import torch.nn as nn class MMTensorNorm(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): mean = torch.mean(x, dim=self.dim).unsqueeze(self.dim) std = torch.std(x, dim=self.dim).unsqueeze(self.dim) return (x - m...
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_...
amaankhan02/ChaLearn-2021-LAP
MMTensorNorm
false
18,281
[ "Apache-2.0", "MIT" ]
5
73227d642ebd69c3bde4065f22c6ad99b0cbe9f4
https://github.com/amaankhan02/ChaLearn-2021-LAP/tree/73227d642ebd69c3bde4065f22c6ad99b0cbe9f4
CPNLoss
import torch import torch.nn.functional as F from torch import nn class CPNLoss(nn.Module): """This is the loss function used for Cascaded Pyramid Net. Note that the original paper (arXiv:1711.07319) uses L2 loss. However the author (Shiyu) who participated in the FashionAI Keypoints competition found tha...
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.functi...
alwc/fashionAI-keypoints-detection-pytorch
CPNLoss
false
18,282
[ "Apache-2.0" ]
7
92061f66d89283e62093990dcb2dbdb03b8fa676
https://github.com/alwc/fashionAI-keypoints-detection-pytorch/tree/92061f66d89283e62093990dcb2dbdb03b8fa676
GeneratorLoss
import torch from torch import nn class GeneratorLoss(nn.Module): """ Generator (BCE) loss function Args: alpha (default: int=1): Coefficient by which map loss will be multiplied beta (default: int=1): Coefficient by which point loss will be multiplied """ def __init__(self, alph...
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 from torch ...
akanametov/pathgan
GeneratorLoss
false
18,283
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
ConvEncoder
import torch import torch.nn as nn from torch.nn import functional as F class ConvEncoder(nn.Module): def __init__(self, embedding_size, act_fn='relu'): super().__init__() self.act_fn = getattr(F, act_fn) self.embedding_size = embedding_size self.conv_1 = nn.Conv2d(3, 32, 4, strid...
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 from to...
alec-tschantz/planet
ConvEncoder
false
18,284
[ "MIT" ]
7
bf68722993c93129263bb9606a582d24cb4f2a58
https://github.com/alec-tschantz/planet/tree/bf68722993c93129263bb9606a582d24cb4f2a58
PositionwiseFeedForward
import torch import torch.nn as nn class LayerNormalization(nn.Module): """ Layer normalization module """ def __init__(self, d_hid, eps=0.001): super(LayerNormalization, self).__init__() self.eps = eps self.a_2 = nn.Parameter(torch.ones(d_hid), requires_grad=True) self.b_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
amaankhan02/ChaLearn-2021-LAP
PositionwiseFeedForward
false
18,285
[ "Apache-2.0", "MIT" ]
5
73227d642ebd69c3bde4065f22c6ad99b0cbe9f4
https://github.com/amaankhan02/ChaLearn-2021-LAP/tree/73227d642ebd69c3bde4065f22c6ad99b0cbe9f4
MemoryUpdater
from _paritybench_helpers import _mock_config import math import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_a...
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....
adymaharana/VLCStoryGan
MemoryUpdater
false
18,286
[ "MIT" ]
10
74112404689e8144c2ed2d375e1e5a1cde09debb
https://github.com/adymaharana/VLCStoryGan/tree/74112404689e8144c2ed2d375e1e5a1cde09debb
GaussianKullbackLeiblerLoss
import torch import torch.nn as nn class Loss(nn.Module): """Base loss class.""" def __init__(self): super(Loss, self).__init__() class GaussianKullbackLeiblerLoss(Loss): """Gaussian empirical KL divergence class.""" def __init__(self) ->None: super(GaussianKullbackLeiblerLoss, 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
aloctavodia/kulprit
GaussianKullbackLeiblerLoss
false
18,287
[ "MIT" ]
4
ab017074f7428154b8834515512db259c5f635e8
https://github.com/aloctavodia/kulprit/tree/ab017074f7428154b8834515512db259c5f635e8
STLayer
import torch class StraightThrough(torch.autograd.Function): @staticmethod def forward(ctx, x): return torch.sign(x) @staticmethod def backward(ctx, grad): return grad.clamp(-1.0, 1.0) class STLayer(torch.nn.Module): def __init__(self): super(STLayer, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
alper111/affordance-learning
STLayer
false
18,288
[ "MIT" ]
3
21b70f689a8299c6af7cd4ed763fc3133cf1681f
https://github.com/alper111/affordance-learning/tree/21b70f689a8299c6af7cd4ed763fc3133cf1681f
AdaptiveGeneratorLoss
import torch from torch import nn class AdaptiveGeneratorLoss(nn.Module): """ Adaptive Generator (BCE) loss function (depends on losses of Discriminators) Args: alpha (default: int=3): Coefficient for map and point losses """ def __init__(self, alpha=3): 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
akanametov/pathgan
AdaptiveGeneratorLoss
false
18,289
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.2): 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....
alipay/Pyraformer
MultiHeadAttention
false
18,290
[ "Apache-2.0" ]
7
84af4dbd93b7b96975b5034f0dde412005260123
https://github.com/alipay/Pyraformer/tree/84af4dbd93b7b96975b5034f0dde412005260123
MultiheadConvAttention
import torch import torch.nn.functional as F from torch import nn import torch.utils.data from torch.nn import Parameter import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class MultiheadConvAttention(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more ...
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....
amaurySabran/fairseq
MultiheadConvAttention
false
18,291
[ "BSD-3-Clause" ]
4
e6d5dd36678224e8b06aa0e97749f7a1c20a9949
https://github.com/amaurySabran/fairseq/tree/e6d5dd36678224e8b06aa0e97749f7a1c20a9949
DiceLoss
import torch from torch import nn class DiceLoss(nn.Module): """ DICE loss function Args: alpha (default: int=10): Coefficient in exp of sigmoid function smooth (default: int=1): To prevent zero in nominator """ def __init__(self, alpha=10, smooth=1): 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 from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
akanametov/pathgan
DiceLoss
false
18,292
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
KLDivergence
import torch from torch import nn def kl_divergence(px, py): eps = 1e-08 kl_div = px * (torch.log(px + eps) - torch.log(py + eps)) return kl_div class KLDivergence(nn.Module): """ Kullback–Leibler divergence Args: - None - """ def __init__(self): 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.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
akanametov/pathgan
KLDivergence
false
18,293
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
BiDAFAttention
import torch import torch.nn as nn import torch.nn.functional as F def masked_softmax(logits, mask, dim=-1, log_softmax=False): """Take the softmax of `logits` over given dimension, and set entries to 0 wherever `mask` is 0. Args: logits (torch.Tensor): Inputs to the softmax function. mas...
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....
amankhullar/MMBiDAF
BiDAFAttention
false
18,294
[ "MIT" ]
4
510a0c4f3bdeb7a84fb1554d8daee6b3fada3d61
https://github.com/amankhullar/MMBiDAF/tree/510a0c4f3bdeb7a84fb1554d8daee6b3fada3d61
PixelwiseLossMSE
import torch from torch import nn class PixelwiseLossMSE(nn.Module): """ MSE loss function Args: alpha (default: int=20): Coefficient by which loss will be multiplied """ def __init__(self, alpha=20): super().__init__() self.alpha = alpha def forward(self, fake, real...
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...
akanametov/pathgan
PixelwiseLossMSE
false
18,295
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
DiscriminatorLoss
import torch from torch import nn class DiscriminatorLoss(nn.Module): """ Discriminator (BCE) loss function Args: - None - """ def __init__(self): super().__init__() self.adv_criterion = nn.BCEWithLogitsLoss() def forward(self, fake_pred, real_pred): fake_tar...
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 from torch ...
akanametov/pathgan
DiscriminatorLoss
false
18,296
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
Critic
import torch import torch.nn.functional as f from torch import nn class Critic(nn.Module): def __init__(self, input_dim): super(Critic, self).__init__() self._input_dim = input_dim self.dense1 = nn.Linear(self._input_dim, self._input_dim) self.dense2 = nn.Linear(self._input_dim, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
amirarsalan90/TabFairGAN
Critic
false
18,297
[ "MIT" ]
5
402c434e0aa7a335fda652a67e72b132edb5f663
https://github.com/amirarsalan90/TabFairGAN/tree/402c434e0aa7a335fda652a67e72b132edb5f663
TimeEncode
import torch import numpy as np class TimeEncode(torch.nn.Module): def __init__(self, dim): super(TimeEncode, self).__init__() self.dim = dim self.w = torch.nn.Linear(1, dim) self.w.weight = torch.nn.Parameter(torch.from_numpy(1 / 10 ** np. linspace(0, 9, dim, dtype=np...
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 numpy ...
amazon-research/tgl
TimeEncode
false
18,298
[ "Apache-2.0" ]
9
5d852b8ae643b64b591a10dfbe8a1d10f696b200
https://github.com/amazon-research/tgl/tree/5d852b8ae643b64b591a10dfbe8a1d10f696b200
GaussianKernel
import torch from torch import nn class GaussianKernel(nn.Module): """ Gaussian kernel module. :param mu: Float, mean of the kernel. :param sigma: Float, sigma of the kernel. Examples: >>> import torch >>> kernel = GaussianKernel() >>> x = torch.randn(4, 5, 10) >>...
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 assert_size_stride = torch._C._dynamo.guards.assert_...
amberhuang01/LearningFromFactCheckers
GaussianKernel
false
18,299
[ "MIT" ]
9
3c21684709bf5e331c4585c7d62596960dd44732
https://github.com/amberhuang01/LearningFromFactCheckers/tree/3c21684709bf5e331c4585c7d62596960dd44732
IoUnionLoss
import torch from torch import nn class IoUnionLoss(nn.Module): """ Intersection over Union loss function Args: alpha (default: int=10): Coefficient in exp of sigmoid function smooth (default: int=1): To prevent zero in nominator """ def __init__(self, alpha=10, smooth=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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
akanametov/pathgan
IoUnionLoss
false
18,300
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
Discriminator
import math import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self, n_hidden): super(Discriminator, self).__init__() self.weight = nn.Parameter(torch.Tensor(n_hidden, n_hidden)) self.reset_parameters() def uniform(self, size, tensor): bound = 1.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 import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
amazon-research/panrep
Discriminator
false
18,301
[ "Apache-2.0" ]
10
57e6f71bb70c0908f3db28be97af0d818a863e19
https://github.com/amazon-research/panrep/tree/57e6f71bb70c0908f3db28be97af0d818a863e19
EdgePredictor
import torch class EdgePredictor(torch.nn.Module): def __init__(self, dim_in): super(EdgePredictor, self).__init__() self.dim_in = dim_in self.src_fc = torch.nn.Linear(dim_in, dim_in) self.dst_fc = torch.nn.Linear(dim_in, dim_in) self.out_fc = torch.nn.Linear(dim_in, 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 assert_size_stride = torch._C...
amazon-research/tgl
EdgePredictor
false
18,302
[ "Apache-2.0" ]
9
5d852b8ae643b64b591a10dfbe8a1d10f696b200
https://github.com/amazon-research/tgl/tree/5d852b8ae643b64b591a10dfbe8a1d10f696b200
MSE_loss
import torch import torch.nn as nn import torch.utils.data import torch.optim class MSE_loss(nn.Module): def __init__(self): super(MSE_loss, self).__init__() def forward(self, prediction, gt, epoch=0): err = prediction[:, 0:1] - gt mask = (gt > 0).detach() mse_loss = torch.me...
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.utils.data import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
alopezgit/project-adapt
MSE_loss
false
18,303
[ "MIT" ]
8
e93ab350344a5504f76f4e460002e0163996f88a
https://github.com/alopezgit/project-adapt/tree/e93ab350344a5504f76f4e460002e0163996f88a
PixelwiseLossL1
import torch from torch import nn class PixelwiseLossL1(nn.Module): """ L1 loss function Args: alpha (default: int=1): Coefficient by which loss will be multiplied """ def __init__(self, alpha=1): super().__init__() self.alpha = alpha self.criterion = nn.L1Loss() ...
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...
akanametov/pathgan
PixelwiseLossL1
false
18,304
[ "MIT" ]
8
d93464a9c2490532afdf7bbc0f60decdf2d0767d
https://github.com/akanametov/pathgan/tree/d93464a9c2490532afdf7bbc0f60decdf2d0767d
RankingLoss
import torch import torch.nn as nn import torch.nn.functional as F class RankingLoss(nn.Module): def __init__(self, margin_lambda: 'float'=0.01) ->None: super(RankingLoss, self).__init__() self.margin_lambda = margin_lambda def forward(self, candidates_scores: 'torch.Tensor', summary_scores:...
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...
andrejmiscic/simcls-pytorch
RankingLoss
false
18,305
[ "MIT" ]
5
516315c4b35955e4201677fc838f5f38a6e8fd54
https://github.com/andrejmiscic/simcls-pytorch/tree/516315c4b35955e4201677fc838f5f38a6e8fd54
RankCrossEntropyLoss
import torch import torch.nn.functional as F from torch import nn class RankCrossEntropyLoss(nn.Module): """Creates a criterion that measures rank cross entropy loss.""" __constants__ = ['num_neg'] def __init__(self, num_neg: 'int'=1): """ :class:`RankCrossEntropyLoss` constructor. ...
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...
amberhuang01/LearningFromFactCheckers
RankCrossEntropyLoss
false
18,306
[ "MIT" ]
9
3c21684709bf5e331c4585c7d62596960dd44732
https://github.com/amberhuang01/LearningFromFactCheckers/tree/3c21684709bf5e331c4585c7d62596960dd44732
DecoderLayer
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.2): 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....
alipay/Pyraformer
DecoderLayer
false
18,307
[ "Apache-2.0" ]
7
84af4dbd93b7b96975b5034f0dde412005260123
https://github.com/alipay/Pyraformer/tree/84af4dbd93b7b96975b5034f0dde412005260123
F
import torch import torch.nn.functional as F import torch.nn as nn from torch.autograd import Variable class F(nn.Module): def __init__(self, input_size, hidden_size, output_size, learning_rate= 0.001): super().__init__() self.input_size = input_size self.hidden_size = hidden_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 ...
amolk/AGI-experiments
F
false
18,309
[ "MIT" ]
5
ddb352c884d513ff4d9a843d0901699acb9e39b9
https://github.com/amolk/AGI-experiments/tree/ddb352c884d513ff4d9a843d0901699acb9e39b9
LayerNormalization
import torch import torch.nn as nn class LayerNormalization(nn.Module): def __init__(self, hidden_size, eps=1e-05): super(LayerNormalization, self).__init__() self.eps = eps self.hidden_size = hidden_size self.a2 = nn.Parameter(torch.ones(hidden_size), 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
analvikingur/RGAN
LayerNormalization
false
18,310
[ "MIT" ]
8
b1893c2f53d11c9173c7a30f63f6d93d72232493
https://github.com/analvikingur/RGAN/tree/b1893c2f53d11c9173c7a30f63f6d93d72232493
AdaIN
import torch import torch.optim class AdaIN(torch.nn.Module): def __init__(self, epsilon: 'float'=1e-05): super(AdaIN, self).__init__() self.epsilon = epsilon def calc_vector_mean_std(self, x): std = torch.sqrt(torch.var(x, dim=1) + self.epsilon) mean = torch.mean(x, dim=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.optim assert_size_stride = torch._C._dynamo.guards.assert_size_str...
ai-in-motion/moai
AdaIN
false
18,311
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
Downsample2d
import functools import torch import torch.optim class Downsample2d(torch.nn.Module): def __init__(self, scale: 'float'=0.5, mode: 'str'='bilinear'): super(Downsample2d, self).__init__() self.downsample = functools.partial(torch.nn.functional.interpolate, scale_factor=scale, mode=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._inductor.runtime import triton_helpers import functools import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_s...
ai-in-motion/moai
Downsample2d
false
18,312
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
SoftArgmax
import torch import torch as t import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class SoftArgmax(nn.Module): def __init__(self, temperature=0.001): super(SoftArgmax, self).__init__() self.temperature = temperature def forward(self, input, sampling=Fal...
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 as t impo...
analvikingur/RGAN
SoftArgmax
false
18,313
[ "MIT" ]
8
b1893c2f53d11c9173c7a30f63f6d93d72232493
https://github.com/analvikingur/RGAN/tree/b1893c2f53d11c9173c7a30f63f6d93d72232493
EncoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.2): super().__init__() self.temperature = temperature self.dropout = nn.Dropou...
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....
alipay/Pyraformer
EncoderLayer
false
18,314
[ "Apache-2.0" ]
7
84af4dbd93b7b96975b5034f0dde412005260123
https://github.com/alipay/Pyraformer/tree/84af4dbd93b7b96975b5034f0dde412005260123
MinusOne
import torch import torch.optim class MinusOne(torch.nn.Module): def __init__(self): super(MinusOne, self).__init__() def forward(self, x: 'torch.Tensor') ->torch.Tensor: return x - 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 import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strid...
ai-in-motion/moai
MinusOne
false
18,315
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
KL
import torch import torch.optim class KL(torch.nn.KLDivLoss): def __init__(self, is_input_log: 'bool'=False, is_target_log: 'bool'=False ): super(KL, self).__init__(reduction='none', log_target=is_target_log) self.is_input_log = is_input_log def forward(self, gt: 'torch.Tensor', pred...
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.optim assert_size_stride = torch._C._dynamo.guard...
ai-in-motion/moai
KL
false
18,316
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
GemanMcClure
import torch import torch.optim class L2(torch.nn.Module): def __init__(self): super(L2, self).__init__() def forward(self, pred: 'torch.Tensor', gt: 'torch.Tensor'=None, weights: 'torch.Tensor'=None, mask: 'torch.Tensor'=None ) ->torch.Tensor: l2 = (gt - pred) ** 2 if gt 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 import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strid...
ai-in-motion/moai
GemanMcClure
false
18,317
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
SplitAndConcat
import torch import torch.nn as nn import torch.quantization.quantize_fx import torch.utils.data class SplitAndConcat(nn.Module): """Split the data from split_dim and concatenate in concat_dim. @param split_dim from which axis the data will be chunk @param concat_dim to which axis the data will be concat...
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.quantization.quantize_fx import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size...
ananthsub/d2go
SplitAndConcat
false
18,318
[ "Apache-2.0" ]
3
8c3618d9e73518d32350ab4e6d0fb6509c9e08b6
https://github.com/ananthsub/d2go/tree/8c3618d9e73518d32350ab4e6d0fb6509c9e08b6
MatchModule
import torch import torch.nn.functional as F from torch import nn class MatchModule(nn.Module): """ Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> impor...
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....
amberhuang01/LearningFromFactCheckers
MatchModule
false
18,319
[ "MIT" ]
9
3c21684709bf5e331c4585c7d62596960dd44732
https://github.com/amberhuang01/LearningFromFactCheckers/tree/3c21684709bf5e331c4585c7d62596960dd44732
ClassAttentionBlock
import torch from torch import Tensor from torch import nn class MLP(nn.Module): def __init__(self, dim, hidden_dim, out_dim=None) ->None: super().__init__() out_dim = out_dim or dim self.fc1 = nn.Linear(dim, hidden_dim) self.act = nn.GELU() self.fc2 = nn.Linear(hidden_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....
alhamami/Object-Detection-And-Tracking
ClassAttentionBlock
false
18,320
[ "MIT" ]
5
a211a1dc103e812c539cd0ee16a2da4251943bed
https://github.com/alhamami/Object-Detection-And-Tracking/tree/a211a1dc103e812c539cd0ee16a2da4251943bed
Clamp
import torch import torch.optim class Clamp(torch.nn.Module): min_value: 'float' max_value: 'float' def __init__(self, min_value: 'float'=0.0, max_value: 'float'=1.0): super(Clamp, self).__init__() self.min_value = min_value self.max_value = max_value def forward(self, x: 'to...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_...
ai-in-motion/moai
Clamp
false
18,321
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
MAE_loss
import torch import torch.nn as nn import torch.utils.data import torch.optim class MAE_loss(nn.Module): def __init__(self): super(MAE_loss, self).__init__() def forward(self, prediction, gt, epoch=0): prediction = prediction[:, 0:1] abs_err = torch.abs(prediction - gt) mask ...
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 import torch.nn as nn import torch.utils.data import torch.optim assert_s...
alopezgit/project-adapt
MAE_loss
false
18,322
[ "MIT" ]
8
e93ab350344a5504f76f4e460002e0163996f88a
https://github.com/alopezgit/project-adapt/tree/e93ab350344a5504f76f4e460002e0163996f88a
CosineDistance
import torch import numpy as np import torch.optim def _acos_safe(x: 'torch.Tensor', eps: 'float'=0.0001): slope = np.arccos(1.0 - eps) / eps buf = torch.empty_like(x) good = torch.abs(x) <= 1.0 - eps bad = ~good sign = torch.sign(x[bad]) buf[good] = torch.acos(x[good]) buf[bad] = torch.ac...
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 numpy as np import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo....
ai-in-motion/moai
CosineDistance
false
18,323
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
Discriminator2d
import torch import torch.nn as nn import torch.utils.data import torch class Discriminator2d(nn.Module): def __init__(self, ngpu, wd, nc_d): super(Discriminator2d, self).__init__() self.ngpu = ngpu self.conv0 = nn.Conv2d(nc_d, 2 ** (wd - 4), 4, 2, 1) self.conv1 = nn.Conv2d(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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
amirDahari1/SuperRes
Discriminator2d
false
18,324
[ "MIT" ]
6
6e7500b803136d6a60d1571630b16e81bec5f888
https://github.com/amirDahari1/SuperRes/tree/6e7500b803136d6a60d1571630b16e81bec5f888
Lambda
import torch import torch.optim class KL(torch.nn.KLDivLoss): def __init__(self, is_input_log: 'bool'=False, is_target_log: 'bool'=False ): super(KL, self).__init__(reduction='none', log_target=is_target_log) self.is_input_log = is_input_log def forward(self, gt: 'torch.Tensor', pred...
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 import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_si...
ai-in-motion/moai
Lambda
false
18,325
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
Dense
import math import torch import torch.nn as nn from string import ascii_lowercase import torch.optim class Dense(nn.Module): def __init__(self, input_features, output_features=None): super(Dense, self).__init__() self.input_features = input_features self.output_features = (input_features ...
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 from string import ascii_lowercase import torc...
andrew-xu-monash/UMM-Modified
Dense
false
18,326
[ "Apache-2.0" ]
4
18729dc34733c203e8cd3873fec2b9f7d0b56dba
https://github.com/andrew-xu-monash/UMM-Modified/tree/18729dc34733c203e8cd3873fec2b9f7d0b56dba
MSE_log_loss
import torch import torch.nn as nn import torch.utils.data import torch.optim class MSE_log_loss(nn.Module): def __init__(self): super(MSE_log_loss, self).__init__() def forward(self, prediction, gt): prediction = torch.clamp(prediction, min=0) err = torch.log(prediction + 1e-06) - t...
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 ...
alopezgit/project-adapt
MSE_log_loss
false
18,327
[ "MIT" ]
8
e93ab350344a5504f76f4e460002e0163996f88a
https://github.com/alopezgit/project-adapt/tree/e93ab350344a5504f76f4e460002e0163996f88a
AngleError
import torch import torch.optim def _angular_error(gt: 'torch.Tensor', pred: 'torch.Tensor', radians: 'bool'): relative = gt @ torch.transpose(pred, -2, -1) trace = relative[:, 0, 0] + relative[:, 1, 1] + relative[:, 2, 2] trace = torch.clamp(trace, -1.0, 3.0) phi = 0.5 * (trace - 1.0) return phi....
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....
ai-in-motion/moai
AngleError
false
18,328
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf
VisibilityFOV
import torch import torch.optim class VisibilityFOV(torch.nn.Module): def __init__(self, width: 'int'=1, height: 'int'=1, coord_type: 'str'= 'coord'): super(VisibilityFOV, self).__init__() self.coord_type = coord_type self.width = width self.height = height 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 import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strid...
ai-in-motion/moai
VisibilityFOV
false
18,329
[ "Apache-2.0" ]
10
e38cac046c059d2e2331ef4883bbabc5a500a5cf
https://github.com/ai-in-motion/moai/tree/e38cac046c059d2e2331ef4883bbabc5a500a5cf