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
HardSigmoid
import torch import torch.nn as nn class HardSigmoid(nn.Module): def __init__(self, bias=1.0, divisor=2.0, min_value=0.0, max_value=1.0): super(HardSigmoid, self).__init__() assert divisor != 0, 'divisor is not allowed to be equal to zero' self.bias = bias self.divisor = divisor ...
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...
DetectionBLWX/WSDDN.pytorch
HardSigmoid
false
17,216
[ "MIT" ]
7
05020d9d0445af90ba0af3f095aa12b18e3da7d2
https://github.com/DetectionBLWX/WSDDN.pytorch/tree/05020d9d0445af90ba0af3f095aa12b18e3da7d2
MaxPoolStride1
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F import torch._utils class MaxPoolStride1(nn.Module): def __init__(self, kernel_size): super(MaxPoolStride1, self).__init__() self.kernel_size = kernel_size self.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 import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import ...
DatatangAILAB/SuanFaShiXun04
MaxPoolStride1
false
17,217
[ "Apache-2.0" ]
5
f478e40dd84240ac71cbb54e6bacf9ff556fbb3e
https://github.com/DatatangAILAB/SuanFaShiXun04/tree/f478e40dd84240ac71cbb54e6bacf9ff556fbb3e
SamePadConv2d
import torch import torch.nn as nn import torch.nn.functional as F class SamePadConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True): super(SamePadConv2d, self).__init__(in_channels, out_channels, kernel_size, stride,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DandelionLau/NetworkCollections
SamePadConv2d
false
17,218
[ "Apache-2.0" ]
8
29e5cd2091f7085b3241209ed9447f2baadbce41
https://github.com/DandelionLau/NetworkCollections/tree/29e5cd2091f7085b3241209ed9447f2baadbce41
NormedLinear
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter class NormedLinear(nn.Module): def __init__(self, in_features, out_features): super(NormedLinear, self).__init__() self.weight = Parameter(torch.Tensor(in_feature...
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....
Data-Designer/Feature-Space-Augmentation-for-Long-Tailed-Data
NormedLinear
false
17,219
[ "MIT" ]
9
ac6bced6269d6ebaa3fc0935603d905a7f11a6fa
https://github.com/Data-Designer/Feature-Space-Augmentation-for-Long-Tailed-Data/tree/ac6bced6269d6ebaa3fc0935603d905a7f11a6fa
L
import math import torch import torch.nn as nn def drop_none(**kwargs): r = {k: v for k, v in kwargs.items() if v is not None} return r class L(nn.Module): def __init__(self, num_linear, input_features, output_features, dtype= None, device=None): super().__init__() options = dro...
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...
DataCanvasIO/YLearn
L
false
17,220
[ "Apache-2.0" ]
3
d65b5afb83deed154c710de9096317165d95014a
https://github.com/DataCanvasIO/YLearn/tree/d65b5afb83deed154c710de9096317165d95014a
Downsample
import torch from torch import nn class Downsample(nn.Module): def __init__(self, dim): super().__init__() self.conv = nn.Conv2d(dim, dim, 3, 2, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return ...
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...
DavidRuhe/simple-variational-diffusion-models
Downsample
false
17,221
[ "MIT" ]
4
a32355bf052a8f08e9c1919080588d0b22c8de4e
https://github.com/DavidRuhe/simple-variational-diffusion-models/tree/a32355bf052a8f08e9c1919080588d0b22c8de4e
Upsample
import torch from torch import nn class Upsample(nn.Module): def __init__(self, dim): super().__init__() self.conv = nn.ConvTranspose2d(dim, dim, 4, 2, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
DavidRuhe/simple-variational-diffusion-models
Upsample
false
17,222
[ "MIT" ]
4
a32355bf052a8f08e9c1919080588d0b22c8de4e
https://github.com/DavidRuhe/simple-variational-diffusion-models/tree/a32355bf052a8f08e9c1919080588d0b22c8de4e
SqueezeExcitate
import torch from torch import nn import torch.nn.functional as F class SqueezeExcitate(nn.Module): def __init__(self, in_channels, se_size, activation=None): super(SqueezeExcitate, self).__init__() self.dim_reduce = nn.Conv2d(in_channels=in_channels, out_channels= se_size, kernel_siz...
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...
Dogy06/COVID-Efficientnet-Pytorch-1
SqueezeExcitate
false
17,223
[ "MIT" ]
4
3c1f7d9513abe59783152efca28dc886bf4afc2f
https://github.com/Dogy06/COVID-Efficientnet-Pytorch-1/tree/3c1f7d9513abe59783152efca28dc886bf4afc2f
LabelSmoothingCrossEntropyBCE
import torch import torch.nn as nn import torch.nn.functional as F class LabelSmoothingCrossEntropyBCE(nn.Module): def __init__(self, smoothing=0.1): super(LabelSmoothingCrossEntropyBCE, self).__init__() assert smoothing < 1.0 self.smoothing = smoothing self.confidence = 1.0 - smo...
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...
Diyago/Graph-clasification-by-computer-vision
LabelSmoothingCrossEntropyBCE
false
17,224
[ "Apache-2.0" ]
9
703c44b98f9875d7a7b6db1c2b96372e11e256d6
https://github.com/Diyago/Graph-clasification-by-computer-vision/tree/703c44b98f9875d7a7b6db1c2b96372e11e256d6
PositiveLinear
import torch from torch import nn class PositiveLinear(nn.Module): def __init__(self, in_features: 'int', out_features: 'int') ->None: super().__init__() self.weight = nn.Parameter(torch.randn(in_features, out_features)) self.bias = nn.Parameter(torch.zeros(out_features)) self.sof...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
DavidRuhe/simple-variational-diffusion-models
PositiveLinear
false
17,225
[ "MIT" ]
4
a32355bf052a8f08e9c1919080588d0b22c8de4e
https://github.com/DavidRuhe/simple-variational-diffusion-models/tree/a32355bf052a8f08e9c1919080588d0b22c8de4e
Residual_Covolution
import torch import torch.nn as nn class Residual_Covolution(nn.Module): def __init__(self, icol, ocol, num_classes): super(Residual_Covolution, self).__init__() self.conv1 = nn.Conv2d(icol, ocol, kernel_size=3, stride=1, padding =12, dilation=12, bias=True) self.conv2 = nn.Co...
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_...
Dayan-Guan/SVMin
Residual_Covolution
false
17,227
[ "MIT" ]
6
d72b21f65958b1fda0abdbb60bd78d01e9d9cc8f
https://github.com/Dayan-Guan/SVMin/tree/d72b21f65958b1fda0abdbb60bd78d01e9d9cc8f
GroupNorm
import torch import torch.nn as nn class GroupNorm(nn.Module): def __init__(self, num_features, num_groups=32, eps=1e-05): super(GroupNorm, self).__init__() self.weight = nn.Parameter(torch.ones(1, num_features, 1, 1)) self.bias = nn.Parameter(torch.zeros(1, num_features, 1, 1)) 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_...
E-Dreamer-LQ/Astronomical_Target_Detection
GroupNorm
false
17,228
[ "MIT" ]
6
0c2d6c2e516ff1efa28d44582442123c3a03f079
https://github.com/E-Dreamer-LQ/Astronomical_Target_Detection/tree/0c2d6c2e516ff1efa28d44582442123c3a03f079
FCUDown
import torch import torch.nn as nn from functools import partial class FCUDown(nn.Module): """ CNN feature maps -> Transformer patch embeddings """ def __init__(self, inplanes, outplanes, dw_stride, act_layer=nn.GELU, norm_layer=partial(nn.LayerNorm, eps=1e-06)): super(FCUDown, self).__in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Curli-quan/fewshot-select
FCUDown
false
17,229
[ "Apache-2.0" ]
7
34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
https://github.com/Curli-quan/fewshot-select/tree/34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
LINEAR_LOGSOFTMAX
import torch import torch.nn as nn class LINEAR_LOGSOFTMAX(nn.Module): def __init__(self, input_dim, nclass): super(LINEAR_LOGSOFTMAX, self).__init__() self.fc = nn.Linear(input_dim, nclass) self.logic = nn.LogSoftmax(dim=1) self.lossfunction = nn.NLLLoss() def forward(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Drkun/Lifelong-Zero-Shot-Learning
LINEAR_LOGSOFTMAX
false
17,231
[ "Apache-2.0" ]
9
5cea07c25e14aed1c544c83863f4733a8213ddb0
https://github.com/Drkun/Lifelong-Zero-Shot-Learning/tree/5cea07c25e14aed1c544c83863f4733a8213ddb0
GroupBatchnorm2d
import torch import torch.nn as nn class GroupBatchnorm2d(nn.Module): def __init__(self, c_num, group_num=16, eps=1e-10): super(GroupBatchnorm2d, self).__init__() self.group_num = group_num self.gamma = nn.Parameter(torch.ones(c_num, 1, 1)) self.beta = nn.Parameter(torch.zeros(c_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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
E-Dreamer-LQ/Astronomical_Target_Detection
GroupBatchnorm2d
false
17,232
[ "MIT" ]
6
0c2d6c2e516ff1efa28d44582442123c3a03f079
https://github.com/E-Dreamer-LQ/Astronomical_Target_Detection/tree/0c2d6c2e516ff1efa28d44582442123c3a03f079
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. .. math:: \\begin{array}{ll} x = context*output \\\\ attn = exp(x_i) / sum_j exp(x_j) \\\\ ...
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....
EVASHINJI/Seq2Seq-PyTorch
Attention
false
17,233
[ "Apache-2.0" ]
4
d53f8d7c240bd7c16ebd1475384774bd064b4b03
https://github.com/EVASHINJI/Seq2Seq-PyTorch/tree/d53f8d7c240bd7c16ebd1475384774bd064b4b03
InstanceNormalization
import torch import torch.nn as nn class InstanceNormalization(torch.nn.Module): """InstanceNormalization Improves convergence of neural-style. ref: https://arxiv.org/pdf/1607.08022.pdf """ def __init__(self, dim, eps=1e-09): super(InstanceNormalization, self).__init__() self.scal...
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_...
E-Dreamer-LQ/Astronomical_Target_Detection
InstanceNormalization
false
17,234
[ "MIT" ]
6
0c2d6c2e516ff1efa28d44582442123c3a03f079
https://github.com/E-Dreamer-LQ/Astronomical_Target_Detection/tree/0c2d6c2e516ff1efa28d44582442123c3a03f079
ConvLSTMCls
import torch import torch.nn as nn class ConvLSTMCls(nn.Module): def __init__(self, in_channels, out_channels): """ Convolutional LSTM block for generation network Args: - in_channels: Int. Number of channels of the input of Conv2D - out_channels: Int. Number of channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
DveloperY0115/torch-gqn
ConvLSTMCls
false
17,235
[ "Apache-2.0" ]
3
3d1be9d73522e3d52f15076e0e9cb485dcab638b
https://github.com/DveloperY0115/torch-gqn/tree/3d1be9d73522e3d52f15076e0e9cb485dcab638b
FiLMSIREN
import math import torch from torch import nn class FiLMSIREN(nn.Module): def __init__(self, in_features: 'int', out_features: 'int', omega_0: 'float'=30.0, is_first: 'bool'=False, bias: 'bool'=True): super().__init__() self.in_features = in_features self.out_features = out_featur...
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 math f...
EasternJournalist/pi-GAN
FiLMSIREN
false
17,236
[ "MIT" ]
4
3d57611e1c8fca2f3cd00fde1989ec1f9dd94d55
https://github.com/EasternJournalist/pi-GAN/tree/3d57611e1c8fca2f3cd00fde1989ec1f9dd94d55
IOUloss
import torch import torch.nn as nn class IOUloss(nn.Module): def __init__(self, reduction='none', loss_type='iou'): super(IOUloss, self).__init__() self.reduction = reduction self.loss_type = loss_type def forward(self, pred, target): assert pred.shape[0] == target.shape[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 from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DerryHub/ByteTrack-attack
IOUloss
false
17,237
[ "MIT" ]
6
f237894c7985863c0830401933ebd89ca92bde96
https://github.com/DerryHub/ByteTrack-attack/tree/f237894c7985863c0830401933ebd89ca92bde96
NetEnd
import torch import torch.nn as nn class NetEnd(nn.Module): def __init__(self, num_classes: 'int'): super(NetEnd, self).__init__() self.num_classes = num_classes self.fc_net1 = nn.Conv2d(21, self.num_classes, kernel_size=1, stride=1) assert self.num_classes > 0, 'The number of cla...
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....
EadCat/Road-Extraction
NetEnd
false
17,238
[ "MIT" ]
4
9d4831b6c3a5ef07676cbe1c79b03045fda427ea
https://github.com/EadCat/Road-Extraction/tree/9d4831b6c3a5ef07676cbe1c79b03045fda427ea
IN_self
import torch import torch.nn as nn class IN_self(nn.Module): def __init__(self, num_features): super(IN_self, self).__init__() self.num_features = num_features self.gamma = nn.Parameter(torch.Tensor(1, num_features, 1, 1), requires_grad=True) self.beta = nn.Parameter(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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
EkdeepSLubana/BeyondBatchNorm
IN_self
false
17,239
[ "MIT" ]
10
2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
https://github.com/EkdeepSLubana/BeyondBatchNorm/tree/2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
LN_self
import torch import torch.nn as nn class LN_self(nn.Module): def __init__(self, num_features): super().__init__() shape = 1, num_features, 1, 1 self.gamma = nn.Parameter(torch.ones(shape)) self.beta = nn.Parameter(torch.zeros(shape)) def forward(self, X, eps=1e-05): v...
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_...
EkdeepSLubana/BeyondBatchNorm
LN_self
false
17,240
[ "MIT" ]
10
2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
https://github.com/EkdeepSLubana/BeyondBatchNorm/tree/2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
TLU
import torch import torch.nn as nn class TLU(nn.Module): def __init__(self, num_features): """max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau""" super(TLU, self).__init__() self.num_features = num_features self.tau = nn.Parameter(torch.Tensor(1, num_features, 1, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
EkdeepSLubana/BeyondBatchNorm
TLU
false
17,241
[ "MIT" ]
10
2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
https://github.com/EkdeepSLubana/BeyondBatchNorm/tree/2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
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.lin1 = nn.Linear(4, 50) self.lin2 = nn.Linear(50, 50) self.out = nn.Linear(50, 3) def forward(self, x): x = F.relu(self.lin1(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 import torch.nn as nn assert_...
Elli1993/custom_net_on_movidius
Net
false
17,242
[ "MIT" ]
9
cd7ed784e6d38fe696c1ae1ff0e5a31d1b52c7dc
https://github.com/Elli1993/custom_net_on_movidius/tree/cd7ed784e6d38fe696c1ae1ff0e5a31d1b52c7dc
CoughNet
import torch class CoughNet(torch.nn.Module): def __init__(self, input_size): super(CoughNet, self).__init__() self.l1 = torch.nn.Linear(input_size, 512) self.l2 = torch.nn.Linear(512, 256) self.l3 = torch.nn.Linear(256, 128) self.l4 = torch.nn.Linear(128, 64) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
DerWaldi/COVID-19-Cough-Classification
CoughNet
false
17,243
[ "MIT" ]
7
40f85133b0b8973c088dc2730c592af1b89b29b7
https://github.com/DerWaldi/COVID-19-Cough-Classification/tree/40f85133b0b8973c088dc2730c592af1b89b29b7
FRN_self
import torch import torch.nn as nn class FRN_self(nn.Module): def __init__(self, num_features, eps=1e-05, is_eps_learnable=True): super(FRN_self, self).__init__() self.num_features = num_features self.init_eps = eps self.is_eps_learnable = is_eps_learnable self.gamma = nn....
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 assert_size_stride = torch._C._dynamo.gu...
EkdeepSLubana/BeyondBatchNorm
FRN_self
false
17,244
[ "MIT" ]
10
2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
https://github.com/EkdeepSLubana/BeyondBatchNorm/tree/2ab1626a1ebfdfe55f0a4bc6ac24c8bbdd4e0196
custom_embedding
import torch import torch.nn as nn import torch.nn.functional as F def weight_init(m): if isinstance(m, nn.Linear): size = m.weight.size() size[0] size[1] variance = 0.001 m.weight.data.normal_(0.0, variance) try: m.bias.data.normal_(0.0, 0.0001) ...
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 ...
EpiSci/SoCRATES
custom_embedding
false
17,245
[ "MIT" ]
6
901a896c5a765e3cb56f290188cde71c8707192d
https://github.com/EpiSci/SoCRATES/tree/901a896c5a765e3cb56f290188cde71c8707192d
ClassifierEnd
import torch import torch.nn as nn class ClassifierEnd(nn.Module): def __init__(self, num_classes: 'int'): super(ClassifierEnd, self).__init__() self.num_classes = num_classes self.fc_net1 = nn.Conv2d(21, self.num_classes, kernel_size=1, stride=1) self.fc_net2 = nn.Conv2d(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 from torch._inductor.runtime....
EadCat/Road-Extraction
ClassifierEnd
false
17,246
[ "MIT" ]
4
9d4831b6c3a5ef07676cbe1c79b03045fda427ea
https://github.com/EadCat/Road-Extraction/tree/9d4831b6c3a5ef07676cbe1c79b03045fda427ea
CoordConv2D
import torch from torch import nn class CoordConv2D(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'int'=3, stride: 'int'=1, padding: 'int'=1, with_r: 'bool'=False): super().__init__() self.in_channel = in_channels self.with_r = with_r ...
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...
EasternJournalist/pi-GAN
CoordConv2D
false
17,247
[ "MIT" ]
4
3d57611e1c8fca2f3cd00fde1989ec1f9dd94d55
https://github.com/EasternJournalist/pi-GAN/tree/3d57611e1c8fca2f3cd00fde1989ec1f9dd94d55
DoubleSymLayer
import copy import math import torch import torch.nn as nn def normalInit(dims): """ Essentially, PyTorch's init.xavier_normal_ but clamped :param K: tensor to be initialized/overwritten :return: initialized tensor on the device in the nn.Parameter wrapper """ K = torch.zeros(dims) fan_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 import copy import math impor...
EmoryMLIP/DynamicBlocks
DoubleSymLayer
false
17,248
[ "MIT" ]
9
52acc9fbc1a2640c6ac8922fa18105279ccaea97
https://github.com/EmoryMLIP/DynamicBlocks/tree/52acc9fbc1a2640c6ac8922fa18105279ccaea97
MolDQN
import torch import torch.nn as nn class MolDQN(nn.Module): def __init__(self, input_length, output_length): super(MolDQN, self).__init__() self.linear_1 = nn.Linear(input_length, 1024) self.linear_2 = nn.Linear(1024, 512) self.linear_3 = nn.Linear(512, 128) self.linear_4 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
EXJUSTICE/MolDQN-pytorch
MolDQN
false
17,249
[ "MIT" ]
4
86828f898461e9f7722ac8a1e0b9fede2c45afe0
https://github.com/EXJUSTICE/MolDQN-pytorch/tree/86828f898461e9f7722ac8a1e0b9fede2c45afe0
Attention
import torch import torch.nn as nn def weight_init(m): if isinstance(m, nn.Linear): size = m.weight.size() size[0] size[1] variance = 0.001 m.weight.data.normal_(0.0, variance) try: m.bias.data.normal_(0.0, 0.0001) except: pass clas...
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 ...
EpiSci/SoCRATES
Attention
false
17,250
[ "MIT" ]
6
901a896c5a765e3cb56f290188cde71c8707192d
https://github.com/EpiSci/SoCRATES/tree/901a896c5a765e3cb56f290188cde71c8707192d
LinearAttention
import torch from torch import nn class LinearAttention(nn.Module): def __init__(self, dim, heads=4, dim_head=32): super().__init__() self.heads = heads self.dim_head = dim_head self.hidden_dim = dim_head * heads self.to_qkv = nn.Conv2d(dim, self.hidden_dim * 3, 1, bias=Fa...
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....
DavidRuhe/simple-variational-diffusion-models
LinearAttention
false
17,251
[ "MIT" ]
4
a32355bf052a8f08e9c1919080588d0b22c8de4e
https://github.com/DavidRuhe/simple-variational-diffusion-models/tree/a32355bf052a8f08e9c1919080588d0b22c8de4e
EltwiseSubEmbed
import torch from torch import nn class EltwiseSubEmbed(nn.Module): def __init__(self, nonlinearity='square', use_batch_norm=False, use_classifier=False, num_features=0, num_classes=0): super(EltwiseSubEmbed, self).__init__() self.nonlinearity = nonlinearity if nonlinearity is not...
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...
Event0511/curling-reid
EltwiseSubEmbed
false
17,252
[ "Apache-2.0" ]
3
1494d0faeed951e495573c694362f001df5bf6fd
https://github.com/Event0511/curling-reid/tree/1494d0faeed951e495573c694362f001df5bf6fd
SNRNetwork
import torch from torch import nn class PositiveLinear(nn.Module): def __init__(self, in_features: 'int', out_features: 'int') ->None: super().__init__() self.weight = nn.Parameter(torch.randn(in_features, out_features)) self.bias = nn.Parameter(torch.zeros(out_features)) self.sof...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
DavidRuhe/simple-variational-diffusion-models
SNRNetwork
false
17,253
[ "MIT" ]
4
a32355bf052a8f08e9c1919080588d0b22c8de4e
https://github.com/DavidRuhe/simple-variational-diffusion-models/tree/a32355bf052a8f08e9c1919080588d0b22c8de4e
EmbeddingLayer
import torch import torch.nn as nn import torch.nn.functional as F def weight_init(m): if isinstance(m, nn.Linear): size = m.weight.size() size[0] size[1] variance = 0.001 m.weight.data.normal_(0.0, variance) try: m.bias.data.normal_(0.0, 0.0001) ...
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 ...
EpiSci/SoCRATES
EmbeddingLayer
false
17,254
[ "MIT" ]
6
901a896c5a765e3cb56f290188cde71c8707192d
https://github.com/EpiSci/SoCRATES/tree/901a896c5a765e3cb56f290188cde71c8707192d
FakeReLUM
import torch import torch.nn as nn import torch.utils.data class FakeReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): return input.clamp(min=0) @staticmethod def backward(ctx, grad_output): return grad_output class FakeReLUM(nn.Module): 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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
Ethos-lab/robust-representation-matching
FakeReLUM
false
17,255
[ "MIT" ]
3
80d98f11846468c31278146583b9ef4750190211
https://github.com/Ethos-lab/robust-representation-matching/tree/80d98f11846468c31278146583b9ef4750190211
ConditionalBatchNorm
import torch class ConditionalBatchNorm(torch.nn.Module): def __init__(self, no, z_dim): super().__init__() self.no = no self.bn = torch.nn.InstanceNorm2d(no, affine=False) self.condition = torch.nn.Linear(z_dim, 2 * no) def forward(self, x, z): cond = self.condition(...
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 ...
ElementAI/beyond-trivial-explanations
ConditionalBatchNorm
false
17,256
[ "Apache-2.0" ]
3
c517d7bdbab68b6a26f74cee4d15e948b3b47238
https://github.com/ElementAI/beyond-trivial-explanations/tree/c517d7bdbab68b6a26f74cee4d15e948b3b47238
mlp_layer
import torch import torch.nn as nn import torch.nn.functional as F def weight_init(m): if isinstance(m, nn.Linear): size = m.weight.size() size[0] size[1] variance = 0.001 m.weight.data.normal_(0.0, variance) try: m.bias.data.normal_(0.0, 0.0001) ...
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 ...
EpiSci/SoCRATES
mlp_layer
false
17,257
[ "MIT" ]
6
901a896c5a765e3cb56f290188cde71c8707192d
https://github.com/EpiSci/SoCRATES/tree/901a896c5a765e3cb56f290188cde71c8707192d
MultVAE_encoder
import torch import torch.sparse import torch.nn as nn class MultVAE_encoder(nn.Module): def __init__(self, item_dim: 'int', hidden_dim=600, latent_dim=200, n_hidden_layers=1, dropout=0.5, nonlinearity=nn.Tanh): super(MultVAE_encoder, self).__init__() self.item_dim = item_dim self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.sparse...
EricHe98/sad_final_project
MultVAE_encoder
false
17,258
[ "MIT" ]
3
4b2b57e44f939840eede6f134493c5f8d809b1a7
https://github.com/EricHe98/sad_final_project/tree/4b2b57e44f939840eede6f134493c5f8d809b1a7
VAE
import torch import numpy as np import torch.utils.data import torch.nn as nn class VAE(nn.Module): def __init__(self, input_size, latent_size): super(VAE, self).__init__() self.latent_size = latent_size self.input_size = input_size self.mu_layer = nn.Linear(self.input_size, self....
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math...
ErikHumphrey/sustain-seq2seq
VAE
false
17,259
[ "Apache-2.0" ]
4
c4787f0ca1047d01385e4fa4ffde59c6a8ab4cc4
https://github.com/ErikHumphrey/sustain-seq2seq/tree/c4787f0ca1047d01385e4fa4ffde59c6a8ab4cc4
MLP
import torch class MLP(torch.nn.Module): def __init__(self, ni, no, nhidden, nlayers): super().__init__() self.nlayers = nlayers for i in range(nlayers): if i == 0: setattr(self, 'linear%d' % i, torch.nn.Linear(ni, nhidden, bias=False)) ...
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 ...
ElementAI/beyond-trivial-explanations
MLP
false
17,260
[ "Apache-2.0" ]
3
c517d7bdbab68b6a26f74cee4d15e948b3b47238
https://github.com/ElementAI/beyond-trivial-explanations/tree/c517d7bdbab68b6a26f74cee4d15e948b3b47238
merge_layer
import torch import torch.nn as nn import torch.nn.functional as F def weight_init(m): if isinstance(m, nn.Linear): size = m.weight.size() size[0] size[1] variance = 0.001 m.weight.data.normal_(0.0, variance) try: m.bias.data.normal_(0.0, 0.0001) ...
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 ...
EpiSci/SoCRATES
merge_layer
false
17,261
[ "MIT" ]
6
901a896c5a765e3cb56f290188cde71c8707192d
https://github.com/EpiSci/SoCRATES/tree/901a896c5a765e3cb56f290188cde71c8707192d
PreactDoubleLayer
import copy import math import torch import torch.nn as nn def normalInit(dims): """ Essentially, PyTorch's init.xavier_normal_ but clamped :param K: tensor to be initialized/overwritten :return: initialized tensor on the device in the nn.Parameter wrapper """ K = torch.zeros(dims) fan_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 import copy import math impor...
EmoryMLIP/DynamicBlocks
PreactDoubleLayer
false
17,262
[ "MIT" ]
9
52acc9fbc1a2640c6ac8922fa18105279ccaea97
https://github.com/EmoryMLIP/DynamicBlocks/tree/52acc9fbc1a2640c6ac8922fa18105279ccaea97
conv_head_pooling
import torch import torch.nn as nn class conv_head_pooling(nn.Module): def __init__(self, in_feature, out_feature, stride, padding_mode='zeros'): super(conv_head_pooling, self).__init__() self.conv = nn.Conv2d(in_feature, out_feature, kernel_size=stride + 1, padding=stride // 2, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Equationliu/GA-Attack
conv_head_pooling
false
17,263
[ "MIT" ]
8
b0280674a211f6451774ec6b1d4cee2fc19a4de6
https://github.com/Equationliu/GA-Attack/tree/b0280674a211f6451774ec6b1d4cee2fc19a4de6
Denoise_NormalizeLayer
import torch import torch.nn as nn class Denoise_NormalizeLayer(nn.Module): def __init__(self): super(Denoise_NormalizeLayer, self).__init__() def forward(self, inputs: 'torch.tensor'): permute_RGBtoBGR = [2, 1, 0] inputs = inputs[:, permute_RGBtoBGR, :, :] out = inputs / 0.5...
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...
Equationliu/GA-Attack
Denoise_NormalizeLayer
false
17,264
[ "MIT" ]
8
b0280674a211f6451774ec6b1d4cee2fc19a4de6
https://github.com/Equationliu/GA-Attack/tree/b0280674a211f6451774ec6b1d4cee2fc19a4de6
CEL
import torch from torch import nn class CEL(nn.Module): def __init__(self): super(CEL, self).__init__() None self.eps = 1e-06 def forward(self, pred, target): pred = pred.sigmoid() intersection = pred * target numerator = (pred - intersection).sum() + (target ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Farzanehkaji/MINet
CEL
false
17,265
[ "MIT" ]
9
cc2852cb2b3b20208f5edf38ec6952363a9b04a7
https://github.com/Farzanehkaji/MINet/tree/cc2852cb2b3b20208f5edf38ec6952363a9b04a7
Conv2d
import torch from torch import nn from torch.nn import functional as F class Conv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(Conv2d, self).__init__(in_channels, out_channels, kernel_size, stride...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
Farzanehkaji/MINet
Conv2d
false
17,266
[ "MIT" ]
9
cc2852cb2b3b20208f5edf38ec6952363a9b04a7
https://github.com/Farzanehkaji/MINet/tree/cc2852cb2b3b20208f5edf38ec6952363a9b04a7
ChannelPool
import torch import torch.nn as nn class ChannelPool(nn.Module): def forward(self, x): return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1) .unsqueeze(1)), dim=1) 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...
FVL2020/2DImage_BMI_estimation
ChannelPool
false
17,267
[ "MIT" ]
4
3ae8469c3c86aac1afd09b3ba1716ecd94f5ec3f
https://github.com/FVL2020/2DImage_BMI_estimation/tree/3ae8469c3c86aac1afd09b3ba1716ecd94f5ec3f
ScaleToModel
import torch import torch.nn as nn import torch.cuda from torch import linalg as linalg class ScaleToModel(nn.Module): """ This class acts as an adapter module that scales pixel values from the test run domain to the model domain. """ def __init__(self, model_value_range, test_value_range): "...
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.cuda from torch import linalg as linalg assert_size_stride = torch._C._dynamo.guards.assert_size_stride e...
Flunzmas/vp-suite
ScaleToModel
false
17,268
[ "MIT" ]
3
391570121b5bd9e3fd23aca9a0945a63c4173a24
https://github.com/Flunzmas/vp-suite/tree/391570121b5bd9e3fd23aca9a0945a63c4173a24
MultVae
import torch import torch.sparse import torch.nn as nn class MultVAE_encoder(nn.Module): def __init__(self, item_dim: 'int', hidden_dim=600, latent_dim=200, n_hidden_layers=1, dropout=0.5, nonlinearity=nn.Tanh): super(MultVAE_encoder, self).__init__() self.item_dim = item_dim self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EricHe98/sad_final_project
MultVae
false
17,269
[ "MIT" ]
3
4b2b57e44f939840eede6f134493c5f8d809b1a7
https://github.com/EricHe98/sad_final_project/tree/4b2b57e44f939840eede6f134493c5f8d809b1a7
CrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class CrossEntropyLoss(nn.Module): """ cross entropy loss """ def __init__(self): super().__init__() def forward(self, logits, labels): return F.cross_entropy(logits, labels, reduction='none') def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Equationliu/GA-Attack
CrossEntropyLoss
false
17,270
[ "MIT" ]
8
b0280674a211f6451774ec6b1d4cee2fc19a4de6
https://github.com/Equationliu/GA-Attack/tree/b0280674a211f6451774ec6b1d4cee2fc19a4de6
MultiHeadAttn
import math import torch from torch import nn import torch.nn.functional as F class MultiHeadAttn(nn.Module): def __init__(self, d_model, n_head, dropout=0.1, scale=False): super().__init__() assert d_model % n_head == 0 self.n_head = n_head self.qkv_linear = nn.Linear(d_model, 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EmanuelaBoros/stacked-ner
MultiHeadAttn
false
17,271
[ "MIT" ]
4
b57e4fcf777a5ad2519ffa7223364e383975bf7d
https://github.com/EmanuelaBoros/stacked-ner/tree/b57e4fcf777a5ad2519ffa7223364e383975bf7d
KLLoss
import torch import torch.nn as nn import torch.utils.data class KLLoss(nn.Module): def __init__(self, size_average=False): super().__init__() self.size_average = size_average def forward(self, mu, logvar): loss = 0.5 * (mu.pow(2) + logvar.exp() - logvar - 1) if self.size_ave...
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 ...
ForrestPi/VAEGAN
KLLoss
false
17,272
[ "MIT" ]
8
c2cfeedcc2dcfad6258468611536d9a8222eb8a3
https://github.com/ForrestPi/VAEGAN/tree/c2cfeedcc2dcfad6258468611536d9a8222eb8a3
AttentionHead
import math import torch import torch.utils.data import torch.nn as nn class AttentionHead(nn.Module): def __init__(self, d_model, d_k, d_v, device): super(AttentionHead, self).__init__() self.dk = math.sqrt(d_k) self.query_layer = nn.Linear(d_model, d_k) self.key_layer = nn.Linea...
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....
ErikHumphrey/sustain-seq2seq
AttentionHead
false
17,273
[ "Apache-2.0" ]
4
c4787f0ca1047d01385e4fa4ffde59c6a8ab4cc4
https://github.com/ErikHumphrey/sustain-seq2seq/tree/c4787f0ca1047d01385e4fa4ffde59c6a8ab4cc4
AdditiveAttention
import torch import torch.utils.data import torch.nn as nn class AdditiveAttention(nn.Module): def __init__(self, enc_hidden_dim, dec_hidden_dim): super(AdditiveAttention, self).__init__() self.attention_w1 = nn.Linear(enc_hidden_dim, enc_hidden_dim) self.attention_w2 = nn.Linear(dec_hidd...
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....
ErikHumphrey/sustain-seq2seq
AdditiveAttention
false
17,274
[ "Apache-2.0" ]
4
c4787f0ca1047d01385e4fa4ffde59c6a8ab4cc4
https://github.com/ErikHumphrey/sustain-seq2seq/tree/c4787f0ca1047d01385e4fa4ffde59c6a8ab4cc4
SimpleLoss
import torch class SimpleLoss(torch.nn.Module): def forward(self, output, target): return output / target 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...
FranciscoShi/piepline
SimpleLoss
false
17,276
[ "MIT" ]
5
6105788339fc18bab39ea07625b5fd26ad687254
https://github.com/FranciscoShi/piepline/tree/6105788339fc18bab39ea07625b5fd26ad687254
ScaledDotProductAttention
import torch import torch.nn as nn import torch.optim import torch.autograd import torch.nn import torch.nn.init class ScaledDotProductAttention(nn.Module): def __init__(self, d_model, attention_dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temper = d_model ** 0.5 s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
FilippoC/-deep-syntactic-dependency-parsing-release
ScaledDotProductAttention
false
17,277
[ "MIT" ]
4
30e2571ea930c2fd81559f5a2a971e3738cc6d39
https://github.com/FilippoC/-deep-syntactic-dependency-parsing-release/tree/30e2571ea930c2fd81559f5a2a971e3738cc6d39
ConcatELU
import torch import torch.nn as nn import torch.nn.functional as F class ConcatELU(nn.Module): """ Activation function that applies ELU in both direction (inverted and plain). Allows non-linearity while providing strong gradients for any input (important for final convolution) """ def forward(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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
GBATZOLIS/CAFLOW
ConcatELU
false
17,278
[ "MIT" ]
6
ea33f84c424bd8e46999be59cd5d52bd8f0a3a77
https://github.com/GBATZOLIS/CAFLOW/tree/ea33f84c424bd8e46999be59cd5d52bd8f0a3a77
HDRLoss
import torch import torch.nn as nn class HDRLoss(nn.Module): def __init__(self): super().__init__() def forward(self, out_img, ref_img): return torch.mean((out_img - ref_img) ** 2) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_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...
Galaxies99/NHDRRNet-pytorch
HDRLoss
false
17,279
[ "MIT" ]
10
b20aae987e586a6cf9c9c52fc07b0884ce6fdf37
https://github.com/Galaxies99/NHDRRNet-pytorch/tree/b20aae987e586a6cf9c9c52fc07b0884ce6fdf37
LayerNorm
import torch import torch.nn as nn import torch.optim import torch.autograd import torch.nn import torch.nn.init class LayerNorm(nn.Module): def __init__(self, dim, mean=0.0, std=1.0, fixed=False, eps=1e-06, ball =False): super(LayerNorm, self).__init__() self.eps = eps self.ball ...
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.optim import torch.autograd import torch.nn ...
FilippoC/-deep-syntactic-dependency-parsing-release
LayerNorm
false
17,280
[ "MIT" ]
4
30e2571ea930c2fd81559f5a2a971e3738cc6d39
https://github.com/FilippoC/-deep-syntactic-dependency-parsing-release/tree/30e2571ea930c2fd81559f5a2a971e3738cc6d39
FencepostModule
import torch import torch.nn as nn import torch.optim import torch.autograd import torch.nn import torch.nn.init class FencepostModule(nn.Module): def __init__(self, input_dim, repr_dim, n_labels, disentangle=False, label_bias=True, span_bias=False, activation='tanh'): super(FencepostModule, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
FilippoC/-deep-syntactic-dependency-parsing-release
FencepostModule
false
17,281
[ "MIT" ]
4
30e2571ea930c2fd81559f5a2a971e3738cc6d39
https://github.com/FilippoC/-deep-syntactic-dependency-parsing-release/tree/30e2571ea930c2fd81559f5a2a971e3738cc6d39
CenterCosineSimilarity
import torch import torch.nn as nn class CenterCosineSimilarity(nn.Module): def __init__(self, feat_dim, num_centers, eps=1e-08): super(CenterCosineSimilarity, self).__init__() self.centers = nn.Parameter(torch.randn(num_centers, feat_dim)) self.eps = eps def forward(self, 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.triton_helpers import libdevice import torch.nn as ...
GT-RIPL/DistillMatch-SSCL
CenterCosineSimilarity
false
17,282
[ "MIT" ]
9
e572671fd6994b3c43ad6e46e9efb3588804524c
https://github.com/GT-RIPL/DistillMatch-SSCL/tree/e572671fd6994b3c43ad6e46e9efb3588804524c
BBoxTransform
import torch import torch.nn as nn class BBoxTransform(nn.Module): def forward(self, anchors, regression): """ decode_box_outputs adapted from https://github.com/google/automl/blob/master/efficientdet/anchors.py Args: anchors: [batchsize, boxes, (y1, x1, y2, x2)] ...
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 assert_size_stride = torch._C._dynamo.guards.assert...
DerryHub/the-TaobaoLive-Commodity-Identify-Competition
BBoxTransform
false
17,283
[ "MIT" ]
4
7e5e5c4fbddd9949fe01810d58bd7994889c007c
https://github.com/DerryHub/the-TaobaoLive-Commodity-Identify-Competition/tree/7e5e5c4fbddd9949fe01810d58bd7994889c007c
SmoothCrossEntropyLoss
import torch from torch.nn.modules.loss import _WeightedLoss import torch.nn.functional as F class SmoothCrossEntropyLoss(_WeightedLoss): """ Smooth labelling for pytorch. Source: https://stackoverflow.com/questions/55681502/label-smoothing-in-pytorch """ def __init__(self, weight=None, reduction...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
Fuminides/athena
SmoothCrossEntropyLoss
false
17,284
[ "MIT" ]
10
78ad7ad5236dc8f12adc0401c52add3931292e69
https://github.com/Fuminides/athena/tree/78ad7ad5236dc8f12adc0401c52add3931292e69
LinearExcitability
import math import torch from torch import nn from torch.nn.parameter import Parameter def linearExcitability(input, weight, excitability=None, bias=None): """ Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`. Shape: - input: :math:`(N, *, in\\_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 from torch import nn from torch.nn.parameter import Parameter assert...
GMvandeVen/progressive-learning-pytorch
LinearExcitability
false
17,285
[ "MIT" ]
4
165645b2d7595d94d036f765c9a311d505e667a3
https://github.com/GMvandeVen/progressive-learning-pytorch/tree/165645b2d7595d94d036f765c9a311d505e667a3
LSGanLoss
import torch from torch import nn import torch.optim class LSGanLoss(nn.Module): def __init__(self, layer=3): super(LSGanLoss, self).__init__() self.layer = layer def forward(self, real, fake): loss_G = 0 loss_D = 0 for i in range(self.layer): loss_G = los...
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 import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
ForrestPi/faceSwapProjects
LSGanLoss
false
17,286
[ "MIT" ]
5
daf2649a2791a25aa541c4d6d3b7e1d6552be5d7
https://github.com/ForrestPi/faceSwapProjects/tree/daf2649a2791a25aa541c4d6d3b7e1d6552be5d7
conv_layer
import torch from torch import nn class conv_layer(nn.Module): """Standard convolutional layer. Possible to return pre-activations.""" def __init__(self, in_planes, out_planes, kernel_size=3, stride=1, padding=1, drop=0, batch_norm=False, nl=nn.ReLU(), bias=True, gated =False): super(...
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...
GMvandeVen/progressive-learning-pytorch
conv_layer
false
17,288
[ "MIT" ]
4
165645b2d7595d94d036f765c9a311d505e667a3
https://github.com/GMvandeVen/progressive-learning-pytorch/tree/165645b2d7595d94d036f765c9a311d505e667a3
Downsample
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
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...
GastonMazzei/escher-project-website
Downsample
false
17,289
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
CPUForgetMult
import torch import torch.nn.init class CPUForgetMult(torch.nn.Module): def __init__(self): super(CPUForgetMult, self).__init__() def forward(self, f, x, hidden_init=None): result = [] forgets = f.split(1, dim=0) prev_h = hidden_init for i, h in enumerate((f * x).spli...
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.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
FurKan7/resim_renklendirme-colorizing-of-picture-
CPUForgetMult
false
17,290
[ "MIT" ]
8
a431a42cd00a60f85948795bc872a272897fbc76
https://github.com/FurKan7/resim_renklendirme-colorizing-of-picture-/tree/a431a42cd00a60f85948795bc872a272897fbc76
MLP
import torch import torch.nn as nn class MLP(nn.Module): def __init__(self, width): super().__init__() self.width = width self.c_fc = nn.Linear(width, width * 4) self.c_proj = nn.Linear(width * 4, width) self.gelu = nn.GELU() def forward(self, x): return self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
GastonMazzei/escher-project-website
MLP
false
17,291
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
rSoftMax
import torch import torch.nn as nn import torch.nn.functional as F from torch.functional import F class rSoftMax(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
DerryHub/the-TaobaoLive-Commodity-Identify-Competition
rSoftMax
false
17,292
[ "MIT" ]
4
7e5e5c4fbddd9949fe01810d58bd7994889c007c
https://github.com/DerryHub/the-TaobaoLive-Commodity-Identify-Competition/tree/7e5e5c4fbddd9949fe01810d58bd7994889c007c
GroupNorm32
import torch import torch.nn.functional as F import torch.nn as nn class GroupNorm32(nn.GroupNorm): def __init__(self, num_groups, num_channels, swish, eps=1e-05): super().__init__(num_groups=num_groups, num_channels=num_channels, eps=eps) self.swish = swish 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
GastonMazzei/escher-project-website
GroupNorm32
false
17,293
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
downsampleLayer
import torch import torch.nn as nn class downsampleLayer(nn.Module): """ A downsample layer of UNet. LeakyReLU is used as the activation func. """ def __init__(self, infeature, outfeature, kernelSize, strides=2, paddings=1, bn=False): super(downsampleLayer, self).__init__() s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GentleDell/DEBOR
downsampleLayer
false
17,294
[ "BSD-3-Clause" ]
4
cd566f173599fe7419e7baf312f63830c28d5de2
https://github.com/GentleDell/DEBOR/tree/cd566f173599fe7419e7baf312f63830c28d5de2
GraphLinear
import torch import torch.nn as nn class GraphLinear(nn.Module): """ Generalization of 1x1 convolutions on Graphs """ def __init__(self, in_channels, out_channels): super(GraphLinear, self).__init__() self.in_channels = in_channels self.out_channels = out_channels self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GentleDell/DEBOR
GraphLinear
false
17,295
[ "BSD-3-Clause" ]
4
cd566f173599fe7419e7baf312f63830c28d5de2
https://github.com/GentleDell/DEBOR/tree/cd566f173599fe7419e7baf312f63830c28d5de2
Upsample
import torch import torch.nn.functional as F import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: re...
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...
GastonMazzei/escher-project-website
Upsample
false
17,296
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
upsampleLayer
import torch import torch.nn as nn class upsampleLayer(nn.Module): """ A upsample layer of UNet. ReLU is the activation func. The skip connection can be cutted if not given. Because RGB-UV is not a completion task but a image transition task. """ def __init__(self, infeature, outfeature, ker...
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...
GentleDell/DEBOR
upsampleLayer
false
17,297
[ "BSD-3-Clause" ]
4
cd566f173599fe7419e7baf312f63830c28d5de2
https://github.com/GentleDell/DEBOR/tree/cd566f173599fe7419e7baf312f63830c28d5de2
Attention
import torch import torch.optim from torch import nn class Attention(nn.Module): """ Attention network for calculate attention value """ def __init__(self, encoder_dim, decoder_dim, attention_dim): """ :param encoder_dim: input size of encoder network :param decoder_dim: input...
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....
Fpiotro/MOLECULAR-TRANSLATION
Attention
false
17,298
[ "MIT" ]
5
050dd0c093ee4e68326c2404c5b4dbf53ca6c8a0
https://github.com/Fpiotro/MOLECULAR-TRANSLATION/tree/050dd0c093ee4e68326c2404c5b4dbf53ca6c8a0
USConv2d
import torch import torch.nn as nn import torch.utils def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value is None: ...
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.utils assert_size_stride = torch._C._dynamo.g...
Gaussianer/FasterSeg
USConv2d
false
17,299
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
GlobalAvgPool2d
import torch import torch.nn as nn import torch.utils 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() inputs = inp...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Gaussianer/FasterSeg
GlobalAvgPool2d
false
17,300
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
TwoMLPHead
import torch from torchvision.transforms import functional as F from torch import nn import torch.nn.functional as F import torch.utils.data class TwoMLPHead(nn.Module): """ Standard heads for FPN-based models Arguments: in_channels (int): number of input channels representation_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 from torch._inductor.runtime import triton_helpers from torch import nn import t...
BoChenYS/ROPE
TwoMLPHead
false
17,301
[ "BSD-3-Clause" ]
6
3e50f134259b555cf547e4a3ef8b14cf5cda4e00
https://github.com/BoChenYS/ROPE/tree/3e50f134259b555cf547e4a3ef8b14cf5cda4e00
F_fully_connected_leaky
import torch from torch import nn class F_fully_connected_leaky(nn.Module): """Fully connected tranformation, not reversible, but used below.""" def __init__(self, size_in, size, internal_size=None, dropout=0.0, batch_norm=False, leaky_slope=0.01): super(F_fully_connected_leaky, self).__init_...
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...
Goobley/Radynversion
F_fully_connected_leaky
false
17,302
[ "MIT" ]
7
f44edc77b6eb7ef2bdbd8e8aabda3bf9822d3695
https://github.com/Goobley/Radynversion/tree/f44edc77b6eb7ef2bdbd8e8aabda3bf9822d3695
SqueezeAndExcitation
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class SqueezeAndExcitation(nn.Module): def __init__(self, planes, squeeze): super(SqueezeAndExcitation, self).__init__() self.squeeze = nn.Linear(planes, sque...
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 ...
FujitsuLaboratories/CAC
SqueezeAndExcitation
false
17,303
[ "Apache-2.0" ]
8
d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
https://github.com/FujitsuLaboratories/CAC/tree/d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
SigmoidFocalLoss
import torch import torch.nn as nn import torch.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha ...
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 ...
Gaussianer/FasterSeg
SigmoidFocalLoss
false
17,304
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
PairwiseLoss
import torch import torch.nn as nn class PairwiseLoss(nn.Module): def __init__(self): super().__init__() self.m = 0 def forward(self, pos_out, neg_out): distance = 1 - pos_out + neg_out loss = torch.mean(torch.max(torch.tensor(0), distance)) return loss def get_inpu...
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...
GrantXie/wikidata-wikifier
PairwiseLoss
false
17,305
[ "MIT" ]
3
a65c9b71596e390999af9de7638eb8c8c13c1581
https://github.com/GrantXie/wikidata-wikifier/tree/a65c9b71596e390999af9de7638eb8c8c13c1581
MultiheadAttention
import math import torch import torch as th import torch.nn as nn class QKVMultiheadAttention(nn.Module): def __init__(self, n_heads: 'int', n_ctx: 'int'): super().__init__() self.n_heads = n_heads self.n_ctx = n_ctx def forward(self, qkv): bs, n_ctx, width = qkv.shape ...
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....
GastonMazzei/escher-project-website
MultiheadAttention
false
17,306
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
PairwiseNetwork
import torch import torch.nn as nn import torch.nn.functional as F class PairwiseNetwork(nn.Module): def __init__(self, hidden_size): super().__init__() self.fc1 = nn.Linear(hidden_size, 2 * hidden_size) self.fc2 = nn.Linear(2 * hidden_size, hidden_size) self.fc3 = nn.Linear(hidde...
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 ...
GrantXie/wikidata-wikifier
PairwiseNetwork
false
17,307
[ "MIT" ]
3
a65c9b71596e390999af9de7638eb8c8c13c1581
https://github.com/GrantXie/wikidata-wikifier/tree/a65c9b71596e390999af9de7638eb8c8c13c1581
SoftCrossEntropyLoss2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils class SoftCrossEntropyLoss2d(nn.Module): def __init__(self): super(SoftCrossEntropyLoss2d, self).__init__() def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, dim=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Gaussianer/FasterSeg
SoftCrossEntropyLoss2d
false
17,308
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
Affine
import math import torch from torch import nn import torch.autograd from torch.nn import init class Affine(nn.Module): """ This module implements the affine parameters gamma and beta seen in Eq. 10 in Pezeshki et al. (2016). It differs from the way affine is used in batchnorm out of the box of PyTorch...
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 math from torch import nn import torch.autograd from torch.nn import init assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Goschjann/ssltsc
Affine
false
17,309
[ "MIT" ]
5
08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
https://github.com/Goschjann/ssltsc/tree/08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
PositionEmbs
import torch from torch import nn class PositionEmbs(nn.Module): def __init__(self, num_patches, emb_dim, dropout_rate=0.1): super(PositionEmbs, self).__init__() self.pos_embedding = nn.Parameter(torch.randn(1, num_patches + 2, emb_dim)) if dropout_rate > 0: self.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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Graeme22/VisionTransformer-Pytorch
PositionEmbs
false
17,310
[ "Apache-2.0" ]
5
4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
https://github.com/Graeme22/VisionTransformer-Pytorch/tree/4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
DistilledLoss
import torch from torch import nn import torch.nn.functional as F class DistilledLoss(nn.Module): """ Intended for use with a DistillationTrainer. Combines vanilla cross entropy loss with a modified form of KL divergence loss. Attempts to minimize the KL divergence between the student and distilled lo...
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 ...
Graeme22/VisionTransformer-Pytorch
DistilledLoss
false
17,311
[ "Apache-2.0" ]
5
4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
https://github.com/Graeme22/VisionTransformer-Pytorch/tree/4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
APLayer
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ZIF(torch.autograd.Function): @staticmethod def forward(ctx, input, gama): out = (input > 0).float() L = torch.tensor([gama]) ctx.save_for_b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed assert_size_st...
Gus-Lab/temporal_efficient_training
APLayer
false
17,312
[ "MIT" ]
5
f9bde4107ed653cc8dd3ee58689bf3b55f6b89ba
https://github.com/Gus-Lab/temporal_efficient_training/tree/f9bde4107ed653cc8dd3ee58689bf3b55f6b89ba
Conv2dSame
import torch from torchvision.transforms import * import torch.nn import torch import torch.nn as nn class Conv2dSame(torch.nn.Module): """2D convolution that pads to keep spatial dimensions equal. Cannot deal with stride. Only quadratic kernels (=scalar kernel_size). """ def __init__(self, in_channe...
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 from torchvis...
COMHTVM/lensless
Conv2dSame
false
17,313
[ "MIT" ]
6
0d67a310bab08551d7422fa792f3422a7ee7d9cb
https://github.com/COMHTVM/lensless/tree/0d67a310bab08551d7422fa792f3422a7ee7d9cb
Combinator
import torch from torch import nn import torch.autograd class Combinator(nn.Module): """ The vanilla combinator function g() that combines vertical and lateral connections as explained in Pezeshki et al. (2016). The weights are initialized as described in Eq. 17 and the g() is defined in Eq. 16. ...
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 import torch.autograd assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
Goschjann/ssltsc
Combinator
false
17,314
[ "MIT" ]
5
08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
https://github.com/Goschjann/ssltsc/tree/08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
ResidualAttentionBlock
import math import torch import torch as th import torch.nn as nn class LayerNorm(nn.LayerNorm): """ Implementation that supports fp16 inputs but fp32 gains/biases. """ def forward(self, x: 'th.Tensor'): return super().forward(x.float()) class QKVMultiheadAttention(nn.Module): 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....
GastonMazzei/escher-project-website
ResidualAttentionBlock
false
17,315
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
BasicBlock
import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): def __init__(self, inplanes, planes, droprate=0.2, attention=None): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, padding=1, bias=False) ...
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....
Galaxies99/alpha-protein
BasicBlock
false
17,316
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
SpaceToDepth
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class SpaceToDepth(nn.Module): def __init__(self, block_size=4): super().__init__() assert block_size == 4 self.bs = block_size def forward(self, x): N, C, H, W ...
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.distributed assert_size_stride = torch._C._dynamo....
GuillaumeAI/gia-labeling-ImageNet21K
SpaceToDepth
false
17,317
[ "MIT" ]
4
825ff49f1558f848fc8a798e2e393b708e75bb0e
https://github.com/GuillaumeAI/gia-labeling-ImageNet21K/tree/825ff49f1558f848fc8a798e2e393b708e75bb0e
PA
import torch from torch import nn class PA(nn.Module): def __init__(self, dim): super().__init__() self.pa_conv = nn.Conv2d(dim, dim, 3, 1, 1, groups=dim) def forward(self, x): return x * self.pa_conv(x).sigmoid() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Genevievekim/segformer
PA
false
17,318
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
DilatedBasicBlock
import torch import torch.nn as nn class DilatedBasicBlock(nn.Module): def __init__(self, inplanes, planes, kernel_size=3, dilation=1): super(DilatedBasicBlock, self).__init__() padding_size = kernel_size + (kernel_size - 1) * (dilation - 1) - 1 assert padding_size % 2 == 0 paddin...
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....
Galaxies99/alpha-protein
DilatedBasicBlock
false
17,319
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa