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
MaxPoolStride1
import torch from torch import nn import torch.nn.functional as F import torch.utils.data class MaxPoolStride1(nn.Module): def __init__(self, kernel_size): super(MaxPoolStride1, self).__init__() self.kernel_size = kernel_size self.pad = kernel_size - 1 def forward(self, x): p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards...
Dazz993/AlphaPose
MaxPoolStride1
false
5,049
[ "Apache-2.0" ]
1
d4b9a3af5f590fa21bd033b4a19e98b5748ae683
https://github.com/Dazz993/AlphaPose/tree/d4b9a3af5f590fa21bd033b4a19e98b5748ae683
RSoftmax
import torch import torch.nn as nn import torch.nn.functional as F class RSoftmax(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input. """ def __init__(self, radix, groups): super().__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
David-19940718/mmclassification
RSoftmax
false
5,050
[ "Apache-2.0" ]
1
987dd45457e38c4787237ea468799849dce11ada
https://github.com/David-19940718/mmclassification/tree/987dd45457e38c4787237ea468799849dce11ada
ConvRelu
import torch import torch.utils.data import torch.nn as nn import torch.onnx import torch.autograd import torch.backends.cudnn class ConvRelu(nn.Module): """3x3 convolution followed by ReLU activation building block.""" def __init__(self, num_in, num_out): super().__init__() self.block = nn.C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
CorentinLemaitre/robosat.pink
ConvRelu
false
5,051
[ "MIT" ]
1
6ec29a4dd4c0cbf953e73818d7338ee68b2451d3
https://github.com/CorentinLemaitre/robosat.pink/tree/6ec29a4dd4c0cbf953e73818d7338ee68b2451d3
FocalLoss
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 libdevice, math as tl_math import torc...
David-19940718/mmclassification
FocalLoss
false
5,052
[ "Apache-2.0" ]
1
987dd45457e38c4787237ea468799849dce11ada
https://github.com/David-19940718/mmclassification/tree/987dd45457e38c4787237ea468799849dce11ada
FocalTverskyLoss
import torch from torch import nn class FocalTverskyLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(FocalTverskyLoss, self).__init__() def forward(self, inputs, targets, smooth=1, alpha=0.3, beta=0.7, gamma=2): inputs = inputs.view(-1) targets = targets.vie...
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...
DeVriesMatt/cellshape-voxel
FocalTverskyLoss
false
5,053
[ "BSD-3-Clause" ]
1
64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
https://github.com/DeVriesMatt/cellshape-voxel/tree/64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
SplAtConv2d
from torch.nn import Module import torch from torch import nn import torch.nn.functional as F from torch.nn import Conv2d from torch.nn import ReLU from torch.nn.modules.utils import _pair class DropBlock2D(object): def __init__(self, *args, **kwargs): raise NotImplementedError class rSoftMax(nn.Module...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DYF-AI/openvino-x
SplAtConv2d
false
5,054
[ "Apache-2.0" ]
1
0f18ebb240ea3394f7e461aca34fac158e686d95
https://github.com/DYF-AI/openvino-x/tree/0f18ebb240ea3394f7e461aca34fac158e686d95
SpatialCrossMapLRN
import torch import torch.nn as nn import torch.utils.data.dataloader import torch.utils.data import torch.backends.cudnn class SpatialCrossMapLRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True): super(SpatialCrossMapLRN, self).__init__() self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data.dataloader import torch.utils.dat...
DeepBrainsMe/PyDoctor_Final
SpatialCrossMapLRN
false
5,055
[ "MIT" ]
1
49ecfc64b2a2866e7f37cc79c1f32a817975f064
https://github.com/DeepBrainsMe/PyDoctor_Final/tree/49ecfc64b2a2866e7f37cc79c1f32a817975f064
StyleAdaptiveLayerNorm
import torch import torch.nn from torch import nn import torch.utils.data import torch.utils.data.distributed class AffineLinear(nn.Module): def __init__(self, in_dim, out_dim): super(AffineLinear, self).__init__() affine = nn.Linear(in_dim, out_dim) self.affine = affine def forward(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 fro...
DanielLin94144/StyleSpeech
StyleAdaptiveLayerNorm
false
5,056
[ "MIT" ]
1
809e8ead55bea2c63f714fdc19bf24d80f0f546c
https://github.com/DanielLin94144/StyleSpeech/tree/809e8ead55bea2c63f714fdc19bf24d80f0f546c
ATLoss
import torch import torch.nn as nn import torch.nn.functional as F class ATLoss(nn.Module): """ Module for calculating AT Loss :param norm_type (int): Norm to be used in calculating loss """ def __init__(self, norm_type=2): super(ATLoss, self).__init__() self.p = norm_type ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
DA-southampton/KD_Lib
ATLoss
false
5,057
[ "MIT" ]
1
bd4a9b93b9674607ecf467d280d5cab1c516bdc6
https://github.com/DA-southampton/KD_Lib/tree/bd4a9b93b9674607ecf467d280d5cab1c516bdc6
DiceBCELoss
import torch from torch import nn import torch.nn.functional as F class DiceBCELoss(nn.Module): def __init__(self, weight=None, size_average=True): super(DiceBCELoss, self).__init__() def forward(self, inputs, targets, smooth=1): inputs = inputs.view(-1) targets = targets.view(-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 libdevice, math as tl_math from torch ...
DeVriesMatt/cellshape-voxel
DiceBCELoss
false
5,058
[ "BSD-3-Clause" ]
1
64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
https://github.com/DeVriesMatt/cellshape-voxel/tree/64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
TverskyLoss
import torch from torch import nn class TverskyLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(TverskyLoss, self).__init__() def forward(self, inputs, targets, smooth=1, alpha=0.3, beta=0.7): inputs = inputs.view(-1) targets = targets.view(-1) TP = ...
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...
DeVriesMatt/cellshape-voxel
TverskyLoss
false
5,059
[ "BSD-3-Clause" ]
1
64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
https://github.com/DeVriesMatt/cellshape-voxel/tree/64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
EuclideanDistLoss
import torch from torch import nn class EuclideanDistLoss(nn.Module): def __init__(self): super(EuclideanDistLoss, self).__init__() def forward(self, inputs, inputs_rot): dist = torch.dist(inputs, inputs_rot, p=2.0) return dist def get_inputs(): return [torch.rand([4, 4, 4, 4])...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
DeVriesMatt/cellshape-voxel
EuclideanDistLoss
false
5,060
[ "BSD-3-Clause" ]
1
64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
https://github.com/DeVriesMatt/cellshape-voxel/tree/64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
MaskedMSELoss
import torch import torch.utils.data from torch import nn class MaskedMSELoss(nn.Module): def __init__(self): super(MaskedMSELoss, self).__init__() def forward(self, pred, target, output_lengths): squared_error = (target - pred) ** 2 loss = (squared_error.mean(1).sum(1) / output_leng...
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.utils.data from torch import nn assert_size_stride = torch._C._dynamo.guards...
DashaSerdyuk/tacotron2
MaskedMSELoss
false
5,061
[ "BSD-3-Clause" ]
1
1a88669670750f8b0e1aff76abc8b1b15300e1dc
https://github.com/DashaSerdyuk/tacotron2/tree/1a88669670750f8b0e1aff76abc8b1b15300e1dc
FocalLoss
import torch from torch import nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(FocalLoss, self).__init__() def forward(self, inputs, targets, alpha=0.8, gamma=2, smooth=1): inputs = inputs.view(-1) targets = tar...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
DeVriesMatt/cellshape-voxel
FocalLoss
false
5,062
[ "BSD-3-Clause" ]
1
64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
https://github.com/DeVriesMatt/cellshape-voxel/tree/64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
h_swish
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.dataloader import torch.utils.data import torch.backends.cudnn class h_swish(nn.Module): def __init__(self, inplace=True): super(h_swish, self).__init__() self.inplace = inplace 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.dataloader import torch.utils.data import t...
DeepBrainsMe/PyDoctor_Final
h_swish
false
5,063
[ "MIT" ]
1
49ecfc64b2a2866e7f37cc79c1f32a817975f064
https://github.com/DeepBrainsMe/PyDoctor_Final/tree/49ecfc64b2a2866e7f37cc79c1f32a817975f064
ReconstructLoss
import torch import torch.nn as nn class ReconstructLoss(nn.Module): def __init__(self): super(ReconstructLoss, self).__init__() self.criterion = nn.L1Loss() def forward(self, x, y): loss = self.criterion(x, y) return loss def get_inputs(): return [torch.rand([4, 4, 4, ...
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 ...
DevKiHyun/SRNTT.pytorch
ReconstructLoss
false
5,064
[ "MIT" ]
1
d7540921983cf42ea2a7eef544862a95318e6a35
https://github.com/DevKiHyun/SRNTT.pytorch/tree/d7540921983cf42ea2a7eef544862a95318e6a35
SinActv
import torch import torch.nn as nn class SinActv(nn.Module): """The sin activation function. """ def __init__(self): """Initializer method. """ super().__init__() def forward(self, input_): return torch.sin(input_) def get_inputs(): return [torch.rand([4, 4, 4, ...
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...
DiffEqML/neurodiffeq
SinActv
false
5,065
[ "MIT" ]
1
c5e7404c47a4729578ee2149f289be0a8909d775
https://github.com/DiffEqML/neurodiffeq/tree/c5e7404c47a4729578ee2149f289be0a8909d775
AvgSpacial
import torch import torch.utils.data import torch.nn as nn import torch.utils.checkpoint class AvgSpacial(nn.Module): def forward(self, inp): return inp.view(inp.size(0), inp.size(1), -1).mean(-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 import torch.utils.data import torch.nn as nn import torch.utils.checkpoint assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
CNNs4QSPR/se3cnn
AvgSpacial
false
5,066
[ "MIT" ]
1
513f5f827c4c511bdc96e3c6ea663c8fbce60f57
https://github.com/CNNs4QSPR/se3cnn/tree/513f5f827c4c511bdc96e3c6ea663c8fbce60f57
DiceLoss
import torch from torch import nn class DiceLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(DiceLoss, self).__init__() def forward(self, inputs, targets, smooth=1): inputs = inputs.view(-1) targets = targets.view(-1) intersection = (inputs * targets...
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...
DeVriesMatt/cellshape-voxel
DiceLoss
false
5,067
[ "BSD-3-Clause" ]
1
64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
https://github.com/DeVriesMatt/cellshape-voxel/tree/64c2c57cc8b8ebe7f6ba1934caaaa3aaa1d6a0c1
maxout
import torch import torch.nn as nn import torch.utils.data class maxout(nn.Module): def __init__(self, in_feature, out_feature, pool_size): super(maxout, self).__init__() self.in_feature = in_feature self.out_feature = out_feature self.pool_size = pool_size self.linear = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Diego999/Global-Encoding
maxout
false
5,068
[ "MIT" ]
1
d3a4af9459ac3192686c94de6f2693afd6083638
https://github.com/Diego999/Global-Encoding/tree/d3a4af9459ac3192686c94de6f2693afd6083638
MonomialNN
import torch import torch.nn as nn from warnings import warn class MonomialNN(nn.Module): """A network that expands its input to a given list of monomials. Its output shape will be (n_samples, n_input_units * n_degrees) :param degrees: max degree to be included, or a list of degrees that will be used ...
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 warnings import warn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._...
DiffEqML/neurodiffeq
MonomialNN
false
5,069
[ "MIT" ]
1
c5e7404c47a4729578ee2149f289be0a8909d775
https://github.com/DiffEqML/neurodiffeq/tree/c5e7404c47a4729578ee2149f289be0a8909d775
SigSoftmaxV1
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def logsigsoftmax_v1(logits, dim=1): """ Computes sigsoftmax from the paper - https://arxiv.org/pdf/1805.10829.pdf """ max_values = torch.max(logits, dim, keepdim=T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
DingYuan0118/DeepEMD
SigSoftmaxV1
false
5,070
[ "MIT" ]
1
a91f77c3da16fecefa62b14aa8b2f195b0e49b84
https://github.com/DingYuan0118/DeepEMD/tree/a91f77c3da16fecefa62b14aa8b2f195b0e49b84
IoULoss
import torch import torch.nn as nn import torch.nn.functional as F class IoULoss(nn.Module): def __init__(self, weight=None, size_average=True): super(IoULoss, self).__init__() def forward(self, inputs, targets, smooth=1): inputs = F.sigmoid(inputs) inputs = inputs.view(-1) t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DoggyLiu0116/MamboNet
IoULoss
false
5,071
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
ContrastiveDistanceLoss
import torch import torch.nn as nn import torch.distributed from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.backends class ContrastiveDistanceLoss(nn.Module): """The Contrastive distance loss. @TODO: Docs. Contri...
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.distributed from torch.nn.modules.loss import * from t...
Ditwoo/catalyst
ContrastiveDistanceLoss
false
5,072
[ "Apache-2.0" ]
1
3126390f9f679ebcfedbe01707b416678a2732ac
https://github.com/Ditwoo/catalyst/tree/3126390f9f679ebcfedbe01707b416678a2732ac
AsymLoss
import torch import numpy as np import torch.nn as nn def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=True): inp = inp.sum(int(ax)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
DoggyLiu0116/MamboNet
AsymLoss
false
5,073
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
LeakyReLU
import torch import numpy as np import torch.nn as nn from numbers import Number def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0))) def _normal_log_pdf(value, mu, stddev): 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, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
DoggyLiu0116/MamboNet
LeakyReLU
false
5,074
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
LayerScale
import torch from torch import nn class LayerScale(nn.Module): """Layer scale from [Touvron et al 2021] (https://arxiv.org/pdf/2103.17239.pdf). This rescales diagonaly residual outputs close to 0 initially, then learnt. """ def __init__(self, channels: 'int', init: 'float'=0): super().__init_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
DilwoarH/demucs
LayerScale
false
5,075
[ "MIT" ]
1
32d21592dfa015468aa117cace52b21e7af79d71
https://github.com/DilwoarH/demucs/tree/32d21592dfa015468aa117cace52b21e7af79d71
ContrastiveEmbeddingLoss
import torch import torch.nn as nn import torch.distributed from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.backends class ContrastiveEmbeddingLoss(nn.Module): """The Contrastive embedding loss. It has been propo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Ditwoo/catalyst
ContrastiveEmbeddingLoss
false
5,076
[ "Apache-2.0" ]
1
3126390f9f679ebcfedbe01707b416678a2732ac
https://github.com/Ditwoo/catalyst/tree/3126390f9f679ebcfedbe01707b416678a2732ac
SigSoftmaxV2
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def logsigsoftmax_v2(logits, dim=1): """ v 1与 v2 差别在于 pytorch 计算softmax时有一个中心化的过程,v1 与 v2 实质上应该等同 """ sigmoid_logits = logits.sigmoid().log() sigsoftmax_logits ...
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 i...
DingYuan0118/DeepEMD
SigSoftmaxV2
false
5,077
[ "MIT" ]
1
a91f77c3da16fecefa62b14aa8b2f195b0e49b84
https://github.com/DingYuan0118/DeepEMD/tree/a91f77c3da16fecefa62b14aa8b2f195b0e49b84
SimpleCNN
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self): pass class SimpleCNN(Model): def __init__(self): super(Model, self).__init__() self.conv1 = torch.nn.Conv2d(in_channels=1, out_channels=64, kernel_size=3, stride=1, padding=1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Cuilie/Collect-feature-maps
SimpleCNN
false
5,078
[ "MIT" ]
1
32e8ac59690837f2a299ab6d4c11b98f5d3d721a
https://github.com/Cuilie/Collect-feature-maps/tree/32e8ac59690837f2a299ab6d4c11b98f5d3d721a
ContrastivePairwiseEmbeddingLoss
import torch import torch.nn as nn import torch.distributed import torch.nn.functional as F from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.backends class ContrastivePairwiseEmbeddingLoss(nn.Module): """ContrastivePai...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ditwoo/catalyst
ContrastivePairwiseEmbeddingLoss
false
5,079
[ "Apache-2.0" ]
1
3126390f9f679ebcfedbe01707b416678a2732ac
https://github.com/Ditwoo/catalyst/tree/3126390f9f679ebcfedbe01707b416678a2732ac
ShallowConvNet
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.nn.functional as F import torch.onnx class ShallowConvNet(nn.Module): def __init__(self, hidden=1000): super(ShallowConvNet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
CorentinChauvin/style-transfer-KD
ShallowConvNet
false
5,080
[ "MIT" ]
1
87bcb2963dbb8d09faf94c74a744f358cafe5427
https://github.com/CorentinChauvin/style-transfer-KD/tree/87bcb2963dbb8d09faf94c74a744f358cafe5427
ReLU
import torch import numpy as np import torch.nn as nn from numbers import Number def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0))) def _normal_log_pdf(value, mu, stddev): 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, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
DoggyLiu0116/MamboNet
ReLU
false
5,081
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
JointHeatmapLoss
import torch import torch.utils.data import torch.nn as nn class JointHeatmapLoss(nn.Module): def __ini__(self): super(JointHeatmapLoss, self).__init__() def forward(self, joint_out, joint_gt, joint_valid): loss = (joint_out - joint_gt) ** 2 * joint_valid[:, :, None, None, 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 import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
DuinoDu/InterHand2.6M.pl
JointHeatmapLoss
false
5,082
[ "MIT" ]
1
2d216960cf95b066a197a9b49795840b1ecfd0c1
https://github.com/DuinoDu/InterHand2.6M.pl/tree/2d216960cf95b066a197a9b49795840b1ecfd0c1
RegressionModel
import torch from torch import nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReLU...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
DerekGloudemans/temporary-repo
RegressionModel
false
5,083
[ "MIT" ]
1
f278e9c7c9c7c1f362a64aec492ddb8fb1f984ad
https://github.com/DerekGloudemans/temporary-repo/tree/f278e9c7c9c7c1f362a64aec492ddb8fb1f984ad
AvgPool2d
import torch import torch.nn as nn import torch.nn.functional as F def keep_variance_fn(x): return x + 0.001 class AvgPool2d(nn.Module): def __init__(self, keep_variance_fn=None, kernel_size=2): super(AvgPool2d, self).__init__() self._keep_variance_fn = keep_variance_fn self.kernel_...
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...
DoggyLiu0116/MamboNet
AvgPool2d
false
5,084
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
SimpleConvNet
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.nn.functional as F import torch.onnx class SimpleConvNet(nn.Module): def __init__(self, hidden=1000): super(SimpleConvNet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 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 import torch.nn as nn import ...
CorentinChauvin/style-transfer-KD
SimpleConvNet
false
5,085
[ "MIT" ]
1
87bcb2963dbb8d09faf94c74a744f358cafe5427
https://github.com/CorentinChauvin/style-transfer-KD/tree/87bcb2963dbb8d09faf94c74a744f358cafe5427
RelRootDepthLoss
import torch import torch.utils.data import torch.nn as nn class RelRootDepthLoss(nn.Module): def __init__(self): super(RelRootDepthLoss, self).__init__() def forward(self, root_depth_out, root_depth_gt, root_valid): loss = torch.abs(root_depth_out - root_depth_gt) * root_valid retur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.data import torch.nn as nn assert_size_stride = torch....
DuinoDu/InterHand2.6M.pl
RelRootDepthLoss
false
5,086
[ "MIT" ]
1
2d216960cf95b066a197a9b49795840b1ecfd0c1
https://github.com/DuinoDu/InterHand2.6M.pl/tree/2d216960cf95b066a197a9b49795840b1ecfd0c1
Linear
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def keep_variance_fn(x): return x + 0.001 class Linear(nn.Module): def __init__(self, in_features, out_features, bias=True, keep_variance_fn=None): super(Linear, 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 import torch.nn as nn from torch.nn.parameter import Parameter assert_size_strid...
DoggyLiu0116/MamboNet
Linear
false
5,087
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
Softmax
import torch import torch.nn as nn def keep_variance_fn(x): return x + 0.001 class Softmax(nn.Module): def __init__(self, dim=1, keep_variance_fn=None): super(Softmax, self).__init__() self.dim = dim self._keep_variance_fn = keep_variance_fn def forward(self, features_mean, fea...
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...
DoggyLiu0116/MamboNet
Softmax
false
5,088
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
Conv2d
import torch import torch.nn.functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pair def keep_variance_fn(x): return x + 0.001 class Conv2d(_ConvNd): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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.modules.conv import _ConvNd from torch.nn.modules.utils import _pa...
DoggyLiu0116/MamboNet
Conv2d
false
5,089
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
NN
import torch import torch.nn as nn class NN(nn.Module): def __init__(self, input_size, num_classes): super(NN, self).__init__() self.fc1 = nn.Linear(in_features=input_size, out_features=50) self.activation1 = nn.ReLU() self.fc2 = nn.Linear(in_features=50, out_features=num_classes)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Dutta-SD/Python_Programs
NN
false
5,090
[ "MIT" ]
1
f002dbd49c979a6d8b156f88003a79f364ff01da
https://github.com/Dutta-SD/Python_Programs/tree/f002dbd49c979a6d8b156f88003a79f364ff01da
BiDAFAttention
import torch import torch.nn.functional as F import torch.nn as nn def masked_softmax(logits, mask, dim=-1, log_softmax=False): """Take the softmax of `logits` over given dimension, and set entries to 0 wherever `mask` is 0. Args: logits (torch.Tensor): Inputs to the softmax function. mas...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Derek318/Adversarial-Squad-CS224N
BiDAFAttention
false
5,091
[ "MIT" ]
1
9b4a5da2a262f4de9b9b05d7b67dc48b2b857e46
https://github.com/Derek318/Adversarial-Squad-CS224N/tree/9b4a5da2a262f4de9b9b05d7b67dc48b2b857e46
MinusRbfHSIC
import torch import torch.nn as nn import torch.utils.data class HSIC(nn.Module): """Base class for the finite sample estimator of Hilbert-Schmidt Independence Criterion (HSIC) ..math:: HSIC (X, Y) := || C_{x, y} ||^2_{HS}, where HSIC (X, Y) = 0 iif X and Y are independent. Empirically, we use the finite...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
EIDOSlab/bridging-debiasing-privacy-deep-learning
MinusRbfHSIC
false
5,092
[ "MIT" ]
1
b30ab798d5ffd7d44a6d7136523400c14a4d08f5
https://github.com/EIDOSlab/bridging-debiasing-privacy-deep-learning/tree/b30ab798d5ffd7d44a6d7136523400c14a4d08f5
HandTypeLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class HandTypeLoss(nn.Module): def __init__(self): super(HandTypeLoss, self).__init__() def forward(self, hand_type_out, hand_type_gt, hand_type_valid): loss = F.binary_cross_entropy(hand_type_out, han...
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...
DuinoDu/InterHand2.6M.pl
HandTypeLoss
false
5,093
[ "MIT" ]
1
2d216960cf95b066a197a9b49795840b1ecfd0c1
https://github.com/DuinoDu/InterHand2.6M.pl/tree/2d216960cf95b066a197a9b49795840b1ecfd0c1
ScaledDotProductAttention
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) def forward(self, q, k, v, mask=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Eddie-Hwang/Co-Eye_Motion_Generation
ScaledDotProductAttention
false
5,094
[ "MIT" ]
1
8e244680115fb63bc26018cb6b53bcfbd04e9683
https://github.com/Eddie-Hwang/Co-Eye_Motion_Generation/tree/8e244680115fb63bc26018cb6b53bcfbd04e9683
StableBCELoss
import torch class StableBCELoss(torch.nn.modules.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() 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 assert_size_stride = t...
EastGit0/JITNet_segmentation
StableBCELoss
false
5,095
[ "MIT" ]
1
7f6598a38b39dafbe6def90385e342b12982143e
https://github.com/EastGit0/JITNet_segmentation/tree/7f6598a38b39dafbe6def90385e342b12982143e
MaxPool2d
import torch import numpy as np import torch.nn as nn from numbers import Number def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0))) def _normal_log_pdf(value, mu, stddev): 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, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
DoggyLiu0116/MamboNet
MaxPool2d
false
5,096
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
ClassWisePool
import torch from torch import nn class ClassWisePool(nn.Module): def __init__(self, num_maps): super(ClassWisePool, self).__init__() self.num_maps = num_maps def forward(self, input): batch_size, num_channels, s = input.size() num_outputs = int(num_channels / self.num_maps) ...
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...
Ecocytus/Roberta-ZeroShot-Label
ClassWisePool
false
5,097
[ "MIT" ]
1
8a6d74187a0e2fd5b1b75549cfb724f54269c5a5
https://github.com/Ecocytus/Roberta-ZeroShot-Label/tree/8a6d74187a0e2fd5b1b75549cfb724f54269c5a5
SimpleArch
import torch import torch.nn as nn class SimpleArch(nn.Module): def __init__(self, input_size, dropout=0.1, hidden_layer_size=10, output_neurons=1): """ A simple architecture wrapper -- build with intuitive Sklearn-like API. """ super(SimpleArch, 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
EMBEDDIA/PropStar
SimpleArch
false
5,098
[ "BSD-3-Clause" ]
1
987be390775130893f2c3440a5f1f94025309e4d
https://github.com/EMBEDDIA/PropStar/tree/987be390775130893f2c3440a5f1f94025309e4d
APPNProp
import torch import torch.nn.functional as F import torch.nn as nn class SparseDropout(nn.Module): def __init__(self, p=0.5): super().__init__() self.p = p def forward(self, x): if not self.training: return x x_coal = x.coalesce() drop_val = F.dropout(x_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 import torch.nn.functional as F import torch.nn as nn assert_size_stride = torch...
EdisonLeeeee/Graphgallery
APPNProp
false
5,099
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
NormedConv2d
import torch from torch import nn import torch.onnx class NormedConv2d(nn.Conv2d): """Normalized Conv2d Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of divisor to ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
ENOT-AutoDL/mmdetection-enot
NormedConv2d
false
5,100
[ "Apache-2.0" ]
1
f541749554436e3327bac00eee89b84f66c03551
https://github.com/ENOT-AutoDL/mmdetection-enot/tree/f541749554436e3327bac00eee89b84f66c03551
ClassificationModel
import torch from torch import nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
DerekGloudemans/temporary-repo
ClassificationModel
false
5,101
[ "MIT" ]
1
f278e9c7c9c7c1f362a64aec492ddb8fb1f984ad
https://github.com/DerekGloudemans/temporary-repo/tree/f278e9c7c9c7c1f362a64aec492ddb8fb1f984ad
Merge
import torch import torch.utils.data import torch.nn as nn import torch.utils.checkpoint class Merge(nn.Module): def forward(self, x1, x2): return torch.cat([x1, x2], dim=1) 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 import torch.utils.data import torch.nn as nn import torch.utils.checkpoint assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
CNNs4QSPR/se3cnn
Merge
false
5,102
[ "MIT" ]
1
513f5f827c4c511bdc96e3c6ea663c8fbce60f57
https://github.com/CNNs4QSPR/se3cnn/tree/513f5f827c4c511bdc96e3c6ea663c8fbce60f57
GaussionConvF
import torch import torch.nn.functional as F import torch.nn as nn class GaussionConvF(nn.Module): """The first layer in `RobustGCN` that conver node features to distribution (mean, var)""" def __init__(self, in_features, out_features, bias=False, gamma=1.0): super().__init__() self.in_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 import triton_helpers from torch._inductor.runtime....
EdisonLeeeee/Graphgallery
GaussionConvF
false
5,103
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
SSGConv
from torch.nn import Module import torch class SSGConv(Module): def __init__(self, K=16, alpha=0.1, **kwargs): super().__init__() assert K > 0 self.K = K self.alpha = alpha def forward(self, x, adj): x_in = x x_out = torch.zeros_like(x) for _ in range(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 assert_size_stride = torch._C._dynamo.guards.assert_...
EdisonLeeeee/Graphgallery
SSGConv
false
5,104
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
GaussionConvD
import torch import torch.nn.functional as F import torch.nn as nn class GaussionConvD(nn.Module): """The subsequent layer in `RobustGCN` that takes node distribution (mean, var) as input""" def __init__(self, in_features, out_features, bias=False, gamma=1.0): super().__init__() self.in_featu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EdisonLeeeee/Graphgallery
GaussionConvD
false
5,105
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedForward(nn.Module): def __init__(self, d_in, d_hid, dropout=0.1): super().__init__() self.w1 = nn.Linear(d_in, d_hid) self.w2 = nn.Linear(d_hid, d_in) self.layer_norm = nn.LayerNorm(d_in, eps=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Eddie-Hwang/Co-Eye_Motion_Generation
PositionwiseFeedForward
false
5,106
[ "MIT" ]
1
8e244680115fb63bc26018cb6b53bcfbd04e9683
https://github.com/Eddie-Hwang/Co-Eye_Motion_Generation/tree/8e244680115fb63bc26018cb6b53bcfbd04e9683
MultiHeadSelfAttention
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadSelfAttention(nn.Module): def __init__(self, d_ipt: 'int', n_head: 'int', dropout_p: 'float'=0.1): super(MultiHeadSelfAttention, self).__init__() self.qkv_linear = nn.Linear(d_ipt, d_ipt * 3, True) self.n_he...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DunZhang/GPT2SourceCode
MultiHeadSelfAttention
false
5,107
[ "MIT" ]
1
d598dbae278c93f88469d45ec025da4cfa7d69ee
https://github.com/DunZhang/GPT2SourceCode/tree/d598dbae278c93f88469d45ec025da4cfa7d69ee
LocalState
import math import torch from torch import nn class LocalState(nn.Module): """Local state allows to have attention based only on data (no positional embedding), but while setting a constraint on the time window (e.g. decaying penalty term). Also a failed experiments with trying to provide some frequency ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DilwoarH/demucs
LocalState
false
5,108
[ "MIT" ]
1
32d21592dfa015468aa117cace52b21e7af79d71
https://github.com/DilwoarH/demucs/tree/32d21592dfa015468aa117cace52b21e7af79d71
SAGEAggregator
import torch import torch.nn as nn class SAGEAggregator(nn.Module): def __init__(self, in_features, out_features, agg_method='mean', concat =False, bias=False): super().__init__() self.in_features = in_features self.out_features = out_features self.concat = concat ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/Graphgallery
SAGEAggregator
false
5,109
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
TransformerNet2
import torch class TransformerNet2(torch.nn.Module): def __init__(self): super(TransformerNet2, self).__init__() self.tanh = torch.nn.Tanh() self.a = 10 def forward(self, r, p): m = -0.5 * self.tanh(self.a * (p - 2 * r)) + 0.5 * self.tanh(self.a * (p - 2 * (1 - 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 libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
Ekko-zn/StegoAdv
TransformerNet2
false
5,110
[ "MIT" ]
1
2852dbc85d66f30efb7127695c0d75806bf4aa4c
https://github.com/Ekko-zn/StegoAdv/tree/2852dbc85d66f30efb7127695c0d75806bf4aa4c
NormedLinear
import torch import torch.nn.functional as F from torch import nn import torch.onnx class NormedLinear(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
ENOT-AutoDL/mmdetection-enot
NormedLinear
false
5,111
[ "Apache-2.0" ]
1
f541749554436e3327bac00eee89b84f66c03551
https://github.com/ENOT-AutoDL/mmdetection-enot/tree/f541749554436e3327bac00eee89b84f66c03551
WaveletConv
import torch import torch.nn as nn class WaveletConv(nn.Module): def __init__(self, in_features, out_features, num_nodes, bias=False): super().__init__() self.in_features = in_features self.out_features = out_features self.w = nn.Linear(in_features, out_features, bias=bias) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/Graphgallery
WaveletConv
false
5,112
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
ASPP
import torch import torch.nn as nn import torch.nn.functional as F class ASPP(nn.Module): def __init__(self, in_channel=256, depth=256): super(ASPP, self).__init__() self.mean = nn.AdaptiveAvgPool2d((1, 1)) self.conv = nn.Conv2d(in_channel, depth, 1, 1) self.atrous_block1 = nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DoggyLiu0116/MamboNet
ASPP
false
5,113
[ "MIT" ]
1
3b708091422491f660c4bd5eb12b06ce3b8a5f79
https://github.com/DoggyLiu0116/MamboNet/tree/3b708091422491f660c4bd5eb12b06ce3b8a5f79
TAGConv
import torch import torch.nn as nn class TAGConv(nn.Module): def __init__(self, in_features, out_features, K=3, bias=True): super().__init__() self.in_features = in_features self.out_features = out_features self.K = K self.w = nn.Linear(in_features * (self.K + 1), out_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EdisonLeeeee/Graphgallery
TAGConv
false
5,114
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
DAGNNConv
import torch import torch.nn as nn class DAGNNConv(nn.Module): def __init__(self, in_features, out_features=1, K=10, bias=False): super().__init__() assert out_features == 1, "'out_features' must be 1" self.in_features = in_features self.out_features = out_features self.li...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/Graphgallery
DAGNNConv
false
5,115
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
Attn
import math import torch import torch.nn as nn import torch.nn.functional as F class Attn(nn.Module): def __init__(self, hidden): super().__init__() self.hidden = hidden self.attn = nn.Linear(self.hidden * 2, hidden) self.v = nn.Parameter(torch.rand(hidden)) stdv = 1.0 / m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Eddie-Hwang/Co-Eye_Motion_Generation
Attn
false
5,116
[ "MIT" ]
1
8e244680115fb63bc26018cb6b53bcfbd04e9683
https://github.com/Eddie-Hwang/Co-Eye_Motion_Generation/tree/8e244680115fb63bc26018cb6b53bcfbd04e9683
SpectralEigenConv
import torch import torch.nn as nn class SpectralEigenConv(nn.Module): def __init__(self, in_features, out_features, bias=False, K=10, alpha= 0.1, **kwargs): super().__init__() assert K > 0 self.K = K self.alpha = alpha self.in_features = in_features self.o...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/Graphgallery
SpectralEigenConv
false
5,117
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
CO2Regularizer
import torch class MemoryBankModule(torch.nn.Module): """Memory bank implementation This is a parent class to all loss functions implemented by the lightly Python package. This way, any loss can be used with a memory bank if desired. Attributes: size: Number of keys the memo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
EelcoHoogendoorn/lightly
CO2Regularizer
false
5,118
[ "MIT" ]
1
98e0148967738404fa7f45196ec5eabfe00cd22e
https://github.com/EelcoHoogendoorn/lightly/tree/98e0148967738404fa7f45196ec5eabfe00cd22e
SmallTransformerNet
import torch import torch.nn.parallel import torch.optim import torch.utils.data import torch.onnx class ConvLayer(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = kernel_size // 2 self.reflection_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
CorentinChauvin/style-transfer-KD
SmallTransformerNet
false
5,119
[ "MIT" ]
1
87bcb2963dbb8d09faf94c74a744f358cafe5427
https://github.com/CorentinChauvin/style-transfer-KD/tree/87bcb2963dbb8d09faf94c74a744f358cafe5427
LabelPropagation
import torch import torch.nn.functional as F import torch.nn as nn class LabelPropagation(nn.Module): """label propagation model adapted from https://github.com/CUAI/CorrectAndSmooth `"Learning from Labeled and Unlabeled Datawith Label Propagation" <http://mlg.eng.cam.ac.uk/zoubin/papers/CMU-CALD-02-1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
EdisonLeeeee/Graphgallery
LabelPropagation
false
5,120
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
Foo
import torch import torch.nn.functional import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed class Foo(torch.nn.Module): def __init__(self, size): super(Foo, self).__init__() self.n = torch.nn.Parameter(torch.ones(size)) self.m = torch.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 import torch.nn.functional import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed assert_si...
Ella77/tacotron2_multispeaker_pytorch
Foo
false
5,121
[ "BSD-3-Clause" ]
1
859eab0a8e3bd7545e623ce47fe1563702d38442
https://github.com/Ella77/tacotron2_multispeaker_pytorch/tree/859eab0a8e3bd7545e623ce47fe1563702d38442
LinearZeros
import torch import torch.nn as nn class LinearZeros(nn.Linear): def __init__(self, in_features, out_features, bias=True, logscale_factor=3.0): """ Linear layer with zero initialization :param in_features: size of each input sample :type in_features: int :param ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
Eladhi/VI_Glow
LinearZeros
false
5,122
[ "MIT" ]
1
9c48fbf8fa10c81fc2354a07fcc2837a77d06cef
https://github.com/Eladhi/VI_Glow/tree/9c48fbf8fa10c81fc2354a07fcc2837a77d06cef
SSGC
import torch import torch.nn as nn class SpectralEigenConv(nn.Module): def __init__(self, in_features, out_features, bias=False, K=10, alpha= 0.1, **kwargs): super().__init__() assert K > 0 self.K = K self.alpha = alpha self.in_features = in_features self.o...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/Graphgallery
SSGC
false
5,123
[ "MIT" ]
1
8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
https://github.com/EdisonLeeeee/Graphgallery/tree/8ae9ef57d44f073d0ceaf3f33a3a998546f960a8
Conv2dZeros
import torch import torch.nn as nn class ActNorm(nn.Module): def __init__(self, num_channels, scale=1.0, logscale_factor=3.0, batch_variance=False): """ Activation normalization layer :param num_channels: number of channels :type num_channels: int :param scale: sc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
Eladhi/VI_Glow
Conv2dZeros
false
5,124
[ "MIT" ]
1
9c48fbf8fa10c81fc2354a07fcc2837a77d06cef
https://github.com/Eladhi/VI_Glow/tree/9c48fbf8fa10c81fc2354a07fcc2837a77d06cef
PositionwiseFeedForward
import torch import torch.nn as nn import torch.distributed class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_model (int): the size of input for the first-layer of the FFN. d_ff (int): the hidden layer size of the seco...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Eldriann/Master-thesis
PositionwiseFeedForward
false
5,125
[ "MIT" ]
1
9d09d97f4002cc9fc730f10317614e1d0d307353
https://github.com/Eldriann/Master-thesis/tree/9d09d97f4002cc9fc730f10317614e1d0d307353
BartClassificationHead
import torch import torch.nn as nn import torch.utils.checkpoint class BartClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, input_dim: 'int', inner_dim: 'int', num_classes: 'int', pooler_dropout: 'float'): super().__init__() self.de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Elvisambition/bert_seq2seq
BartClassificationHead
false
5,126
[ "Apache-2.0" ]
1
643ac537c16872f0d13200de06001d8201a54fbb
https://github.com/Elvisambition/bert_seq2seq/tree/643ac537c16872f0d13200de06001d8201a54fbb
DummyModelWithSharedSubmodule
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing class DummyDenseWithRelu(nn.Module): def __init__(self, input_size, output_size, relu=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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Emily0219/distiller
DummyModelWithSharedSubmodule
false
5,127
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
DummyDenseWithRelu
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing class DummyDenseWithRelu(nn.Module): def __init__(self, input_size, output_size, relu=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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Emily0219/distiller
DummyDenseWithRelu
false
5,128
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
SelfAttention
import torch import torch.nn as nn import torch.distributed class SelfAttention(nn.Module): def __init__(self, model_dim, dropout=0.1): super(SelfAttention, self).__init__() self.Va = nn.Linear(model_dim, 1, bias=False) self.Wa = nn.Linear(model_dim, model_dim) self.dropout = nn.D...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Eldriann/Master-thesis
SelfAttention
false
5,129
[ "MIT" ]
1
9d09d97f4002cc9fc730f10317614e1d0d307353
https://github.com/Eldriann/Master-thesis/tree/9d09d97f4002cc9fc730f10317614e1d0d307353
ContentLoss
import torch from torch import nn class ContentLoss(nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return 0.5 * torch.sum((x - y) ** 2) 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Enigmatisms/NeuralStyle
ContentLoss
false
5,130
[ "Apache-2.0" ]
1
27b435b5c51b41427e9f465793a0b81ad7248ab8
https://github.com/Enigmatisms/NeuralStyle/tree/27b435b5c51b41427e9f465793a0b81ad7248ab8
BahdanauAttention
import torch from torch import nn class BahdanauAttention(nn.Module): def __init__(self, dim): super(BahdanauAttention, self).__init__() self.query_layer = nn.Linear(dim, dim, bias=False) self.tanh = nn.Tanh() self.v = nn.Linear(dim, 1, bias=False) def forward(self, query, pr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Emotional-Text-to-Speech/tacotron_pytorch
BahdanauAttention
false
5,131
[ "MIT" ]
1
e6b1a3907afb01fe31bcbd77c677667adf6733f5
https://github.com/Emotional-Text-to-Speech/tacotron_pytorch/tree/e6b1a3907afb01fe31bcbd77c677667adf6733f5
HILL
import torch import torch.nn as nn class HILL(nn.Module): def __init__(self, img_size): super(HILL, self).__init__() self.img_size = img_size self.pad_3 = nn.ReplicationPad2d(3) self.pad = nn.ReplicationPad2d(7) self.conv1 = nn.Conv2d(1, 1, 3, 1, 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.triton_helpers import math as tl_math import torch....
Ekko-zn/StegoAdv
HILL
false
5,132
[ "MIT" ]
1
2852dbc85d66f30efb7127695c0d75806bf4aa4c
https://github.com/Ekko-zn/StegoAdv/tree/2852dbc85d66f30efb7127695c0d75806bf4aa4c
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed class MultiHeadAttention(nn.Module): """ input: query [N, T_q, query_dim] key [N, T_k, key_dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Ella77/tacotron2_multispeaker_pytorch
MultiHeadAttention
false
5,133
[ "BSD-3-Clause" ]
1
859eab0a8e3bd7545e623ce47fe1563702d38442
https://github.com/Ella77/tacotron2_multispeaker_pytorch/tree/859eab0a8e3bd7545e623ce47fe1563702d38442
Actor
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing class Actor(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Emily0219/distiller
Actor
false
5,134
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
RBFExpansion
import torch import numpy as np import torch.nn as nn class RBFExpansion(nn.Module): """Expand distances between nodes by radial basis functions. .. math:: \\exp(- \\gamma * ||d - \\mu||^2) where :math:`d` is the distance between two nodes and :math:`\\mu` helps centralizes the distances. We...
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 numpy as np import torch.nn as nn assert_size_stride = torch._C._d...
Erfaan-Rostami/dgl-lifesci
RBFExpansion
false
5,135
[ "Apache-2.0" ]
1
08fc317f634fbaee4a8d074c332e871357845e4f
https://github.com/Erfaan-Rostami/dgl-lifesci/tree/08fc317f634fbaee4a8d074c332e871357845e4f
Highway
import torch from torch import nn class Highway(nn.Module): def __init__(self, in_size, out_size): super(Highway, self).__init__() self.H = nn.Linear(in_size, out_size) self.H.bias.data.zero_() self.T = nn.Linear(in_size, out_size) self.T.bias.data.fill_(-1) self.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._inductor.runtime import triton_helpers from torch import nn assert_s...
Emotional-Text-to-Speech/tacotron_pytorch
Highway
false
5,136
[ "MIT" ]
1
e6b1a3907afb01fe31bcbd77c677667adf6733f5
https://github.com/Emotional-Text-to-Speech/tacotron_pytorch/tree/e6b1a3907afb01fe31bcbd77c677667adf6733f5
Norm
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing class Norm(nn.Module): """ A module wrapper for vector/matrix norm """ def __init__(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Emily0219/distiller
Norm
false
5,137
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
ModelWithDuplicates
import torch from collections import OrderedDict import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing class ModelWithDuplicates(nn.Module): def __init__(self): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Emily0219/distiller
ModelWithDuplicates
false
5,138
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
Mean
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing class Mean(nn.Module): def __init__(self, *args, **kwargs): super(Mean, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data...
Emily0219/distiller
Mean
false
5,139
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
upsample
import torch import torch.nn as nn class upsample(nn.Module): def __init__(self): super(upsample, self).__init__() self.upsample = torch.nn.UpsamplingBilinear2d([256, 256]) def forward(self, input): return (self.upsample(input) + 1.0) / 2 def get_inputs(): return [torch.rand([4...
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...
Euiyeon-Kim/SuperFAN-Pytorch
upsample
false
5,140
[ "MIT" ]
1
4a18e559c4b91d0d422b66e63509aeea8a7dc8f2
https://github.com/Euiyeon-Kim/SuperFAN-Pytorch/tree/4a18e559c4b91d0d422b66e63509aeea8a7dc8f2
ClippedLinearQuantization
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.onnx import torch.testing def linear_dequantize(input, scale, zero_point, inplace=False): if inplace: input.add_(zero_p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Emily0219/distiller
ClippedLinearQuantization
false
5,141
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
BahdanauAttention
import math import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler from torch.nn.parameter import Parameter import torch.onnx import torch.testing class EltwiseAdd(nn.Module): def __init__(self,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Emily0219/distiller
BahdanauAttention
false
5,142
[ "Apache-2.0" ]
1
445ed35b671fb54586acc280b53d951f18bf97ae
https://github.com/Emily0219/distiller/tree/445ed35b671fb54586acc280b53d951f18bf97ae
SelfAttention
import torch import torch.nn.functional as F from torch import nn class SelfAttention(nn.Module): def __init__(self, embedding_dimension, num_heads): super().__init__() assert embedding_dimension % num_heads == 0, f'embedding dimension must be divisible by number of heads, got embedding_dimension...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ensembl/gene_pcp
SelfAttention
false
5,143
[ "Apache-2.0" ]
1
121be9895d414da3f13b5c8ec7588754e03336e1
https://github.com/Ensembl/gene_pcp/tree/121be9895d414da3f13b5c8ec7588754e03336e1
AffineChannel2d
import torch import torch.nn as nn class AffineChannel2d(nn.Module): """ A simple channel-wise affine transformation operation """ def __init__(self, num_features): super().__init__() self.num_features = num_features self.weight = nn.Parameter(torch.Tensor(num_features)) self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
FVL2020/2DImage2BMI
AffineChannel2d
false
5,144
[ "MIT" ]
1
90783bcb6fce0b91fb5ab70f62f595e3cfff39d0
https://github.com/FVL2020/2DImage2BMI/tree/90783bcb6fce0b91fb5ab70f62f595e3cfff39d0
FactorizationMachine
import torch import torch.utils.data class FactorizationMachine(torch.nn.Module): def __init__(self, reduce_sum=True): super().__init__() self.reduce_sum = reduce_sum def forward(self, x): """ :param x: Float tensor of size ``(batch_size, num_fields, embed_dim)`` """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
Fanxingye/Autotabular
FactorizationMachine
false
5,145
[ "Apache-2.0" ]
1
d630c78290a52f8c73885afb16884e18135c34f6
https://github.com/Fanxingye/Autotabular/tree/d630c78290a52f8c73885afb16884e18135c34f6
AGELU
import math import torch import torch.utils.data import torch.cuda import torch.utils.checkpoint def agelu(x): SQRT_M2_PI = math.sqrt(2 / math.pi) COEFF = 0.044715 return 0.5 * x * (1.0 + torch.tanh(SQRT_M2_PI * (x + COEFF * torch.pow( x, 3)))) class AGELU(torch.nn.Module): def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import torch.utils.data import torch.cuda import torch.utils.checkp...
Dan-hbd/NMTGMinor
AGELU
false
5,146
[ "MIT" ]
1
84e59ac8391ee78852d7c71afc60c3c8b8e3d44d
https://github.com/Dan-hbd/NMTGMinor/tree/84e59ac8391ee78852d7c71afc60c3c8b8e3d44d
FocalLoss
import torch import torch.nn as nn def log_minus_sigmoid(x): return torch.clamp(-x, max=0) - torch.log(1 + torch.exp(-torch.abs(x)) ) + 0.5 * torch.clamp(x, min=0, max=0) def log_sigmoid(x): return torch.clamp(x, max=0) - torch.log(1 + torch.exp(-torch.abs(x)) ) + 0.5 * torch.clamp(x, min=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 ...
FadedFate/TrackerSiamRPN
FocalLoss
false
5,147
[ "MIT" ]
1
f4156fa4bed9a0ca6c7ac9b653c07e564d8a058d
https://github.com/FadedFate/TrackerSiamRPN/tree/f4156fa4bed9a0ca6c7ac9b653c07e564d8a058d
ReLUDropout
import torch import torch.utils.data import torch.cuda import torch.utils.checkpoint def relu_dropout(x, p=0, training=False, variational=False, batch_first=False): if not training or p == 0: return x.clamp_(min=0) p1m = 1 - p if variational: if batch_first: mask = torch.rand_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 import triton_helpers import torch.utils.data import torch.cuda import torch.utils.checkpoint assert_size_strid...
Dan-hbd/NMTGMinor
ReLUDropout
false
5,148
[ "MIT" ]
1
84e59ac8391ee78852d7c71afc60c3c8b8e3d44d
https://github.com/Dan-hbd/NMTGMinor/tree/84e59ac8391ee78852d7c71afc60c3c8b8e3d44d