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 |
|---|---|---|---|---|---|---|---|---|---|---|
ShakeResNeXt | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.size(0)).uniform_()
al... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.nn a... | DensoITLab/TeachAugment | ShakeResNeXt | false | 7,984 | [
"BSD-2-Clause"
] | 20 | 66ec099a0afab99e18531c5437182cfe17dc30c8 | https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8 |
FiLM | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class FiLM(nn.Module):
"""
A Feature-wise Linear Modulation Layer from
'FiLM: Visual Reasoning with a General Conditioning Layer'
"""
def forward(self, x, gammas, betas):
ret... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.... | Dou-Yiming/YouRefIt_ERU | FiLM | false | 7,985 | [
"MIT"
] | 13 | 2a8e849380ed2d253c467b1af744a514bc171372 | https://github.com/Dou-Yiming/YouRefIt_ERU/tree/2a8e849380ed2d253c467b1af744a514bc171372 |
TransformerLayer | import torch
import torch.nn as nn
import torch.onnx
class TransformerLayer(nn.Module):
def __init__(self, channels, num_heads):
super().__init__()
self.q = nn.Linear(channels, channels, bias=False)
self.k = nn.Linear(channels, channels, bias=False)
self.v = nn.Linear(channels, ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DDGRCF/YOLOX_OBB | TransformerLayer | false | 7,986 | [
"Apache-2.0"
] | 39 | 27b80953306492b8bc83b86b1353d8cee01ef9b6 | https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6 |
QuadriLinearScore | import math
import torch
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
class QuadriLinearScore(nn.Module):
"""
Outer product version of quadrilinear function for sequence labeling.
"""
def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std=
0.1545, w... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.utils.data.dataloader
import torch.nn as nn
import torc... | Dadmatech/DadmaTools | QuadriLinearScore | false | 7,987 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
GlobalAvgPool2dResNext | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class GlobalAvgPool2dResNext(nn.Module):
def __init__(self):
"""Global average pooling over the input's spatial dimensions"""
super(Globa... | 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 torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distr... | Alibaba-MIIL/ZS_SDL | GlobalAvgPool2dResNext | false | 7,988 | [
"MIT"
] | 20 | 769fe4f57d2d458a7c4b5468a6395c9b296b1dad | https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad |
MyUpsample2 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class MyUpsample2(nn.Module):
def forward(self, x):
return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x
.size(0), x.size(1), x.size(2) * 2, x.size(3) * 2)
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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.... | Dou-Yiming/YouRefIt_ERU | MyUpsample2 | false | 7,989 | [
"MIT"
] | 13 | 2a8e849380ed2d253c467b1af744a514bc171372 | https://github.com/Dou-Yiming/YouRefIt_ERU/tree/2a8e849380ed2d253c467b1af744a514bc171372 |
MLP | import torch
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
class SharedDropout(nn.Module):
def __init__(self, p=0.5, batch_first=True):
super(SharedDropout, self).__init__()
self.p = p
self.batch_first = batch_first
def extra_repr(self):
s = f'p={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
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
assert_... | Dadmatech/DadmaTools | MLP | false | 7,990 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
BiaffineAttention | import torch
import torch.utils.data.dataloader
from torch.nn import Parameter
import torch.nn as nn
import torch.nn
from torch.nn.parameter import Parameter
class BiaffineAttention(nn.Module):
"""
Adopted from NeuroNLP2:
https://github.com/XuezheMax/NeuroNLP2/blob/master/neuronlp2/nn/modules/attentio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Dadmatech/DadmaTools | BiaffineAttention | false | 7,991 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
ShakeResNet | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.size(0)).uniform_()
al... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.nn a... | DensoITLab/TeachAugment | ShakeResNet | false | 7,992 | [
"BSD-2-Clause"
] | 20 | 66ec099a0afab99e18531c5437182cfe17dc30c8 | https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8 |
PT | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Module):
def __init__(self, in_features, out_features, dropout, bias=False):
super(Linear, self).__init__()
self.dropout = dropout
self.in_features = in_features
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import numpy as n... | DongHande/PT_propagation_then_training | PT | false | 7,993 | [
"MIT"
] | 21 | 3f346ff161d2a0b807e3c0269ad26a7266305cc3 | https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3 |
PoolReducer | import torch
from torch import nn
class PoolReducer(nn.Module):
def __init__(self, groups, pool_operation='max'):
super(PoolReducer, self).__init__()
if pool_operation == 'max':
self.pool = lambda x: x.max(2)[0]
elif pool_operation == 'average':
self.pool = lambda ... | 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... | Dreem-Organization/RobustSleepNet | PoolReducer | false | 7,994 | [
"MIT"
] | 16 | c8ff3f6f857299eb2bf2e9400483084d5ecd4106 | https://github.com/Dreem-Organization/RobustSleepNet/tree/c8ff3f6f857299eb2bf2e9400483084d5ecd4106 |
HyperSphereLoss | import torch
import torch.nn as nn
class HyperSphereLoss(nn.Module):
def forward(self, input):
"""
Calcuate distance between input and N(North Pole) using hypersphere metrics.
Woo Park, Sung, and Junseok Kwon.
"Sphere Generative Adversarial Network Based on Geometric Moment Match... | 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_... | Dotori-HJ/SphereGAN-Pytorch-implementation | HyperSphereLoss | false | 7,995 | [
"MIT"
] | 11 | fe7843545388ecdae34f374e7f1c42300ab12689 | https://github.com/Dotori-HJ/SphereGAN-Pytorch-implementation/tree/fe7843545388ecdae34f374e7f1c42300ab12689 |
GCN | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Module):
def __init__(self, in_features, out_features, dropout, bias=False):
super(Linear, self).__init__()
self.dropout = dropout
self.in_features = in_features
self.out_features = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DongHande/PT_propagation_then_training | GCN | false | 7,996 | [
"MIT"
] | 21 | 3f346ff161d2a0b807e3c0269ad26a7266305cc3 | https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3 |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class TransformerEncoderLayer(nn.Module):
def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0,
attention_dropout=0.0, activation_dropout=0.0):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Daetheys/Lazimpa | TransformerEncoderLayer | false | 7,997 | [
"MIT"
] | 15 | 21f4f4ebcdfa8b6a775b64673dd3001763c91cf1 | https://github.com/Daetheys/Lazimpa/tree/21f4f4ebcdfa8b6a775b64673dd3001763c91cf1 |
SelfAttn | import torch
from torch import nn
from torch.nn import functional as F
class SelfAttn(nn.Module):
def __init__(self, denc, dropout=0, enc_trans=None, dec_trans=None):
super().__init__()
self.scorer = nn.Linear(denc, 1)
self.dropout = nn.Dropout(dropout)
self.enc_trans = enc_trans ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DreamerDeo/gazp | SelfAttn | false | 7,998 | [
"MIT"
] | 18 | 5f823a447ffdf5176023a01516d2be7c383294d9 | https://github.com/DreamerDeo/gazp/tree/5f823a447ffdf5176023a01516d2be7c383294d9 |
SpatialAttentionGate | import torch
from torch import nn
from torch.nn import functional as F
class SpatialAttentionGate(nn.Module):
def __init__(self, channel, reduction=16):
super(SpatialAttentionGate, self).__init__()
self.fc1 = nn.Conv2d(channel, reduction, kernel_size=1, padding=0)
self.fc2 = nn.Conv2d(red... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Diyago/Automatic-salt-deposits-segmentation | SpatialAttentionGate | false | 7,999 | [
"MIT"
] | 20 | fedfc7f1d9878674382eeb16a820b5f16791f4ab | https://github.com/Diyago/Automatic-salt-deposits-segmentation/tree/fedfc7f1d9878674382eeb16a820b5f16791f4ab |
Whitening2d | import torch
from torch import nn
from torch.cuda.amp import custom_fwd
from torch.nn.functional import conv2d
class Whitening2d(nn.Module):
def __init__(self, output_dim: 'int', eps: 'float'=0.0):
"""Layer that computes hard whitening for W-MSE using the Cholesky decomposition.
Args:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | DonkeyShot21/cassle | Whitening2d | false | 8,000 | [
"MIT"
] | 13 | d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8 | https://github.com/DonkeyShot21/cassle/tree/d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8 |
GBlock | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
def l2_norm(v, eps=1e-10):
"""
L2 normalization
:param v:
:param eps:
:return:
"""
return v / (v.norm() + eps)
def pixel_norm(x, eps=1e-10):
"""
Pixel normalization
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Dong-Jie-Chen/GS-WGAN | GBlock | false | 8,001 | [
"MIT"
] | 32 | 5f33f21249431e53f44167da3ae7587e0dc695d9 | https://github.com/Dong-Jie-Chen/GS-WGAN/tree/5f33f21249431e53f44167da3ae7587e0dc695d9 |
HardSigmoid | import torch
from torch import nn
class HardSigmoid(nn.Module):
def __init__(self, slope=0.1666667, offset=0.5):
super().__init__()
self.slope = slope
self.offset = offset
def forward(self, input):
return torch.where(input >= 3, torch.tensor(1.0, dtype=torch.float)
... | 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... | DocYard-ai/UCR | HardSigmoid | false | 8,002 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
PixelNorm | import torch
from torch import nn
class PixelNorm(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim=
True) + 1e-08)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Dolorousrtur/style-people | PixelNorm | false | 8,003 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
MAECriterion | import torch
class MAECriterion(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, target):
return torch.mean(torch.abs(pred - target))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | Dolorousrtur/style-people | MAECriterion | false | 8,004 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
StackingNNet | import torch
import numpy as np
import torch.nn as nn
from torch.nn import CrossEntropyLoss
import torch.utils.data.distributed
import torch.utils.data
def gelu(x):
return 0.5 * x * (1 + torch.tanh(np.sqrt(2.0 / np.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class StackingNNet(nn.Module):
def __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.triton_helpers import libdevice
import numpy as np
... | ECNU-ICA/ECNU-SenseMaker | StackingNNet | false | 8,005 | [
"MIT"
] | 16 | 24f829c3dfefccea5fecbbe75904858ec1fefffb | https://github.com/ECNU-ICA/ECNU-SenseMaker/tree/24f829c3dfefccea5fecbbe75904858ec1fefffb |
CosineSimilarityLoss | import torch
from torch import nn
class CosineSimilarityLoss(nn.Module):
def __init__(self):
super(CosineSimilarityLoss, self).__init__()
def forward(self, x1, x2):
return 0.5 - 0.5 * torch.cosine_similarity(x1, x2)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([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_... | DunZhang/KnowledgeDistillation | CosineSimilarityLoss | false | 8,006 | [
"MIT"
] | 31 | 47a9dd0f51021001b53e3a76c9347eb3131f1f72 | https://github.com/DunZhang/KnowledgeDistillation/tree/47a9dd0f51021001b53e3a76c9347eb3131f1f72 |
SEModule | import torch
from torch import nn
class SEModule(nn.Module):
def __init__(self, in_channels, reduction=4):
super(SEModule, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=
in_channels // reduction, kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | DocYard-ai/UCR | SEModule | false | 8,007 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def make_kernel(k):
k = torch.tensor(k, dtype=torch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd... | Dolorousrtur/style-people | ModulatedConv2d | false | 8,008 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
HexaLinearScore | import math
import torch
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
class HexaLinearScore(nn.Module):
"""
Outer product version of hexalinear function for sequence labeling.
"""
def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std=
0.1545, norma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.utils.data.dataloader
import torch.nn as nn
import torc... | Dadmatech/DadmaTools | HexaLinearScore | false | 8,009 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
FFN | import torch
from torch import nn
import torch.nn.functional as F
class FFN(nn.Module):
"""
Feed-Forward Network
"""
def __init__(self, d_inner_hid, d_model, dropout_rate):
super(FFN, self).__init__()
self.dropout_rate = dropout_rate
self.fc1 = nn.Linear(in_features=d_model, 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
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | DocYard-ai/UCR | FFN | false | 8,010 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
AdaptiveConcatPool2d | import torch
from torch import nn
import torch.optim
class AdaptiveConcatPool2d(nn.Module):
def __init__(self, sz=1):
super().__init__()
self.output_size = sz or 1
self.ap = nn.AdaptiveAvgPool2d(self.output_size)
self.mp = nn.AdaptiveMaxPool2d(self.output_size)
def forward(se... | 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.optim
assert_size_stride = torch._C._dynamo.guards.asse... | DrHB/PANDA-2nd-place-solution | AdaptiveConcatPool2d | false | 8,011 | [
"MIT"
] | 17 | 44ab72780f9e3594811f2a7520456de7a9e677db | https://github.com/DrHB/PANDA-2nd-place-solution/tree/44ab72780f9e3594811f2a7520456de7a9e677db |
StyledSiren | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
class FusedLeakyReLUFunctionBackward(Function):
@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, math as tl_math
fr... | Dolorousrtur/style-people | StyledSiren | false | 8,012 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
DotAttn | import torch
from torch import nn
from torch.nn import functional as F
class DotAttn(nn.Module):
def __init__(self, dropout=0, enc_trans=None, dec_trans=None):
super().__init__()
self.dropout = nn.Dropout(dropout)
self.dec_trans = dec_trans or nn.Identity()
self.enc_trans = enc_tr... | 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... | DreamerDeo/gazp | DotAttn | false | 8,013 | [
"MIT"
] | 18 | 5f823a447ffdf5176023a01516d2be7c383294d9 | https://github.com/DreamerDeo/gazp/tree/5f823a447ffdf5176023a01516d2be7c383294d9 |
GeM | import torch
import torch.nn.functional as F
from torch import nn
from torch.nn.parameter import Parameter
import torch.optim
def gem(x, p=3, eps=1e-06):
return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow(
1.0 / p)
class GeM(nn.Module):
def __init__(self, p=3, eps=1e-06):
... | 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.functional a... | DrHB/PANDA-2nd-place-solution | GeM | false | 8,014 | [
"MIT"
] | 17 | 44ab72780f9e3594811f2a7520456de7a9e677db | https://github.com/DrHB/PANDA-2nd-place-solution/tree/44ab72780f9e3594811f2a7520456de7a9e677db |
ScaledLeakyReLU | import math
import torch
from torch import nn
import torch.nn.functional as F
class ScaledLeakyReLU(nn.Module):
def __init__(self, negative_slope=0.2):
super().__init__()
self.negative_slope = negative_slope
def forward(self, input):
out = F.leaky_relu(input, negative_slope=self.nega... | 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... | Dolorousrtur/style-people | ScaledLeakyReLU | false | 8,015 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
SinkhornKnopp | import torch
import torch.distributed as dist
class SinkhornKnopp(torch.nn.Module):
def __init__(self, num_iters: 'int'=3, epsilon: 'float'=0.05,
world_size: 'int'=1):
"""Approximates optimal transport using the Sinkhorn-Knopp algorithm.
A simple iterative method to approach the double 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 math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | DonkeyShot21/cassle | SinkhornKnopp | false | 8,016 | [
"MIT"
] | 13 | d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8 | https://github.com/DonkeyShot21/cassle/tree/d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8 |
HighwayLayer | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.utils.checkpoint
def my_xavier_init(m, gain=1):
"""Xavier initialization: weights initialization that tries to make variance of outputs
of a layer equal to variance of its inputs.
"""
for p in 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.triton_helpers import libdevice
from torch import n... | CowherdChris/droidlet | HighwayLayer | false | 8,017 | [
"MIT"
] | 26 | 8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1 | https://github.com/CowherdChris/droidlet/tree/8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1 |
PostGCN | import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class GraphConvolution(nn.Module):
"""
adapted from : https://github.com/tkipf/gcn/blob/92600c39797c2bfb61a508e52b88fb554df30177/gcn/layers.py#L132
"""
def __init__(self, in_features, out_features, bias=True, node... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
from torch.nn.parameter import Parameter
asser... | Droliven/MSRGCN | PostGCN | false | 8,018 | [
"MIT"
] | 28 | 5d8d8e3365d3b23ca2ac734ace7e84135a6e3a9e | https://github.com/Droliven/MSRGCN/tree/5d8d8e3365d3b23ca2ac734ace7e84135a6e3a9e |
DiscountBlackLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.random
import torch.nn.functional as F
class DiscountBlackLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, source, target):
"""
Ignores pixels with all channels set to zero
Proba... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.random
assert_size_stride = to... | DuaneNielsen/keypoints | DiscountBlackLoss | false | 8,019 | [
"MIT"
] | 42 | 302fa02966d4372ac9b5aaa3d8dc24684be0b252 | https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252 |
EqualConv2dSame | import math
import torch
from torch import nn
import torch.nn.functional as F
class EqualConv2dSame(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_channel, in_channel,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | Dolorousrtur/style-people | EqualConv2dSame | false | 8,020 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
EqualLinear | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
class FusedLeakyReLUFunctionBackward(Function):
@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.autograd import Function
import math
from torch import nn
assert_size... | Dolorousrtur/style-people | EqualLinear | false | 8,021 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
ModulatedSiren2d | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
class FusedLeakyReLUFunctionBackward(Function):
@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
from torch.autograd... | Dolorousrtur/style-people | ModulatedSiren2d | false | 8,022 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
MLP | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Module):
def __init__(self, in_features, out_features, dropout, bias=False):
super(Linear, self).__init__()
self.dropout = dropout
self.in_features = in_features
self.out_features = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DongHande/PT_propagation_then_training | MLP | false | 8,023 | [
"MIT"
] | 21 | 3f346ff161d2a0b807e3c0269ad26a7266305cc3 | https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3 |
SEModule | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class FastAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastAvgPool2d, self).__init__()
self.flatten = flatten
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 torchvision import datas... | Alibaba-MIIL/ZS_SDL | SEModule | false | 8,024 | [
"MIT"
] | 20 | 769fe4f57d2d458a7c4b5468a6395c9b296b1dad | https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad |
Encoder | import torch
from torch import nn
import torch.nn.functional as F
from functools import partial
class FFN(nn.Module):
"""
Feed-Forward Network
"""
def __init__(self, d_inner_hid, d_model, dropout_rate):
super(FFN, self).__init__()
self.dropout_rate = dropout_rate
self.fc1 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DocYard-ai/UCR | Encoder | false | 8,025 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
EncoderLayer | import torch
from torch import nn
import torch.nn.functional as F
from functools import partial
class FFN(nn.Module):
"""
Feed-Forward Network
"""
def __init__(self, d_inner_hid, d_model, dropout_rate):
super(FFN, self).__init__()
self.dropout_rate = dropout_rate
self.fc1 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DocYard-ai/UCR | EncoderLayer | false | 8,026 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
SpatialLogSoftmax | import torch
import torch.utils.data
import torch.random
import torch.nn.functional as F
def logprob_to_keypoints(prob, length):
ruler = torch.log(torch.linspace(0, 1, length, device=prob.device)
).type_as(prob).expand(1, 1, -1)
return torch.sum(torch.exp(prob + ruler), dim=2, keepdim=True).squeeze(2)... | 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.utils.dat... | DuaneNielsen/keypoints | SpatialLogSoftmax | false | 8,027 | [
"MIT"
] | 42 | 302fa02966d4372ac9b5aaa3d8dc24684be0b252 | https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252 |
EqualConv2d | import math
import torch
from torch import nn
import torch.nn.functional as F
class EqualConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True, replicate_pad=False):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_channel,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | Dolorousrtur/style-people | EqualConv2d | false | 8,028 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
AdaptiveAvgMaxPool2d | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
def adaptive_avgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_poo... | 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 torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.functi... | Alibaba-MIIL/ZS_SDL | AdaptiveAvgMaxPool2d | false | 8,029 | [
"MIT"
] | 20 | 769fe4f57d2d458a7c4b5468a6395c9b296b1dad | https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad |
ClsHead | import torch
from torch import nn
import torch.nn.functional as F
class ClsHead(nn.Module):
"""
Class orientation
Args:
params(dict): super parameters for build Class network
"""
def __init__(self, in_channels, class_dim, **kwargs):
super(ClsHead, self).__init__()
self.p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DocYard-ai/UCR | ClsHead | false | 8,030 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
AdaIn | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
class FusedLeakyReLUFunctionBackward(Function):
@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
from torch.autograd... | Dolorousrtur/style-people | AdaIn | false | 8,031 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
SpatialSoftmax | import torch
import torch.utils.data
import torch.random
import torch.nn.functional as F
def marginal_softmax(heatmap, dim):
marginal = torch.mean(heatmap, dim=dim)
sm = F.softmax(marginal, dim=2)
return sm
def prob_to_keypoints(prob, length):
ruler = torch.linspace(0, 1, length).type_as(prob).expan... | 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.utils.dat... | DuaneNielsen/keypoints | SpatialSoftmax | false | 8,032 | [
"MIT"
] | 42 | 302fa02966d4372ac9b5aaa3d8dc24684be0b252 | https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252 |
GRUCell | import torch
import torch.nn as nn
import torch.utils.checkpoint
class GRUCell(nn.Module):
def __init__(self, x_dim, h_dim):
super(GRUCell, self).__init__()
self.r = nn.Linear(x_dim + h_dim, h_dim, True)
self.z = nn.Linear(x_dim + h_dim, h_dim, True)
self.c = nn.Linear(x_dim, h_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | DeepLearnXMU/IRSEG | GRUCell | false | 8,033 | [
"Apache-2.0"
] | 14 | 6027c9601dbcb626d4adaf429c4bed07febb1034 | https://github.com/DeepLearnXMU/IRSEG/tree/6027c9601dbcb626d4adaf429c4bed07febb1034 |
GroupNorm | import torch
import torch.nn as nn
class GroupNorm(nn.Module):
def __init__(self, c_num, group_num=16, eps=1e-10):
"""
The groupnorm layer from https://arxiv.org/abs/1803.08494
Args:
c_num (int): Number of input channels
group_num (int): Number of group by which 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | EKami/EzeeML | GroupNorm | false | 8,034 | [
"MIT"
] | 35 | 21753a0ede7cc1dc675a2dcd09b6306cea2cad56 | https://github.com/EKami/EzeeML/tree/21753a0ede7cc1dc675a2dcd09b6306cea2cad56 |
CTCHead | import torch
from torch import nn
class CTCHead(nn.Module):
def __init__(self, in_channels, out_channels, fc_decay=0.0004, **kwargs):
super(CTCHead, self).__init__()
self.fc = nn.Linear(in_channels, out_channels)
self.softmax = nn.Softmax(dim=2)
self.out_channels = out_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DocYard-ai/UCR | CTCHead | false | 8,035 | [
"Apache-2.0"
] | 10 | 7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 | https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68 |
FlowfieldDiscountedLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.random
import torch.nn.functional as F
class FlowfieldDiscountedLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, source, target, flowfield):
loss = F.mse_loss(source, target, reduction='none')
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.random
assert_size_stride = to... | DuaneNielsen/keypoints | FlowfieldDiscountedLoss | false | 8,036 | [
"MIT"
] | 42 | 302fa02966d4372ac9b5aaa3d8dc24684be0b252 | https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252 |
Coords | import torch
import torch.nn as nn
import torch.utils.data
import torch.random
class Coords(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
""" adds 2 channels that carry co-ordinate information """
b, h, w = x.size(0), x.size(2), x.size(3)
hm = torch... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.random
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_stri... | DuaneNielsen/keypoints | Coords | false | 8,037 | [
"MIT"
] | 42 | 302fa02966d4372ac9b5aaa3d8dc24684be0b252 | https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252 |
ContrastiveLoss | import torch
import torch.nn as nn
from torch.nn import functional as F
class ContrastiveLoss(nn.Module):
"""
Contrastive loss
Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise
"""
def __init__(self, margin):
super(Contrast... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | EmmaW8/EISNet | ContrastiveLoss | false | 8,038 | [
"MIT"
] | 40 | 97c420d6763c5f825e88ed732edee4e75f3b947e | https://github.com/EmmaW8/EISNet/tree/97c420d6763c5f825e88ed732edee4e75f3b947e |
GlobalAveragePool | import torch
from torch import nn
class GlobalAveragePool(nn.Module):
"""
Average pooling in an equivariant network
"""
def __init__(self):
"""
"""
super().__init__()
def forward(self, x):
"""
"""
avg = torch.mean(x, dim=[-2, -1], keepdim=True)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | ElisevanderPol/symmetrizer | GlobalAveragePool | false | 8,039 | [
"MIT"
] | 16 | 8dae02bee2ba7132ae4fb07e07020767d280842c | https://github.com/ElisevanderPol/symmetrizer/tree/8dae02bee2ba7132ae4fb07e07020767d280842c |
TripletLoss | import torch
import torch.nn as nn
from torch.nn import functional as F
class TripletLoss(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample and a negative sample
"""
def __init__(self, margin):
super(TripletLoss, self).__init__()
self.margin = ma... | 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... | EmmaW8/EISNet | TripletLoss | false | 8,040 | [
"MIT"
] | 40 | 97c420d6763c5f825e88ed732edee4e75f3b947e | https://github.com/EmmaW8/EISNet/tree/97c420d6763c5f825e88ed732edee4e75f3b947e |
AdaptiveCatAvgMaxPool2d | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
def adaptive_catavgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_... | 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 torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.functi... | Alibaba-MIIL/ZS_SDL | AdaptiveCatAvgMaxPool2d | false | 8,041 | [
"MIT"
] | 20 | 769fe4f57d2d458a7c4b5468a6395c9b296b1dad | https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, gamma=2):
super().__init__()
self.gamma = gamma
def forward(self, logit, target):
target = target.float()
max_val = (-logit).clamp(min=0)
loss = logit - 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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | EMUNES/Auto-Subtitle-File-Generation | FocalLoss | false | 8,042 | [
"Apache-2.0"
] | 33 | 535a6351f450b1970da50bbbf4cc6d2f442ec335 | https://github.com/EMUNES/Auto-Subtitle-File-Generation/tree/535a6351f450b1970da50bbbf4cc6d2f442ec335 |
Conv2d | import torch
import torch.nn as nn
class Conv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, NL
='relu', same_padding=False, bn=False, dilation=1):
super(Conv2d, self).__init__()
padding = int((kernel_size - 1) / 2) if same_padding else 0
self.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.nn as nn
assert_... | Elin24/DCL-CrowdCounting | Conv2d | false | 8,043 | [
"MIT"
] | 12 | 2f8e68a2d29a8599e795b502f21b4de778e6214c | https://github.com/Elin24/DCL-CrowdCounting/tree/2f8e68a2d29a8599e795b502f21b4de778e6214c |
NoiseInjection | import torch
from torch import nn
class NoiseInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = image.new... | 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... | Dolorousrtur/style-people | NoiseInjection | false | 8,044 | [
"MIT"
] | 15 | c48b12b245cc50f8230c0654dffe40016f2a69f1 | https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
pass
def forward(self, input, target):
input = input.contiguous().view(input.size()[0], -1)
target = target.contiguous().view(target.size()[0], -1).float()
... | 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... | EryiXie/PlaneRecNet | DiceLoss | false | 8,045 | [
"MIT"
] | 34 | 534e23e6c5db2235ab1e5a9419fb4bfec3ffa943 | https://github.com/EryiXie/PlaneRecNet/tree/534e23e6c5db2235ab1e5a9419fb4bfec3ffa943 |
APPNP | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Module):
def __init__(self, in_features, out_features, dropout, bias=False):
super(Linear, self).__init__()
self.dropout = dropout
self.in_features = in_features
self.out_features = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DongHande/PT_propagation_then_training | APPNP | false | 8,046 | [
"MIT"
] | 21 | 3f346ff161d2a0b807e3c0269ad26a7266305cc3 | https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3 |
GatedConv1d | import torch
import torch.nn as nn
import torch.nn
class GatedConv1d(nn.Module):
def __init__(self, input_channels, output_channels, kernel_size, stride,
padding=0, dilation=1, activation=None):
super(GatedConv1d, self).__init__()
self.activation = activation
self.sigmoid = nn.Sig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn
assert_size_stride = torch._C._dynamo.guar... | EmilSkaaning/DeepStruc | GatedConv1d | false | 8,047 | [
"Apache-2.0"
] | 11 | 4de0233caba11523b8f5deead53e1c70c05b346b | https://github.com/EmilSkaaning/DeepStruc/tree/4de0233caba11523b8f5deead53e1c70c05b346b |
Hsigmoid | import torch
import torch.nn as nn
import torch.quantization
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.float_op = nn.quantized.FloatFunctional()
self.relu6 = nn.ReLU6(inplace=inplace)
def forward(self, x):
relu6 = 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
import torch.nn as nn
import torch.quantization
assert_size_stride = torch._C._dynamo.gua... | Edgecortix-Inc/pytorch_quantization | Hsigmoid | false | 8,048 | [
"Apache-2.0"
] | 13 | ad7120439f473d539adec22930a8363bfb63e830 | https://github.com/Edgecortix-Inc/pytorch_quantization/tree/ad7120439f473d539adec22930a8363bfb63e830 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
def focal_loss(input_values, gamma):
"""Computes the focal loss"""
p = torch.exp(-input_values)
loss = (1 - p) ** gamma * input_values
return loss.mean()
class Focal... | 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
... | EricZsy/BalancedKnowledgeDistillation | FocalLoss | false | 8,049 | [
"MIT"
] | 22 | 88a2de840a3fc6eb2ee881c729f293b8e78714aa | https://github.com/EricZsy/BalancedKnowledgeDistillation/tree/88a2de840a3fc6eb2ee881c729f293b8e78714aa |
CharbonnierLoss | import torch
import torch.nn as nn
class CharbonnierLoss(nn.Module):
def __init__(self):
"""
L1 Charbonnierloss.
"""
super(CharbonnierLoss, self).__init__()
def forward(self, x, y, eps=1e-06):
diff = y - x
error = torch.sqrt(diff * diff + eps)
loss = 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 libdevice
import torch.nn as nn
assert... | EKami/EzeeML | CharbonnierLoss | false | 8,050 | [
"MIT"
] | 35 | 21753a0ede7cc1dc675a2dcd09b6306cea2cad56 | https://github.com/EKami/EzeeML/tree/21753a0ede7cc1dc675a2dcd09b6306cea2cad56 |
Hflip | import torch
from torch import nn
def hflip(input: 'torch.Tensor') ->torch.Tensor:
"""Horizontally flip a tensor image or a batch of tensor images. Input must
be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
Args:
input (torch.Tensor): input tensor
Returns:
... | 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... | ElementAI/bilevel_augment | Hflip | false | 8,051 | [
"Apache-2.0"
] | 22 | b43997d41d8452d362450e267503c8be18f1be4a | https://github.com/ElementAI/bilevel_augment/tree/b43997d41d8452d362450e267503c8be18f1be4a |
ResidualBlock | import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
self.in1 = nn.InstanceNorm2d(channels)
self.prelu = nn.PReLU()
self.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.triton_helpers import libdevice
import torch.nn as ... | EKami/EzeeML | ResidualBlock | false | 8,052 | [
"MIT"
] | 35 | 21753a0ede7cc1dc675a2dcd09b6306cea2cad56 | https://github.com/EKami/EzeeML/tree/21753a0ede7cc1dc675a2dcd09b6306cea2cad56 |
DotProduct | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class DotProduct(nn.Module):
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
"""
Inputs:
x - (N, F)
y - (N, F)
Output:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EGO4D/episodic-memory | DotProduct | false | 8,053 | [
"MIT"
] | 27 | 2a3464882cd4f665c358c1b05a6397339e33c2e1 | https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1 |
InvGridSamplerNumerator | import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
import torch.utils.data
def ravel_multi_index(indices, shape):
indices_ravel = indices[0]
for i in range(1, len(indices)):
indices_ravel = indices_ravel * shape[i] + indices[i]
return indices_ravel
def add_repea... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy as np
fro... | EasyTry/coordinate_based_inpainting | InvGridSamplerNumerator | false | 8,054 | [
"MIT"
] | 13 | cbe0e3a58c8cb2054f0536a56f57264fd9967d63 | https://github.com/EasyTry/coordinate_based_inpainting/tree/cbe0e3a58c8cb2054f0536a56f57264fd9967d63 |
TVLoss | import torch
import torch.nn as nn
class TVLoss(nn.Module):
def __init__(self, tv_loss_weight=1):
"""
Total variation loss
https://github.com/jxgu1016/Total_Variation_Loss.pytorch
Args:
tv_loss_weight (int):
"""
super(TVLoss, self).__init__()
se... | 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... | EKami/EzeeML | TVLoss | false | 8,055 | [
"MIT"
] | 35 | 21753a0ede7cc1dc675a2dcd09b6306cea2cad56 | https://github.com/EKami/EzeeML/tree/21753a0ede7cc1dc675a2dcd09b6306cea2cad56 |
GlobalMaxPool | import torch
from torch import nn
class GlobalMaxPool(nn.Module):
"""
Max pooling in an equivariant network
"""
def __init__(self):
"""
"""
super().__init__()
def forward(self, x):
"""
"""
mx = torch.max(torch.max(x, dim=-1, keepdim=True)[0], dim=-... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | ElisevanderPol/symmetrizer | GlobalMaxPool | false | 8,056 | [
"MIT"
] | 16 | 8dae02bee2ba7132ae4fb07e07020767d280842c | https://github.com/ElisevanderPol/symmetrizer/tree/8dae02bee2ba7132ae4fb07e07020767d280842c |
adaILN | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class adaILN(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.9,
using_moving_average=True, using_bn=False):
super(adaILN, self).__init__()
self.eps = eps
self.momentum = momentum
... | 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... | Elvinky/IEGAN | adaILN | false | 8,057 | [
"MIT"
] | 29 | db072e38fb022b367da24d3210c59136fbad224e | https://github.com/Elvinky/IEGAN/tree/db072e38fb022b367da24d3210c59136fbad224e |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
"""policy-value network module"""
def __init__(self, board_width, board_height):
super(Net, self).__init__()
self.board_width = board_width
self.board_height = board_height
self.conv1 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Dryeck/17-18-Reinforcement | Net | false | 8,058 | [
"MIT"
] | 36 | f5a289a96c0139758436ab6a5a589519af1178da | https://github.com/Dryeck/17-18-Reinforcement/tree/f5a289a96c0139758436ab6a5a589519af1178da |
Conv1D | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=1, stride=1, padding=0,
bias=True):
super(Conv1D, self).__init__()
self.conv1d = nn.Conv1d(in_channels=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.nn.parallel
import torch.nn as nn
import torch.utils.data
import to... | EGO4D/episodic-memory | Conv1D | false | 8,059 | [
"MIT"
] | 27 | 2a3464882cd4f665c358c1b05a6397339e33c2e1 | https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1 |
AttBlockV2 | import torch
import torch.nn as nn
def init_layer(layer):
nn.init.xavier_uniform_(layer.weight)
if hasattr(layer, 'bias'):
if layer.bias is not None:
layer.bias.data.fill_(0.0)
class AttBlockV2(nn.Module):
def __init__(self, in_features: 'int', out_features: 'int', activation=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EMUNES/Auto-Subtitle-File-Generation | AttBlockV2 | false | 8,060 | [
"Apache-2.0"
] | 33 | 535a6351f450b1970da50bbbf4cc6d2f442ec335 | https://github.com/EMUNES/Auto-Subtitle-File-Generation/tree/535a6351f450b1970da50bbbf4cc6d2f442ec335 |
SigmoidFocalLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class SigmoidFocalLoss(nn.Module):
def __init__(self, alpha: 'float'=-1, gamma: 'float'=2, reduction:
'str'='none'):
super(SigmoidFocalLoss, self).__init__()
self.alpha = alpha
self.gamma = gamma
self.reduc... | 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... | EryiXie/PlaneRecNet | SigmoidFocalLoss | false | 8,061 | [
"MIT"
] | 34 | 534e23e6c5db2235ab1e5a9419fb4bfec3ffa943 | https://github.com/EryiXie/PlaneRecNet/tree/534e23e6c5db2235ab1e5a9419fb4bfec3ffa943 |
eSEModule | import torch
from torch import nn
import torch.nn.functional as F
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
return F.relu6(x + 3.0, inplace=self.inplace) / 6.0
class eSEModule(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 import nn
import t... | EricFH/SOR | eSEModule | false | 8,062 | [
"Apache-2.0"
] | 14 | d644469da16169dd269c6ecaac51b1762649e17a | https://github.com/EricFH/SOR/tree/d644469da16169dd269c6ecaac51b1762649e17a |
ILN | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class ILN(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.9,
using_moving_average=True, using_bn=False):
super(ILN, self).__init__()
self.eps = eps
self.momentum = momentum
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, math as tl_math
import torc... | Elvinky/IEGAN | ILN | false | 8,063 | [
"MIT"
] | 29 | db072e38fb022b367da24d3210c59136fbad224e | https://github.com/Elvinky/IEGAN/tree/db072e38fb022b367da24d3210c59136fbad224e |
Message_Passing_Unit_v2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Message_Passing_Unit_v2(nn.Module):
def __init__(self, fea_size, filter_size=128):
super(Message_Passing_Unit_v2, self).__init__()
self.w = nn.Linear(fea_size, filter_size, bias=True)
self.fea_size = fea_size
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | EricssonResearch/scott-eu | Message_Passing_Unit_v2 | false | 8,064 | [
"Apache-2.0"
] | 19 | aad7fd2f767a3c5e7d89223a593fd979ad596db3 | https://github.com/EricssonResearch/scott-eu/tree/aad7fd2f767a3c5e7d89223a593fd979ad596db3 |
Gated_Recurrent_Unit | import torch
import torch.nn as nn
import torch.nn.functional as F
class Gated_Recurrent_Unit(nn.Module):
def __init__(self, fea_size, dropout):
super(Gated_Recurrent_Unit, self).__init__()
self.wih = nn.Linear(fea_size, fea_size, bias=True)
self.whh = nn.Linear(fea_size, fea_size, bias=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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | EricssonResearch/scott-eu | Gated_Recurrent_Unit | false | 8,065 | [
"Apache-2.0"
] | 19 | aad7fd2f767a3c5e7d89223a593fd979ad596db3 | https://github.com/EricssonResearch/scott-eu/tree/aad7fd2f767a3c5e7d89223a593fd979ad596db3 |
WeightedPool | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class WeightedPool(nn.Module):
def __init__(self, dim):
sup... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EGO4D/episodic-memory | WeightedPool | false | 8,066 | [
"MIT"
] | 27 | 2a3464882cd4f665c358c1b05a6397339e33c2e1 | https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1 |
Noise_injector | import torch
import torch.nn as nn
def truncated_normal_(tensor, mean=0, std=1):
size = tensor.shape
tmp = tensor.new_empty(size + (4,)).normal_()
valid = (tmp < 2) & (tmp > -2)
ind = valid.max(-1, keepdim=True)[1]
tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1))
tensor.data.mul_(std).add_(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | EliasKassapis/CAR | Noise_injector | false | 8,067 | [
"Apache-2.0"
] | 17 | ff7ec86aab68c4b9ff8aea171244991bd132d487 | https://github.com/EliasKassapis/CAR/tree/ff7ec86aab68c4b9ff8aea171244991bd132d487 |
PatchEmbed | import torch
from torch import nn
class PatchEmbed(nn.Module):
""" Image to Patch Embedding
"""
def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768):
super().__init__()
num_patches = img_size // patch_size * (img_size // patch_size)
self.img_size = img_size
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | EscVM/EscVM_YT | PatchEmbed | false | 8,068 | [
"Apache-2.0"
] | 19 | 0ff1c47d7604d2452d7c9c2edd9b2db66781670a | https://github.com/EscVM/EscVM_YT/tree/0ff1c47d7604d2452d7c9c2edd9b2db66781670a |
Net | import torch
import torch.nn.functional as F
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = 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
from torch._inductor.runtime.... | EKami/EzeeML | Net | false | 8,069 | [
"MIT"
] | 35 | 21753a0ede7cc1dc675a2dcd09b6306cea2cad56 | https://github.com/EKami/EzeeML/tree/21753a0ede7cc1dc675a2dcd09b6306cea2cad56 |
ResidualBlock | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
from typing import Optional
def conv3x3(in_channels: 'int', out_channels: 'int', stride: 'int'=1
) ->nn.Conv2d:
return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=
stride, pad... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.parallel
impo... | EGO4D/episodic-memory | ResidualBlock | false | 8,070 | [
"MIT"
] | 27 | 2a3464882cd4f665c358c1b05a6397339e33c2e1 | https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1 |
LearnableSinusoidEncoding | import torch
import torch.nn as nn
class LearnableSinusoidEncoding(nn.Module):
"""Layer converts scalar input to Sinusoid Encoding with learnt scaling."""
def __init__(self, dim, max_timescale_init=10000):
"""Initialize layer.
Args:
dim: Dimensionality of the sinusoid encoding, 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 math as tl_math
import torch.... | ExpectationMax/Translational-Equivariant-Performers | LearnableSinusoidEncoding | false | 8,071 | [
"MIT"
] | 10 | c7a55af3b581426512eb4a57d3a13eb20e93fbd6 | https://github.com/ExpectationMax/Translational-Equivariant-Performers/tree/c7a55af3b581426512eb4a57d3a13eb20e93fbd6 |
NormedLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import torch.nn.parallel
import torch.optim
import torch.utils.data
class NormedLinear(nn.Module):
def __init__(self, in_features, out_features):
super(NormedLinear, self).__init__()
self.weight = Pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EricZsy/BalancedKnowledgeDistillation | NormedLinear | false | 8,072 | [
"MIT"
] | 22 | 88a2de840a3fc6eb2ee881c729f293b8e78714aa | https://github.com/EricZsy/BalancedKnowledgeDistillation/tree/88a2de840a3fc6eb2ee881c729f293b8e78714aa |
CQConcatenate | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EGO4D/episodic-memory | CQConcatenate | false | 8,073 | [
"MIT"
] | 27 | 2a3464882cd4f665c358c1b05a6397339e33c2e1 | https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1 |
FakeReLUM | import torch
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
class FakeReLU(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
return 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 import triton_helpers
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from t... | BCV-Uniandes/RSR | FakeReLUM | false | 8,074 | [
"zlib-acknowledgement"
] | 14 | dad60eedd3560f2655e3d1ed444153ed2616af2e | https://github.com/BCV-Uniandes/RSR/tree/dad60eedd3560f2655e3d1ed444153ed2616af2e |
FeedForward | import torch
import torch.nn as nn
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
class FeedForward(nn.Module):
def __init__(self, dim, mult=4, dropout=0.0, activation=None, glu=False):
super().__init__()
activation = default(activation, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ExpectationMax/Translational-Equivariant-Performers | FeedForward | false | 8,075 | [
"MIT"
] | 10 | c7a55af3b581426512eb4a57d3a13eb20e93fbd6 | https://github.com/ExpectationMax/Translational-Equivariant-Performers/tree/c7a55af3b581426512eb4a57d3a13eb20e93fbd6 |
FrameMaxPool | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class FrameMaxPool(nn.Module):
def __init__(self, input_size, hidden_size, stride):
super(FrameMaxPool, self).__init__()
self.vis_conv = nn.Conv1d(input_size, hidden_size, 1, 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.parallel
impo... | EGO4D/episodic-memory | FrameMaxPool | false | 8,076 | [
"MIT"
] | 27 | 2a3464882cd4f665c358c1b05a6397339e33c2e1 | https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1 |
FFN | import torch
from torch import nn as nn
import torch.nn.functional as F
class FFN(nn.Module):
def __init__(self, d_model, hidden_size=1024):
super().__init__()
self.ln1 = nn.Linear(d_model, hidden_size)
self.ln2 = nn.Linear(hidden_size, d_model)
def reset_params(self):
nn.ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 as nn
as... | FFTYYY/RoR_relation_extraction | FFN | false | 8,077 | [
"MIT"
] | 25 | a099e98f3708a39debeed4dc522ff57c4f6b960d | https://github.com/FFTYYY/RoR_relation_extraction/tree/a099e98f3708a39debeed4dc522ff57c4f6b960d |
TransposedConvLayer | import torch
from torch.optim import *
import torch.nn as nn
class TransposedConvLayer(nn.Module):
"""
Transposed convolutional layer to increase spatial resolution (x2) in a decoder.
Default: bias, ReLU, no downsampling, no batch norm.
"""
def __init__(self, in_channels, out_channels, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.optim import *
imp... | EvilPerfectionist/ssl_e2vid | TransposedConvLayer | false | 8,078 | [
"MIT"
] | 24 | 84f7c7e59875f134e97c14ec423f396725e04be7 | https://github.com/EvilPerfectionist/ssl_e2vid/tree/84f7c7e59875f134e97c14ec423f396725e04be7 |
LavaLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class LavaLoss(nn.Module):
"""
Depth gradient Loss for instance segmentation
"""
def __init__(self):
super(LavaLoss, self).__init__()
pass
def forward(self, seg_masks, gradient_map):
gt_size = gradient_map... | 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... | EryiXie/PlaneRecNet | LavaLoss | false | 8,079 | [
"MIT"
] | 34 | 534e23e6c5db2235ab1e5a9419fb4bfec3ffa943 | https://github.com/EryiXie/PlaneRecNet/tree/534e23e6c5db2235ab1e5a9419fb4bfec3ffa943 |
Hswish | import torch
import torch.nn as nn
import torch.quantization
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.float_op = nn.quantized.FloatFunctional()
self.relu6 = nn.ReLU6(inplace=inplace)
def forward(self, x):
relu6 = 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
import torch.nn as nn
import torch.quantization
assert_size_stride = torch._C._dynamo.gua... | Edgecortix-Inc/pytorch_quantization | Hswish | false | 8,080 | [
"Apache-2.0"
] | 13 | ad7120439f473d539adec22930a8363bfb63e830 | https://github.com/Edgecortix-Inc/pytorch_quantization/tree/ad7120439f473d539adec22930a8363bfb63e830 |
ResidualBlock | import torch
from torch.optim import *
import torch.nn as nn
class ResidualBlock(nn.Module):
"""
Residual block as in "Deep residual learning for image recognition", He et al. 2016.
Default: bias, ReLU, no downsampling, no batch norm, ConvLSTM.
"""
def __init__(self, in_channels, out_channels, st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.optim import *
imp... | EvilPerfectionist/ssl_e2vid | ResidualBlock | false | 8,081 | [
"MIT"
] | 24 | 84f7c7e59875f134e97c14ec423f396725e04be7 | https://github.com/EvilPerfectionist/ssl_e2vid/tree/84f7c7e59875f134e97c14ec423f396725e04be7 |
BahdanauAttn | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class BahdanauAttn(nn.Module):
def __init__(self, context_size, hidden_size):
super(BahdanauAttn, self).__init__()
self.hidden_size = hidden_size
self.context_size = context_size
self.attn_h = 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.... | Eurus-Holmes/VAG-NMT | BahdanauAttn | false | 8,082 | [
"Apache-2.0"
] | 12 | 38095c4a5477a0e7e2fa1592e8401aa9cddf2beb | https://github.com/Eurus-Holmes/VAG-NMT/tree/38095c4a5477a0e7e2fa1592e8401aa9cddf2beb |
CharbonnierLoss | import functools
import torch
import torch.utils.data
from torch.nn import functional as F
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
def reduce_loss(loss, reduction):
"""Reduce loss ... | 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 functools
import torc... | BCV-Uniandes/RSR | CharbonnierLoss | false | 8,083 | [
"zlib-acknowledgement"
] | 14 | dad60eedd3560f2655e3d1ed444153ed2616af2e | https://github.com/BCV-Uniandes/RSR/tree/dad60eedd3560f2655e3d1ed444153ed2616af2e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.