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
BinaryMarginLoss
import torch import torch.nn as nn import torch.distributions import torch.utils.data class BinaryMarginLoss(nn.Module): def __init__(self, margin=0.5): super().__init__() self.margin = margin def forward(self, output): return torch.logaddexp(torch.tensor([1.0], device=output.device)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.distributions import torch....
AlexMeinke/Provable-OOD-Detection
BinaryMarginLoss
false
7,682
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
KDTH
import torch from torch import nn import torch.nn.functional as F class KDTH(nn.Module): """KD with a Teacher Head auxiliary loss""" def __init__(self, T=4): super(KDTH, self).__init__() self.T = T def forward(self, y_s, y_t): y_s_th = y_s[1] y_s = y_s[0] p_t = F....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Alibaba-MIIL/HeadSharingKD
KDTH
false
7,683
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
Add_ParamI
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Add_ParamI(nn.Module): def __init__(self): super().__init__() self.bias = nn.Parameter(torch.zeros(1)) def forward(self, x): out = x + self.bias return out def ibp_forward(self, l...
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.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AlexMeinke/Provable-OOD-Detection
Add_ParamI
false
7,684
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
Contraster
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Contraster(AdversarialNoiseGenerator): def __init__(self, eps...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo....
AlexMeinke/Provable-OOD-Detection
Contraster
false
7,685
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, indim, hs, outdim, mlp_drop): super().__init__() """ eh, et, |eh-et|, eh*et """ indim = 4 * indim self.linear1 = nn.Linear(indim, 2 * hs) self.linear...
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....
AndrewZhe/Three-Sentences-Are-All-You-Need
MLP
false
7,686
[ "MIT" ]
21
afad6f9e700c9a95e03ef200718ebee8e18ca016
https://github.com/AndrewZhe/Three-Sentences-Are-All-You-Need/tree/afad6f9e700c9a95e03ef200718ebee8e18ca016
Conv2dBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data 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(AdaptiveInstanceNorm2d, 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 import torch.nn as nn import ...
AllenPu/mbdg
Conv2dBlock
false
7,687
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
DistillMSE
import torch from torch import nn import torch.nn.functional as F class DistillMSE(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self): super(DistillMSE, self).__init__() pass def forward(self, y_s, y_t): loss = nn.MSELoss(reduction='mean')(F.softmax...
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...
Alibaba-MIIL/HeadSharingKD
DistillMSE
false
7,688
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
OELossLogConf
import torch import torch.nn as nn import torch.distributions import torch.utils.data class OELossLogConf(nn.Module): def __init__(self): super().__init__() def forward(self, confs): return -confs.mean(1) def get_inputs(): return [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 import torch.nn as nn import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AlexMeinke/Provable-OOD-Detection
OELossLogConf
false
7,689
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
Fire
import torch from torch import nn from collections import OrderedDict class Fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand1x1_planes, expand3x3_planes): super(Fire, self).__init__() self.inplanes = inplanes self.group1 = nn.Sequential(OrderedDict([('squeeze',...
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 from col...
Alibaba-AAIG/Beyond-ImageNet-Attack
Fire
false
7,690
[ "MIT" ]
23
c14b4844b64a8035b8fe033a617c0567224a9fa4
https://github.com/Alibaba-AAIG/Beyond-ImageNet-Attack/tree/c14b4844b64a8035b8fe033a617c0567224a9fa4
CTLSTMCell
import torch import torch.nn as nn import torch.nn.functional as F class CTLSTMCell(nn.Module): def __init__(self, hidden_dim, beta=1.0, device=None): super(CTLSTMCell, self).__init__() device = device or 'cpu' self.device = torch.device(device) self.hidden_dim = 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.triton_helpers import libdevice, math as tl_math im...
Anirudh-Murali/neural-hawkes-particle-smoothing
CTLSTMCell
false
7,691
[ "BSD-3-Clause" ]
37
96b258838bdab33b781008daeedfa61dec0d553c
https://github.com/Anirudh-Murali/neural-hawkes-particle-smoothing/tree/96b258838bdab33b781008daeedfa61dec0d553c
NormalNoiseGenerator
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class NormalNoiseGenerator(AdversarialNoiseGenerator): def __init__...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
AlexMeinke/Provable-OOD-Detection
NormalNoiseGenerator
false
7,692
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
GOODLoss
import torch import torch.nn as nn import torch.distributions import torch.utils.data class GOODLoss(nn.Module): def __init__(self): super().__init__() def forward(self, ub_log_conf): return (ub_log_conf ** 2 / 2).log1p() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
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.distributions import torch.utils.data assert...
AlexMeinke/Provable-OOD-Detection
GOODLoss
false
7,693
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
Lowerer
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Lowerer(AdversarialNoiseGenerator): def __init__(self, eps): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo....
AlexMeinke/Provable-OOD-Detection
Lowerer
false
7,694
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
LinearI_Neg
import torch import torch.nn as nn import torch.nn.functional as F import torch.distributions import torch.utils.data class LinearI_Neg(nn.Linear): def forward(self, x): return F.linear(x, -self.weight.exp(), self.bias) def ibp_forward(self, l, u): weight = -self.weight.exp() if 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 math as tl_math import torch....
AlexMeinke/Provable-OOD-Detection
LinearI_Neg
false
7,695
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
KDETH
import torch from torch import nn import torch.nn.functional as F class KDTH(nn.Module): """KD with a Teacher Head auxiliary loss""" def __init__(self, T=4): super(KDTH, self).__init__() self.T = T def forward(self, y_s, y_t): y_s_th = y_s[1] y_s = y_s[0] p_t = F....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Alibaba-MIIL/HeadSharingKD
KDETH
false
7,696
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
Unet_2levels
import torch import torch.nn as nn class Unet_2levels(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True) self.maxpool = nn.MaxPool...
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_...
AbdulMuqadim2001/dvae-refiner
Unet_2levels
false
7,697
[ "MIT" ]
27
c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
https://github.com/AbdulMuqadim2001/dvae-refiner/tree/c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
SavageLoss
import torch import torch.nn as nn import torch.distributions import torch.utils.data class SavageLoss(nn.Module): def __init__(self): super().__init__() def forward(self, output): return 1 / (1 + output.exp()) ** 2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.distributions import torch.utils.data ...
AlexMeinke/Provable-OOD-Detection
SavageLoss
false
7,698
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
UniformNoiseGenerator
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class UniformNoiseGenerator(AdversarialNoiseGenerator): def __init_...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
AlexMeinke/Provable-OOD-Detection
UniformNoiseGenerator
false
7,699
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
Dunet_2levels
import torch import torch.nn as nn class Unet_2levels(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True) self.maxpool = nn.MaxPool...
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_...
AbdulMuqadim2001/dvae-refiner
Dunet_2levels
false
7,700
[ "MIT" ]
27
c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
https://github.com/AbdulMuqadim2001/dvae-refiner/tree/c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
GlobalAttention
import torch import torch.nn as nn import torch.cuda def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(args) def se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AndrewM1998/MultimodalNMT
GlobalAttention
false
7,701
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
MLB
import torch from torch import nn from torch.nn import functional as F class MLB(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(MLB, self).__i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AndresPMD/GCN_classification
MLB
false
7,702
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
EntityClassifier
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, indim, hs, outdim, mlp_drop): super().__init__() """ eh, et, |eh-et|, eh*et """ indim = 4 * indim self.linear1 = nn.Linear(indim, 2 * hs) self.linear...
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....
AndrewZhe/Three-Sentences-Are-All-You-Need
EntityClassifier
false
7,703
[ "MIT" ]
21
afad6f9e700c9a95e03ef200718ebee8e18ca016
https://github.com/AndrewZhe/Three-Sentences-Are-All-You-Need/tree/afad6f9e700c9a95e03ef200718ebee8e18ca016
HingeLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.distributions import torch.utils.data class HingeLoss(nn.Module): def __init__(self, margin=1.0): super().__init__() self.margin = margin def forward(self, output): return F.relu(self.margin - output) 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 import torch.nn as nn import torch.distributions import torch.utils.data assert_size_stri...
AlexMeinke/Provable-OOD-Detection
HingeLoss
false
7,704
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
OELoss
import torch import torch.nn as nn import torch.distributions import torch.utils.data class OELoss(nn.Module): def __init__(self): super().__init__() def forward(self, logits): return -torch.log_softmax(logits, 1).mean(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
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 ...
AlexMeinke/Provable-OOD-Detection
OELoss
false
7,705
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
SourceContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
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 ...
AndrewM1998/MultimodalNMT
SourceContextGate
false
7,706
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
AttentionBlock
import torch import torch.nn as nn class AttentionBlock(nn.Module): def __init__(self, in_features, middle_features, out_features): super().__init__() self.in_features = in_features self.middle_features = middle_features self.out_features = out_features self.W = nn.Linear(...
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....
Anjum48/commonlitreadabilityprize
AttentionBlock
false
7,707
[ "MIT" ]
28
b310742520b847b452ced0d27f47a934e834e4de
https://github.com/Anjum48/commonlitreadabilityprize/tree/b310742520b847b452ced0d27f47a934e834e4de
Scale_By_ParamI
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Scale_By_ParamI(nn.Module): def __init__(self): super().__init__() self.scalar = nn.Parameter(torch.ones(1)) def forward(self, x): out = x * self.scalar return out def ibp_forward...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AlexMeinke/Provable-OOD-Detection
Scale_By_ParamI
false
7,708
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
Mish
import torch import torch.nn as nn import torch.nn.functional as F class Mish(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x * torch.tanh(F.softplus(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.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
Archaic-Atom/JackFramework
Mish
false
7,709
[ "MIT" ]
13
e847d0bafe335ee33caf174676d12ad3c28011a6
https://github.com/Archaic-Atom/JackFramework/tree/e847d0bafe335ee33caf174676d12ad3c28011a6
TargetContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
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 ...
AndrewM1998/MultimodalNMT
TargetContextGate
false
7,710
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
MFB
import torch from torch import nn from torch.nn import functional as F class MFB(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_norm=0.0, dropout_output=0.0): super(MFB,...
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...
AndresPMD/GCN_classification
MFB
false
7,711
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
Mlp
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Arnav0400/ViT-Slim
Mlp
false
7,712
[ "MIT" ]
14
78edd4fecbb8cd4043e9878148576b1c327c74f9
https://github.com/Arnav0400/ViT-Slim/tree/78edd4fecbb8cd4043e9878148576b1c327c74f9
QGOODLoss
import math import torch import torch.nn as nn import torch.distributions import torch.utils.data class QGOODLoss(nn.Module): def __init__(self, quantile=0.8): super().__init__() self.quantile = quantile def forward(self, ub_log_conf): batch_size_out = ub_log_conf.shape[0] l ...
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.distributions import torch.utils.data assert...
AlexMeinke/Provable-OOD-Detection
QGOODLoss
false
7,713
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
MultinomialKLDivergenceLoss
import torch from torch import nn class MultinomialKLDivergenceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, p_proba, q_proba): loss = q_proba * (torch.log(q_proba) - torch.log(p_proba)) loss = torch.sum(loss) return loss / (p_proba.size(1) * p_pro...
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...
AuCson/SEDST
MultinomialKLDivergenceLoss
false
7,714
[ "MIT" ]
23
1c1691e2abc50eb2120ed49c874090f6c4f741d3
https://github.com/AuCson/SEDST/tree/1c1691e2abc50eb2120ed49c874090f6c4f741d3
GCN
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Anou9531/GUA
GCN
false
7,715
[ "MIT" ]
20
354acceb69656e76fb4ee296c66ae42c18cd939f
https://github.com/Anou9531/GUA/tree/354acceb69656e76fb4ee296c66ae42c18cd939f
MSELoss
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import functools import torch.nn as nn import torch.nn.functional as F assert_size_stride...
Andrew-Zhu/DyFPN
MSELoss
false
7,716
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
BothContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
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 ...
AndrewM1998/MultimodalNMT
BothContextGate
false
7,717
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
ContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
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.cuda assert_size_stride = torch._C._dynamo.gu...
AndrewM1998/MultimodalNMT
ContextGate
false
7,718
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
LandmarkLoss
import math import torch from torch import nn def wing_loss(y_true, y_pred, N_LANDMARK, w=10.0, epsilon=2.0): y_pred = y_pred.reshape(-1, N_LANDMARK, 2) y_true = y_true.reshape(-1, N_LANDMARK, 2) x = y_true - y_pred c = w * (1.0 - math.log(1.0 + w / epsilon)) absolute_x = torch.abs(x) 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 from torch._inductor.runtime.triton_helpers import math as tl_math import math from torch import nn assert_size_stride = torch._C._dynamo.gu...
AnthonyF333/FaceLandmark_PFLD_UltraLight
LandmarkLoss
false
7,719
[ "Apache-2.0" ]
38
c7c9543bd7f44ab434240eab077242f259df21f8
https://github.com/AnthonyF333/FaceLandmark_PFLD_UltraLight/tree/c7c9543bd7f44ab434240eab077242f259df21f8
MFH
import torch from torch import nn from torch.nn import functional as F class MFH(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(MFH, ...
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...
AndresPMD/GCN_classification
MFH
false
7,720
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
LinearSum
import torch from torch import nn from torch.nn import functional as F class LinearSum(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(LinearSu...
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...
AndresPMD/GCN_classification
LinearSum
false
7,721
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
L1Loss
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Andrew-Zhu/DyFPN
L1Loss
false
7,722
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
DeconvBlock
import torch import torch.nn as nn class DeconvBlock(nn.Module): def __init__(self, in_channels, out_channels): super(DeconvBlock, self).__init__() self.conv = nn.ConvTranspose2d(in_channels, out_channels, kernel_size=3, stride=2, padding=1, output_padding=0) self.pad = nn.Ref...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
ArminMasoumian/GCNDepth
DeconvBlock
false
7,723
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
ConvBlock
import torch import torch.nn as nn class Conv3x3(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1) self.conv = nn.Conv2d(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.triton_helpers import libdevice, math as tl_math im...
ArminMasoumian/GCNDepth
ConvBlock
false
7,724
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
CrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Andrew-Zhu/DyFPN
CrossEntropyLoss
false
7,725
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
SSIM
import torch import torch.nn as nn class SSIM(nn.Module): def __init__(self): super(SSIM, self).__init__() self.mu_x_pool = nn.AvgPool2d(3, 1) self.mu_y_pool = nn.AvgPool2d(3, 1) self.sig_x_pool = nn.AvgPool2d(3, 1) self.sig_y_pool = nn.AvgPool2d(3, 1) self.sig_xy_...
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 ...
ArminMasoumian/GCNDepth
SSIM
false
7,726
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
Hardswish
import torch import torch.nn as nn import torch.nn.functional as F class Hardswish(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AsakusaRinne/tensorrt_yolov5_tracker
Hardswish
false
7,727
[ "MIT" ]
22
b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
https://github.com/AsakusaRinne/tensorrt_yolov5_tracker/tree/b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
FlopsCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Andrew-Zhu/DyFPN
FlopsCrossEntropyLoss
false
7,728
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
GaussianFocalLoss
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Andrew-Zhu/DyFPN
GaussianFocalLoss
false
7,729
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
Conv3x3
import torch import torch.nn as nn class Conv3x3(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1) self.conv = nn.Conv2d(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.triton_helpers import math as tl_math import torch....
ArminMasoumian/GCNDepth
Conv3x3
false
7,730
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
Project
import torch import torch.nn as nn class Project(nn.Module): def __init__(self, batch_size, height, width, eps=1e-07): super(Project, self).__init__() self.batch_size = batch_size self.height = height self.width = width self.eps = eps def forward(self, points, K, T): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ArminMasoumian/GCNDepth
Project
false
7,731
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
MakeFeatures
import torch import torch.nn as nn class MakeFeatures(nn.Module): """ Returns features to be used by PairDrift. """ def __init__(self, in_dim, out_dim): super(MakeFeatures, self).__init__() self.single = nn.Linear(in_dim, out_dim) self.pair = nn.Linear(in_dim, out_dim) def forwar...
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...
AustenLamacraft/QuaRL
MakeFeatures
false
7,732
[ "MIT" ]
13
1764f0ccd0ba90d44e799b6ac908df76be14a52e
https://github.com/AustenLamacraft/QuaRL/tree/1764f0ccd0ba90d44e799b6ac908df76be14a52e
Conv5x5
import torch import torch.nn as nn class Conv5x5(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super(Conv5x5, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(2) else: self.pad = nn.ZeroPad2d(2) self.conv = nn.Conv2d(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.triton_helpers import math as tl_math import torch....
ArminMasoumian/GCNDepth
Conv5x5
false
7,733
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
BCEBlurWithLogitsLoss
import torch import torch.nn as nn class BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super(BCEBlurWithLogitsLoss, self).__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): loss = self.loss_f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
AsakusaRinne/tensorrt_yolov5_tracker
BCEBlurWithLogitsLoss
false
7,734
[ "MIT" ]
22
b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
https://github.com/AsakusaRinne/tensorrt_yolov5_tracker/tree/b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
GCNSynthetic
import math import torch import torch.nn.functional as F import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, bias=True): super(Grap...
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....
Armagaan/cf-gnnexplainer
GCNSynthetic
false
7,735
[ "MIT" ]
15
22b415e114c52d8d60ca45a40c3cb33c1947400c
https://github.com/Armagaan/cf-gnnexplainer/tree/22b415e114c52d8d60ca45a40c3cb33c1947400c
BertLayerNorm
import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ArrowLuo/GRACE
BertLayerNorm
false
7,736
[ "Apache-2.0" ]
17
f27b500ba905685c03eee6d91d87adc9ef78b4d1
https://github.com/ArrowLuo/GRACE/tree/f27b500ba905685c03eee6d91d87adc9ef78b4d1
Net
import torch class Net(torch.nn.Module): def __init__(self, n_input, n_hidden, n_output): super(Net, self).__init__() self.hidden1 = torch.nn.Linear(n_input, n_hidden) self.hidden2 = torch.nn.Linear(n_hidden, n_hidden) self.hidden3 = torch.nn.Linear(n_hidden, n_hidden) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
AstroHiro/NCM
Net
false
7,737
[ "MIT" ]
23
720db63ec018a1986ac9e370613f8209328b89e1
https://github.com/AstroHiro/NCM/tree/720db63ec018a1986ac9e370613f8209328b89e1
CrossEntropyLossOneHot
import torch import torch.nn as nn class CrossEntropyLossOneHot(nn.Module): def __init__(self): super(CrossEntropyLossOneHot, self).__init__() self.log_softmax = nn.LogSoftmax(dim=-1) def forward(self, preds, labels): return torch.mean(torch.sum(-labels * self.log_softmax(preds), -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 import torch.nn as nn ...
B0Qi/hualubei2020-callingsmoking
CrossEntropyLossOneHot
false
7,738
[ "MIT" ]
27
73d1049d95554b5d669afa93132a0fce37461ff4
https://github.com/B0Qi/hualubei2020-callingsmoking/tree/73d1049d95554b5d669afa93132a0fce37461ff4
Attn
import torch from torch import nn import torch.nn.functional as F class Attn(nn.Module): def __init__(self, hidden_size): super(Attn, self).__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) self.v = nn.Linear(self.hidden_size, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AuCson/SEDST
Attn
false
7,739
[ "MIT" ]
23
1c1691e2abc50eb2120ed49c874090f6c4f741d3
https://github.com/AuCson/SEDST/tree/1c1691e2abc50eb2120ed49c874090f6c4f741d3
PermEqMean
import torch import torch.nn as nn class PermEqMean(nn.Module): """ Returns equivariant layer used by EquivarDrift. """ def __init__(self, in_dim, out_dim): super(PermEqMean, self).__init__() self.Gamma = nn.Linear(in_dim, out_dim) self.Lambda = nn.Linear(in_dim, out_dim, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AustenLamacraft/QuaRL
PermEqMean
false
7,740
[ "MIT" ]
13
1764f0ccd0ba90d44e799b6ac908df76be14a52e
https://github.com/AustenLamacraft/QuaRL/tree/1764f0ccd0ba90d44e799b6ac908df76be14a52e
CombineFeatures
import torch import torch.nn as nn class CombineFeatures(nn.Module): """ Returns layer to be used by PairDrift. """ def __init__(self, in_dim, out_dim, zero_init=False): super(CombineFeatures, self).__init__() self.single = nn.Linear(in_dim, out_dim) self.pair = nn.Linear(in_dim, out_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AustenLamacraft/QuaRL
CombineFeatures
false
7,741
[ "MIT" ]
13
1764f0ccd0ba90d44e799b6ac908df76be14a52e
https://github.com/AustenLamacraft/QuaRL/tree/1764f0ccd0ba90d44e799b6ac908df76be14a52e
disparityentropy
import torch from torch import nn import torch.utils.data import torch.nn.parallel class disparityentropy(nn.Module): def __init__(self, maxdisp): super(disparityentropy, self).__init__() def forward(self, x): out = torch.sum(-x * torch.log(x), 1) return out def get_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data import torch.nn.parallel ass...
AvrilCheng/LidarStereoNet
disparityentropy
false
7,742
[ "MIT" ]
27
96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
https://github.com/AvrilCheng/LidarStereoNet/tree/96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
ConvReLUNorm
import torch import torch.utils.data import torch.nn.functional as F class ConvReLUNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0): super(ConvReLUNorm, self).__init__() self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size= ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AstraliteHeart/cookietts
ConvReLUNorm
false
7,743
[ "BSD-3-Clause" ]
25
c871f5f7b5790656d5b57bcd9e63946a2da52f0f
https://github.com/AstraliteHeart/cookietts/tree/c871f5f7b5790656d5b57bcd9e63946a2da52f0f
ScaledDotProductAttention
import torch import numpy as np from torch import nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ArrowLuo/GRACE
ScaledDotProductAttention
false
7,744
[ "Apache-2.0" ]
17
f27b500ba905685c03eee6d91d87adc9ef78b4d1
https://github.com/ArrowLuo/GRACE/tree/f27b500ba905685c03eee6d91d87adc9ef78b4d1
ConvNorm
import torch import torch.utils.data import torch.nn.functional as F class ConvNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=None, dilation=1, bias=True, w_init_gain='linear', dropout=0.0 ): super(ConvNorm, self).__init__() 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size...
AstraliteHeart/cookietts
ConvNorm
false
7,745
[ "BSD-3-Clause" ]
25
c871f5f7b5790656d5b57bcd9e63946a2da52f0f
https://github.com/AstraliteHeart/cookietts/tree/c871f5f7b5790656d5b57bcd9e63946a2da52f0f
Conv1d
import torch import torch.utils.data from torch import nn from torch.nn import Conv1d class Conv1d(nn.Conv1d): """ :param in_channels: Scalar :param out_channels: Scalar :param kernel_size: Scalar :param activation_fn: activation function :param drop_rate: Scalar. dropout rate :param 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.utils.data from torch import nn assert_size_stride = torch._C._dyna...
AstraliteHeart/cookietts
Conv1d
false
7,746
[ "BSD-3-Clause" ]
25
c871f5f7b5790656d5b57bcd9e63946a2da52f0f
https://github.com/AstraliteHeart/cookietts/tree/c871f5f7b5790656d5b57bcd9e63946a2da52f0f
Conv2d
import torch import torch.utils.data from torch import nn from torch.nn import Conv2d class Conv2d(nn.Conv2d): """ :param in_channels: Scalar :param out_channels: Scalar :param kernel_size: Scalar :param activation_fn: activation function :param drop_rate: Scalar. dropout rate :param 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.utils.data from torch import nn assert_size_stride = torch._C._dyna...
AstraliteHeart/cookietts
Conv2d
false
7,747
[ "BSD-3-Clause" ]
25
c871f5f7b5790656d5b57bcd9e63946a2da52f0f
https://github.com/AstraliteHeart/cookietts/tree/c871f5f7b5790656d5b57bcd9e63946a2da52f0f
PositionwiseFeedForward
import math import torch from torch import nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 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.triton_helpers import libdevice import math from to...
ArrowLuo/GRACE
PositionwiseFeedForward
false
7,748
[ "Apache-2.0" ]
17
f27b500ba905685c03eee6d91d87adc9ef78b4d1
https://github.com/ArrowLuo/GRACE/tree/f27b500ba905685c03eee6d91d87adc9ef78b4d1
Conv2d
from torch.nn import Module import math import torch from torch.nn import functional as F import torch.utils.data from torch.nn.parameter import Parameter from torch.nn.functional import pad from torch.nn.modules import Module from torch.nn.modules.utils import _pair import torch.nn.parallel def conv2d_same_padding(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.nn import Module import math from torch.nn import functional as F imp...
AvrilCheng/LidarStereoNet
Conv2d
false
7,749
[ "MIT" ]
27
96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
https://github.com/AvrilCheng/LidarStereoNet/tree/96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
SiLU
import torch import torch.nn as nn class SiLU(nn.Module): """export-friendly version of nn.SiLU()""" @staticmethod def forward(x): return x * torch.sigmoid(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Arui66/YOLOX
SiLU
false
7,750
[ "Apache-2.0" ]
16
7ee17936db849600817d7de05269bfdfb1a0eb48
https://github.com/Arui66/YOLOX/tree/7ee17936db849600817d7de05269bfdfb1a0eb48
Auto_Encoder_Model
import torch import torch.nn as nn import torch.nn.functional as F class Auto_Encoder_Model(nn.Module): def __init__(self): super(Auto_Encoder_Model, self).__init__() self.conv1 = nn.Conv2d(1, 64, padding=1, kernel_size=3) self.max_pool1 = nn.MaxPool2d(2) self.conv2 = nn.Conv2d(64...
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 ...
Awenbocc/med-vqa
Auto_Encoder_Model
false
7,751
[ "MIT" ]
27
0cca6811e38cf54aff6a7cce3442296d07875e64
https://github.com/Awenbocc/med-vqa/tree/0cca6811e38cf54aff6a7cce3442296d07875e64
Attention_SEblock
import torch import torch.nn as nn import torch.nn.functional as F class Attention_SEblock(nn.Module): def __init__(self, channels, reduction, temperature): super(Attention_SEblock, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Linear(channels, channels // reducti...
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....
Andrew-Zhu/DyFPN
Attention_SEblock
false
7,752
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
Conv3d
from torch.nn import Module import math import torch from torch.nn import functional as F import torch.utils.data from torch.nn.parameter import Parameter from torch.nn.functional import pad from torch.nn.modules import Module from torch.nn.modules.utils import _triple import torch.nn.parallel def conv3d_same_padding...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import math from torch.nn import functional as F imp...
AvrilCheng/LidarStereoNet
Conv3d
false
7,753
[ "MIT" ]
27
96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
https://github.com/AvrilCheng/LidarStereoNet/tree/96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
ShiftedSoftplus
import torch import torch.nn.functional as F class ShiftedSoftplus(torch.nn.Module): def __init__(self): super(ShiftedSoftplus, self).__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_inputs(): return [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.triton_helpers import libdevice, math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
BaratiLab/AugLiChem
ShiftedSoftplus
false
7,754
[ "MIT" ]
16
37258b5ce2c653436b3e819b58d2659052d6edcc
https://github.com/BaratiLab/AugLiChem/tree/37258b5ce2c653436b3e819b58d2659052d6edcc
Upsample
import torch import torch.nn as nn import torch.utils.data import torch.nn.functional as F class Upsample(nn.Module): def __init__(self, scale_factor=2, size=None): super(Upsample, self).__init__() self.upsample = F.upsample_nearest self.size = size self.scale_factor = scale_facto...
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.nn.functional as F assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
Bhaskers-Blu-Org1/gfmn
Upsample
false
7,756
[ "Apache-2.0" ]
15
52b4fd005f8c52297bd6aa5d93e4a1c8d46f56ce
https://github.com/Bhaskers-Blu-Org1/gfmn/tree/52b4fd005f8c52297bd6aa5d93e4a1c8d46f56ce
ChamferLoss
import torch import torch.nn as nn def batch_pairwise_dist(x, y): _bs, num_points_x, _points_dim = x.size() _, num_points_y, _ = y.size() xx = torch.bmm(x, x.transpose(2, 1)) yy = torch.bmm(y, y.transpose(2, 1)) zz = torch.bmm(x, y.transpose(2, 1)) diag_ind_x = torch.arange(0, num_points_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_...
AnTao97/UnsupervisedPointCloudSegmentation
ChamferLoss
false
7,757
[ "MIT" ]
13
9bcf0bdf3b1ae62421d9202eb7c0b014d6a69c02
https://github.com/AnTao97/UnsupervisedPointCloudSegmentation/tree/9bcf0bdf3b1ae62421d9202eb7c0b014d6a69c02
Step
import torch import torch.nn as nn class StepF(torch.autograd.Function): """ A step function that returns values in {-1, 1} and uses the Straigh-Through Estimator to update upstream weights in the network """ @staticmethod def forward(ctx, input_): ctx.save_for_backward(input_) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Bhaskers-Blu-Org1/online-alt-min
Step
false
7,758
[ "Apache-2.0" ]
23
ef31aaad639c0880df8700d34613164298bcadd0
https://github.com/Bhaskers-Blu-Org1/online-alt-min/tree/ef31aaad639c0880df8700d34613164298bcadd0
BilinearAttention
import torch import torch.utils.data from torch import nn class BilinearAttention(nn.Module): """ :param enc_dim: Scalar. :param dec_dim: Scalar """ def __init__(self, enc_dim, dec_dim): super(BilinearAttention, self).__init__() self.W = nn.Linear(enc_dim, dec_dim) def forwa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AstraliteHeart/cookietts
BilinearAttention
false
7,759
[ "BSD-3-Clause" ]
25
c871f5f7b5790656d5b57bcd9e63946a2da52f0f
https://github.com/AstraliteHeart/cookietts/tree/c871f5f7b5790656d5b57bcd9e63946a2da52f0f
InnerProductLoss
import torch import torch.nn as nn import torch.nn.functional as F class InnerProductLoss(nn.Module): """This is the inner-product loss used in CFKG for optimization. """ def __init__(self): super(InnerProductLoss, self).__init__() def forward(self, anchor, positive, negative): pos_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, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
BELIEVEfxy/LightSANs
InnerProductLoss
false
7,760
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
Conv1d2Score
import torch import torch.nn as nn import torch.optim import torch.utils.data class Conv1d2Score(nn.Module): """Calculate a N*out_dim tensor from N*in_dim*seq_len using nn.Conv1d Essentially it is a linear layer Args: in_dim: int out_dim: int, usually number of classes seq_len: int 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 import torch.nn as nn import torch.optim import torch.utils.data assert_size_str...
BeautyOfWeb/VIN
Conv1d2Score
false
7,761
[ "MIT" ]
34
53343d28130f5fd6e5badb58daf8079a5933fd6a
https://github.com/BeautyOfWeb/VIN/tree/53343d28130f5fd6e5badb58daf8079a5933fd6a
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...
Arui66/YOLOX
IOUloss
false
7,762
[ "Apache-2.0" ]
16
7ee17936db849600817d7de05269bfdfb1a0eb48
https://github.com/Arui66/YOLOX/tree/7ee17936db849600817d7de05269bfdfb1a0eb48
WeightedView
import torch import torch.nn as nn import torch.optim import torch.utils.data class WeightedView(nn.Module): """Calculate weighted view Args: num_groups: int, number of groups (views) reduce_dimension: bool, default False. If True, reduce dimension dim dim: default -1. Only used 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.optim import torch.utils.data assert_s...
BeautyOfWeb/AffinityNet
WeightedView
false
7,763
[ "MIT" ]
34
d3f79823fa0182328894483165d4f0853740ee53
https://github.com/BeautyOfWeb/AffinityNet/tree/d3f79823fa0182328894483165d4f0853740ee53
LearnedUpsampling1d
import torch from torch import nn class LearnedUpsampling1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, bias=True): super().__init__() self.conv_t = nn.ConvTranspose1d(in_channels=in_channels, out_channels=out_channels, kernel_size=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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Barbany/Multi-speaker-Neural-Vocoder
LearnedUpsampling1d
false
7,764
[ "MIT" ]
13
a3f5c266603b17bcbe264e750947140f302272c8
https://github.com/Barbany/Multi-speaker-Neural-Vocoder/tree/a3f5c266603b17bcbe264e750947140f302272c8
InnerProductLayer
import torch import torch.nn as nn class InnerProductLayer(nn.Module): """InnerProduct Layer used in PNN that compute the element-wise product or inner product between feature vectors. """ def __init__(self, num_feature_field, device): """ Args: num_feature_field(int) :nu...
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...
BELIEVEfxy/LightSANs
InnerProductLayer
false
7,765
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
ConvLSTMCell
import torch import torch.nn as nn class ConvLSTMCell(nn.Module): """ Implementation of the Basic ConvLSTM. No peephole connection, no forget gate. ConvLSTM: x - input h - hidden representation c - memory cell f - forget gate o - output gate Reference:Conv...
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 ...
BenQLange/AttentionAugmentedConvLSTM
ConvLSTMCell
false
7,766
[ "MIT" ]
30
d8419b7a628b02ac49e8450deb3d60450c7b2d6b
https://github.com/BenQLange/AttentionAugmentedConvLSTM/tree/d8419b7a628b02ac49e8450deb3d60450c7b2d6b
BPRLoss
import torch import torch.nn as nn class BPRLoss(nn.Module): """ BPRLoss, based on Bayesian Personalized Ranking Args: - gamma(float): Small value to avoid division by zero Shape: - Pos_score: (N) - Neg_score: (N), same shape as the Pos_score - Output: scalar. Exampl...
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 ...
BELIEVEfxy/LightSANs
BPRLoss
false
7,767
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
Policy
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.optim import torch.autograd class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.affine1 = nn.Linear(4, 128) self.affine2 = 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....
BestSonny/examples
Policy
false
7,768
[ "BSD-3-Clause" ]
13
4b7365c0db22133d1793e53bb3674c2d0ebaeac1
https://github.com/BestSonny/examples/tree/4b7365c0db22133d1793e53bb3674c2d0ebaeac1
ConvNCFBPRLoss
import torch import torch.nn as nn class ConvNCFBPRLoss(nn.Module): """ ConvNCFBPRLoss, based on Bayesian Personalized Ranking, Shape: - Pos_score: (N) - Neg_score: (N), same shape as the Pos_score - Output: scalar. Examples:: >>> loss = ConvNCFBPRLoss() >>> ...
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 ...
BELIEVEfxy/LightSANs
ConvNCFBPRLoss
false
7,769
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
AttLayer
import torch import torch.nn as nn import torch.nn.functional as fn class AttLayer(nn.Module): """Calculate the attention signal(weight) according the input tensor. Args: infeatures (torch.FloatTensor): A 3D input tensor with shape of[batch_size, M, embed_dim]. Returns: torch.FloatTensor...
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....
BELIEVEfxy/LightSANs
AttLayer
false
7,770
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
SpanClassifier
import torch import torch.nn as nn from torch.nn import BCELoss class SpanClassifier(nn.Module): """given the span embeddings, classify whether their relations""" def __init__(self, d_inp): super(SpanClassifier, self).__init__() self.d_inp = d_inp self.bilinear_layer = nn.Bilinear(d_i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn import BCELoss assert_size_stride = torch._C._dynamo.guards.assert_size_stride reinterpret_tensor = torc...
Bhaskers-Blu-Org1/superglue-mtl
SpanClassifier
false
7,771
[ "Apache-2.0" ]
15
1eb3e581c0ef3b4c261e0256ec26116d2b657c40
https://github.com/Bhaskers-Blu-Org1/superglue-mtl/tree/1eb3e581c0ef3b4c261e0256ec26116d2b657c40
RegLoss
import torch import torch.nn as nn class RegLoss(nn.Module): """ RegLoss, L2 regularization on model parameters """ def __init__(self): super(RegLoss, self).__init__() def forward(self, parameters): reg_loss = None for W in parameters: if reg_loss is None: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
BELIEVEfxy/LightSANs
RegLoss
false
7,772
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
OuterProductLayer
import torch import torch.nn as nn class OuterProductLayer(nn.Module): """OutterProduct Layer used in PNN. This implemention is adapted from code that the author of the paper published on https://github.com/Atomu2014/product-nets. """ def __init__(self, num_feature_field, embedding_size, device): ...
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...
BELIEVEfxy/LightSANs
OuterProductLayer
false
7,773
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
Sign
from torch.autograd import Function import torch import torch.nn as nn class SignFunction(Function): def __init__(self): super(SignFunction, self).__init__() @staticmethod def forward(ctx, input, is_training=True): if is_training: prob = input.new(input.size()).uniform_() ...
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.autograd import Function import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda...
Biaze7/lossy-image-compression
Sign
false
7,774
[ "MIT" ]
16
88ca2022a306fea52d6671593b314f0de3bf6010
https://github.com/Biaze7/lossy-image-compression/tree/88ca2022a306fea52d6671593b314f0de3bf6010
D_phiVpsi
import torch import torch.utils.data import torch.nn as nn def add_layer(seq, ix, n_inputs, n_outputs, nonlin, normalization): seq.add_module('L' + str(ix), nn.Linear(n_inputs, n_outputs)) if ix > 0 and normalization: if normalization == 'LN': seq.main.add_module('A' + str(ix), nn.LayerNor...
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 as nn assert_size_stride = torch._C._dyn...
Bhaskers-Blu-Org1/SIC
D_phiVpsi
false
7,775
[ "Apache-2.0" ]
12
c4e45d7736da6e6faabdc56bfc1336445df99204
https://github.com/Bhaskers-Blu-Org1/SIC/tree/c4e45d7736da6e6faabdc56bfc1336445df99204
Vgg16
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Vgg16(nn.Module): def __init__(self): super(Vgg16, self).__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...
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 ...
AllenPu/mbdg
Vgg16
false
7,776
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
BaseFactorizationMachine
import torch import torch.nn as nn class BaseFactorizationMachine(nn.Module): """Calculate FM result over the embeddings Args: reduce_sum: bool, whether to sum the result, default is True. Input: input_x: tensor, A 3D tensor with shape:``(batch_size,field_size,embed_dim)``. Output ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
BELIEVEfxy/LightSANs
BaseFactorizationMachine
false
7,777
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e
AdjEncoder
import torch from torch import nn import torch.utils.data class AdjEncoder(nn.Module): def __init__(self, featureSize, hiddenSize): super(AdjEncoder, self).__init__() self.left = nn.Linear(featureSize, hiddenSize) self.right = nn.Linear(featureSize, hiddenSize, bias=False) self.se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
BigkoalaZhu/SCORES
AdjEncoder
false
7,778
[ "MIT" ]
16
8332733c375ee85c02bd34c2adce6a3213aad3c4
https://github.com/BigkoalaZhu/SCORES/tree/8332733c375ee85c02bd34c2adce6a3213aad3c4
Binarizer
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class SignFunction(Function): def __init__(self): super(SignFunction, self).__init__() @staticmethod def forward(ctx, input, is_training=True): if is_training: prob = 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.triton_helpers import libdevice from torch.autograd...
Biaze7/lossy-image-compression
Binarizer
false
7,779
[ "MIT" ]
16
88ca2022a306fea52d6671593b314f0de3bf6010
https://github.com/Biaze7/lossy-image-compression/tree/88ca2022a306fea52d6671593b314f0de3bf6010
Perceptron
import torch import torch.nn as nn import torch.nn.functional as F class Perceptron(nn.Module): """Implements a 1-layer perceptron.""" def __init__(self, input_dimension, hidden_dimension, output_dimension): super(Perceptron, self).__init__() self._layer1 = nn.Linear(input_dimension, hidden_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 import torch.nn as nn assert_...
Bhaskers-Blu-Org2/PDP-Solver
Perceptron
false
7,780
[ "MIT" ]
28
1fca34d81f36268288f46416fb6956e5b36df69e
https://github.com/Bhaskers-Blu-Org2/PDP-Solver/tree/1fca34d81f36268288f46416fb6956e5b36df69e
BoxEncoder
import torch from torch import nn import torch.utils.data class BoxEncoder(nn.Module): def __init__(self, boxSize, featureSize, hiddenSize): super(BoxEncoder, self).__init__() self.encoder = nn.Linear(boxSize, featureSize) self.middlein = nn.Linear(featureSize, hiddenSize) self.mi...
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...
BigkoalaZhu/SCORES
BoxEncoder
false
7,781
[ "MIT" ]
16
8332733c375ee85c02bd34c2adce6a3213aad3c4
https://github.com/BigkoalaZhu/SCORES/tree/8332733c375ee85c02bd34c2adce6a3213aad3c4
kAttentionPooling
import torch import torch.nn as nn class kAttentionPooling(nn.Module): def __init__(self, seq_len, hidden_size, k_heads=5): super().__init__() self.k_heads = k_heads self.theta_k = nn.Parameter(torch.randn([hidden_size, k_heads])) def forward(self, input_tensor): attention_ma...
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....
BELIEVEfxy/LightSANs
kAttentionPooling
false
7,782
[ "MIT" ]
17
94ce7e59d144dbc787153b8c486cad334790ec6e
https://github.com/BELIEVEfxy/LightSANs/tree/94ce7e59d144dbc787153b8c486cad334790ec6e