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 |
|---|---|---|---|---|---|---|---|---|---|---|
KernelSharedTensorTrain | import torch
from torch import nn
from torch.nn import Parameter
class KernelSharedTensorTrain(nn.Module):
def __init__(self, first_rank, m, second_rank, init_value):
super(KernelSharedTensorTrain, self).__init__()
self.first_rank = first_rank
self.m = m
self.second_rank = second_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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
from torch.nn import Parameter
assert_size_stride = torch._... | AndresOtero/TensorDecompositionMachineLearning | KernelSharedTensorTrain | false | 16,912 | [
"MIT"
] | 3 | 455f16b405ec9d031999b0ebf9c5a68d3c20b233 | https://github.com/AndresOtero/TensorDecompositionMachineLearning/tree/455f16b405ec9d031999b0ebf9c5a68d3c20b233 |
KernelTensorRingWithCategoryAndState | import math
import torch
from torch import nn
from torch.nn import Parameter
class KernelTensorRingWithCategoryAndState(nn.Module):
def __init__(self, amount_of_categories, first_rank, m, second_rank):
super(KernelTensorRingWithCategoryAndState, self).__init__()
self.first_rank = first_rank
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch.nn import Parameter
assert_size_stri... | AndresOtero/TensorDecompositionMachineLearning | KernelTensorRingWithCategoryAndState | false | 16,913 | [
"MIT"
] | 3 | 455f16b405ec9d031999b0ebf9c5a68d3c20b233 | https://github.com/AndresOtero/TensorDecompositionMachineLearning/tree/455f16b405ec9d031999b0ebf9c5a68d3c20b233 |
SEModule | import torch
import torch.nn as nn
class SEModule(nn.Module):
def __init__(self, planes, compress_rate):
super(SEModule, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv1 = nn.Conv2d(planes, planes // compress_rate, kernel_size
=1, stride=1, padding=0, 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_... | Andyeyeye/MTANet | SEModule | false | 16,914 | [
"MIT"
] | 8 | 65f5c356b18400bd1d1b80cffa1ec9f8c6570d2a | https://github.com/Andyeyeye/MTANet/tree/65f5c356b18400bd1d1b80cffa1ec9f8c6570d2a |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(2, 1, kernel_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
assert_... | Andyeyeye/MTANet | SpatialAttention | false | 16,915 | [
"MIT"
] | 8 | 65f5c356b18400bd1d1b80cffa1ec9f8c6570d2a | https://github.com/Andyeyeye/MTANet/tree/65f5c356b18400bd1d1b80cffa1ec9f8c6570d2a |
Net1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AndreaCeccarelli/gpu-monitor | Net1 | false | 16,916 | [
"MIT"
] | 4 | aad4dc88387a69235e9c370cb08da1f16ba4aa96 | https://github.com/AndreaCeccarelli/gpu-monitor/tree/aad4dc88387a69235e9c370cb08da1f16ba4aa96 |
CoreKernelTensorRing | import math
import torch
from torch import nn
from torch.nn import Parameter
class CoreKernelTensorRing(nn.Module):
def __init__(self, first_rank, m, second_rank):
super(CoreKernelTensorRing, self).__init__()
self.first_rank = first_rank
self.m = m
self.second_rank = second_rank
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch.nn import Parameter
assert_size_stri... | AndresOtero/TensorDecompositionMachineLearning | CoreKernelTensorRing | false | 16,917 | [
"MIT"
] | 3 | 455f16b405ec9d031999b0ebf9c5a68d3c20b233 | https://github.com/AndresOtero/TensorDecompositionMachineLearning/tree/455f16b405ec9d031999b0ebf9c5a68d3c20b233 |
FastAdaptiveAvgPool2d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch._utils
import torch.optim
class FastAdaptiveAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastAdaptiveAvgPool2d, self).__init__()
self.flatten = flatten
def forward(self, x):
return x.mean((2, 3... | 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._utils
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_si... | Alicegaz/torchok | FastAdaptiveAvgPool2d | false | 16,918 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
BCEWithLogitsLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
class BCEWithLogitsLoss(nn.BCEWithLogitsLoss):
def __init__(self, weight=None, reduction='mean', pos_weight=None,
ignore_all_zeros=False):
if pos_weight is not 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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Alicegaz/torchok | BCEWithLogitsLoss | false | 16,919 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
TransformerLayer | import torch
import torch.nn as nn
class TransformerLayer(nn.Module):
def __init__(self, c, num_heads):
super().__init__()
self.q = nn.Linear(c, c, bias=False)
self.k = nn.Linear(c, c, bias=False)
self.v = nn.Linear(c, c, bias=False)
self.ma = nn.MultiheadAttention(embed_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.... | Aditya239233/MDP | TransformerLayer | false | 16,920 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
L1_Charbonnier_loss | import torch
import torch.nn as nn
import torch.utils.data
class L1_Charbonnier_loss(nn.Module):
"""L1 Charbonnierloss."""
def __init__(self):
super(L1_Charbonnier_loss, self).__init__()
self.eps = 1e-06
def forward(self, X, Y):
diff = torch.add(X, -Y)
error = torch.sqrt(... | 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... | AnonymityCode/FastLFnet | L1_Charbonnier_loss | false | 16,921 | [
"MIT"
] | 8 | cc4c1d9620fef5e75798f40084729d8d7fdd5a9a | https://github.com/AnonymityCode/FastLFnet/tree/cc4c1d9620fef5e75798f40084729d8d7fdd5a9a |
AsymmetricMultiLabelLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch._utils
import torch.optim
class AsymmetricMultiLabelLoss(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(AsymmetricMultiLabelLoss, 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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Alicegaz/torchok | AsymmetricMultiLabelLoss | false | 16,922 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
AdaptiveCatAvgMaxPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
def adaptive_catavgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_pool2d(x, output_size)
return torch.cat((x_avg, x_max), 1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import tor... | Alicegaz/torchok | AdaptiveCatAvgMaxPool2d | false | 16,923 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
def __init__(self, in_feature, out_feature, dropout, alpha, concat=True):
super(GraphAttentionLayer, self).__init__()
self.dropout = dropout
self.in_feature = in_feature
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Alienge/Graph-Network | GAT | false | 16,924 | [
"MIT"
] | 3 | 559cccb6af4e6ca50c44fd51cac8df5713f255bf | https://github.com/Alienge/Graph-Network/tree/559cccb6af4e6ca50c44fd51cac8df5713f255bf |
HardMish | import torch
import torch.nn as nn
import torch.nn.parallel
import torch._utils
import torch.optim
def hard_mish(x, inplace: 'bool'=False):
""" Hard Mish
Experimental, based on notes by Mish author Diganta Misra at
https://github.com/digantamisra98/H-Mish/blob/0da20d4bc58e696b6803f2523c58d3c8a82782d0/RE... | 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._utils
import torch.optim
ass... | Alicegaz/torchok | HardMish | false | 16,925 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
class FocalLoss(nn.Module):
def __init__(self, gamma=2, alpha=None, autobalance=False, ignore_index
=-100, eps=1e-12, reduction='mean', normalized=False,
reduced_thre... | 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... | Alicegaz/torchok | FocalLoss | false | 16,926 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
PositionwiseFeedForward | import math
import torch
from torch import nn
class GELU(nn.Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.pow(x, 3))))
class PositionwiseFeedForward(nn.Module):
"""Implements FFN equation."""
def __init__(self, d_mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | Annelise2019/DeepLearning_Project | PositionwiseFeedForward | false | 16,927 | [
"MIT"
] | 4 | f63dcc266a5d9c33c118cabe8145f46f8e35945b | https://github.com/Annelise2019/DeepLearning_Project/tree/f63dcc266a5d9c33c118cabe8145f46f8e35945b |
GeM | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
class GeM(nn.Module):
def __init__(self, p=3):
super(GeM, self).__init__()
self.p = p
self.eps = 1e-06
def forward(self, x):
return self.gem(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._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | Alicegaz/torchok | GeM | false | 16,928 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
CecaModule | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
class CecaModule(nn.Module):
"""Constructs a circular ECA module.
ECA module where the conv uses circular padding rather than zero padding.
Unlike the spatial 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
import math
import torch.nn as nn
import torch.nn.parallel
import torch._utils
i... | Alicegaz/torchok | CecaModule | false | 16,929 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
GELU | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
class GELU(nn.Module):
"""Applies the Gaussian Error Linear Units function (w/ dummy inplace arg)
"""
def __init__(self, inplace: 'bool'=False):
super(GELU, self).__i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch._utils
import torch... | Alicegaz/torchok | GELU | false | 16,930 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
EcaModule | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch._utils
import torch.optim
class EcaModule(nn.Module):
"""Constructs an ECA module.
Args:
channels: Number of channels of the input feature map for use in adaptive kernel sizes
for actual calculations acco... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.parallel
import torch._utils
i... | Alicegaz/torchok | EcaModule | false | 16,931 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
ConvNorm | import torch
import torch.multiprocessing
class ConvNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=None, dilation=1, bias=True, w_init_gain='linear'):
super(ConvNorm, self).__init__()
if padding is None:
assert kernel_size... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.multiprocessing
assert_size_stride = torch._C._dynamo.guards.assert... | AppleHolic/FastSpeech2 | ConvNorm | false | 16,932 | [
"MIT"
] | 8 | 8f6969edd0c86c05b1dd70a0b7841bd86505455e | https://github.com/AppleHolic/FastSpeech2/tree/8f6969edd0c86c05b1dd70a0b7841bd86505455e |
Fire | import torch
import torch.nn as nn
class Fire(nn.Module):
def __init__(self, inplanes, squeeze_planes, expand1x1_planes,
expand3x3_planes, dilation=1):
super(Fire, self).__init__()
self.inplanes = inplanes
self.squeeze = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1)
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
assert_... | Anikily/CDinkNet | Fire | false | 16,933 | [
"MIT"
] | 4 | 490736855475a51bb2984412e88ac7d50d817a3c | https://github.com/Anikily/CDinkNet/tree/490736855475a51bb2984412e88ac7d50d817a3c |
GroupNormAct | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
def swish(x, inplace: 'bool'=False):
"""Swish - Described in: https://arxiv.org/abs/1710.05941
"""
return x.mul_(x.sigmoid()) if inplace else x.mul(x.sigmoid())
def is_expor... | 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... | Alicegaz/torchok | GroupNormAct | false | 16,934 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
GroupNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
def num_groups(group_size, channels):
if not group_size:
return 1
else:
assert channels % group_size == 0
return channels // group_size
class GroupNorm(n... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch._utils
import torch... | Alicegaz/torchok | GroupNorm | false | 16,935 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
HingeMarginLoss | import torch
import torch.nn as nn
class HingeMarginLoss(nn.Module):
"""
计算hinge loss 接口
"""
def __init__(self):
super(HingeMarginLoss, self).__init__()
def forward(self, t, tr, delt=None, size_average=False):
"""
计算hingle loss
"""
if delt is None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Aurelius84/SPWE | HingeMarginLoss | false | 16,936 | [
"MIT"
] | 9 | 5f9fc5495e879b5272c118271a69c5adad4ba260 | https://github.com/Aurelius84/SPWE/tree/5f9fc5495e879b5272c118271a69c5adad4ba260 |
Conv | import torch
import torch.nn as nn
import torch.multiprocessing
class Conv(nn.Module):
"""
Convolution Module
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='linear'):
"""
:param in_channels: dimension of inp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.multiprocessing
assert_size_stride = torch._C... | AppleHolic/FastSpeech2 | Conv | false | 16,937 | [
"MIT"
] | 8 | 8f6969edd0c86c05b1dd70a0b7841bd86505455e | https://github.com/AppleHolic/FastSpeech2/tree/8f6969edd0c86c05b1dd70a0b7841bd86505455e |
L1_Gradient_loss | import torch
import torch.nn as nn
import torch.utils.data
class L1_Charbonnier_loss(nn.Module):
"""L1 Charbonnierloss."""
def __init__(self):
super(L1_Charbonnier_loss, self).__init__()
self.eps = 1e-06
def forward(self, X, Y):
diff = torch.add(X, -Y)
error = torch.sqrt(... | 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
assert_size_stride = torch._C._dy... | AnonymityCode/FastLFnet | L1_Gradient_loss | false | 16,938 | [
"MIT"
] | 8 | cc4c1d9620fef5e75798f40084729d8d7fdd5a9a | https://github.com/AnonymityCode/FastLFnet/tree/cc4c1d9620fef5e75798f40084729d8d7fdd5a9a |
Aggregate | import torch
import torch.nn as nn
import torch.utils.data
class Aggregate(nn.Module):
"""Pooling layer based on sum or average with optional masking.
Args:
axis (int): axis along which pooling is done.
mean (bool, optional): if True, use average instead for sum pooling.
keepdim (bool... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Avinashpathapati/gnn_molecule | Aggregate | false | 16,939 | [
"MIT"
] | 3 | 84b5e92902c638694b872c42d010676bcd3d7658 | https://github.com/Avinashpathapati/gnn_molecule/tree/84b5e92902c638694b872c42d010676bcd3d7658 |
QueryAttentionAggregator | import torch
import numpy as np
import torch.utils.data
from torch import nn
import torch
from torch.nn import functional as F
class QueryAttentionAggregator(nn.Module):
def __init__(self, input_dim):
super(QueryAttentionAggregator, self).__init__()
self.query = nn.Linear(input_dim, input_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.... | Arnaud15/CS236_Deep_Generative_Processes | QueryAttentionAggregator | false | 16,940 | [
"MIT"
] | 6 | 179c995c4f596c19441c5e844f2ed07d954324e3 | https://github.com/Arnaud15/CS236_Deep_Generative_Processes/tree/179c995c4f596c19441c5e844f2ed07d954324e3 |
SpectrogramMasker | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpectrogramMasker(nn.Module):
def __init__(self, win_length: 'int'=400, hop_length: 'int'=200):
super().__init__()
self.win_length = win_length
self.conv = nn.Conv1d(1, 1, self.win_length, stride=hop_length,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | AppleHolic/2020AIChallengeSpeechRecognition | SpectrogramMasker | false | 16,941 | [
"MIT"
] | 9 | 62002f036a4bb4ab23f7bdba73f19e97e0ac7087 | https://github.com/AppleHolic/2020AIChallengeSpeechRecognition/tree/62002f036a4bb4ab23f7bdba73f19e97e0ac7087 |
MLP | import torch
import torch.nn as nn
class FullyConnectedBlock(nn.Module):
def __init__(self, width, bn=False):
super().__init__()
self.linear = nn.Linear(width, width, bias=not bn)
self.bn = bn
if bn:
self.bn_layer = nn.BatchNorm1d(width)
self.relu = 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
import torch.nn as nn
assert_... | Arjung27/DeepThinking | MLP | false | 16,942 | [
"MIT"
] | 6 | 13a2ce534bcb0b9379a22fffef52d975d650adb2 | https://github.com/Arjung27/DeepThinking/tree/13a2ce534bcb0b9379a22fffef52d975d650adb2 |
BehlerAngular | import torch
import torch.nn as nn
import torch.utils.data
class BehlerAngular(nn.Module):
"""
Compute Behler type angular contribution of the angle spanned by three atoms:
:math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta`
Sets of zetas with lambdas of -1 and +1 are generated au... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Avinashpathapati/gnn_molecule | BehlerAngular | false | 16,943 | [
"MIT"
] | 3 | 84b5e92902c638694b872c42d010676bcd3d7658 | https://github.com/Avinashpathapati/gnn_molecule/tree/84b5e92902c638694b872c42d010676bcd3d7658 |
VectorAttentionAggregator | import torch
import numpy as np
import torch.utils.data
from torch import nn
import torch
from torch.nn import functional as F
class VectorAttentionAggregator(nn.Module):
def __init__(self, input_dim):
super(VectorAttentionAggregator, self).__init__()
self.vector = nn.Parameter(torch.zeros(input_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | Arnaud15/CS236_Deep_Generative_Processes | VectorAttentionAggregator | false | 16,944 | [
"MIT"
] | 6 | 179c995c4f596c19441c5e844f2ed07d954324e3 | https://github.com/Arnaud15/CS236_Deep_Generative_Processes/tree/179c995c4f596c19441c5e844f2ed07d954324e3 |
SimpleCNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleCNN(nn.Module):
def __init__(self):
super(SimpleCNN, self).__init__()
self.fc1 = nn.Linear(28 * 28, 500)
self.fc2 = nn.Linear(500, 256)
self.fc3 = nn.Linear(256, 10)
def forward(self, x):
x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AnweshCR7/just-some-crypto-fun | SimpleCNN | false | 16,945 | [
"MIT"
] | 4 | e614cd9f46e355272aec37df7a7cc90a589c993a | https://github.com/AnweshCR7/just-some-crypto-fun/tree/e614cd9f46e355272aec37df7a7cc90a589c993a |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
import torch.multiprocessing
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature):
super().__init__()
self.temperature = temperature
self.softmax = nn.Softmax(dim=2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AppleHolic/FastSpeech2 | ScaledDotProductAttention | false | 16,946 | [
"MIT"
] | 8 | 8f6969edd0c86c05b1dd70a0b7841bd86505455e | https://github.com/AppleHolic/FastSpeech2/tree/8f6969edd0c86c05b1dd70a0b7841bd86505455e |
Attention | import math
import torch
import torch.nn.functional as F
import torch.utils.data
def restricted_softmax(src, dim=-1, margin=0):
src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0)
out = (src - src_max).exp()
out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp())
return 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.... | Avinashpathapati/gnn_molecule | Attention | false | 16,947 | [
"MIT"
] | 3 | 84b5e92902c638694b872c42d010676bcd3d7658 | https://github.com/Avinashpathapati/gnn_molecule/tree/84b5e92902c638694b872c42d010676bcd3d7658 |
filtered_softmax | import torch
import torch.nn as nn
class filtered_softmax(nn.Module):
def __init__(self):
super(filtered_softmax, self).__init__()
def forward(self, x, label):
x = torch.softmax(x, dim=1)
x = x * label
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | AutumnCrocus/shadow_sim | filtered_softmax | false | 16,948 | [
"MIT"
] | 6 | 79ad13ff9bd7131c82f269af32a3970f3e4bf2ca | https://github.com/AutumnCrocus/shadow_sim/tree/79ad13ff9bd7131c82f269af32a3970f3e4bf2ca |
ChanNorm | import torch
from torch import nn
class ChanNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.eps = eps
self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))
def forward(self, x):
std = torch.var(x,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Asha-Gutlapalli/StyleGAN2-Art | ChanNorm | false | 16,949 | [
"MIT"
] | 4 | 5a8a8ad61183e82abafe587d755a7fbce28aa8f0 | https://github.com/Asha-Gutlapalli/StyleGAN2-Art/tree/5a8a8ad61183e82abafe587d755a7fbce28aa8f0 |
EqualLinear | import torch
from torch import nn
import torch.nn.functional as F
class EqualLinear(nn.Module):
def __init__(self, in_dim, out_dim, lr_mul=1, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_dim, in_dim))
if bias:
self.bias = nn.Parameter(torch.zeros(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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Asha-Gutlapalli/StyleGAN2-Art | EqualLinear | false | 16,950 | [
"MIT"
] | 4 | 5a8a8ad61183e82abafe587d755a7fbce28aa8f0 | https://github.com/Asha-Gutlapalli/StyleGAN2-Art/tree/5a8a8ad61183e82abafe587d755a7fbce28aa8f0 |
MAB | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AntonValk/BagGraph-Graph-MIL | MAB | false | 16,951 | [
"MIT"
] | 8 | 1447b52b32995cf6c71e731dd1261104cd66ced0 | https://github.com/AntonValk/BagGraph-Graph-MIL/tree/1447b52b32995cf6c71e731dd1261104cd66ced0 |
MaskedSoftmax | import torch
import torch as th
from torch import nn
import torch.nn.functional as F
class MaskedSoftmax(nn.Module):
def __init__(self, dim):
super(MaskedSoftmax, self).__init__()
self.dim = dim
def forward(self, logit, mask=None):
if mask is None:
dist = F.softmax(logit ... | 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... | Artisan-Lab/SMTimer | MaskedSoftmax | false | 16,952 | [
"MIT"
] | 5 | 8e0bbb854afd360dcc61d6b098c4ae8931bae14c | https://github.com/Artisan-Lab/SMTimer/tree/8e0bbb854afd360dcc61d6b098c4ae8931bae14c |
NegativeLearningLoss | import torch
import torch.nn as nn
import torch.backends.cudnn
import torch.utils
import torch.distributed
class NegativeLearningLoss(nn.Module):
def __init__(self, threshold=0.05):
super(NegativeLearningLoss, self).__init__()
self.threshold = threshold
def forward(self, predict):
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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | BIT-DA/RIPU | NegativeLearningLoss | false | 16,953 | [
"MIT"
] | 9 | 125edf112c9ded1e7497aedb2a092331824df100 | https://github.com/BIT-DA/RIPU/tree/125edf112c9ded1e7497aedb2a092331824df100 |
SSWELoss | import torch
import torch.nn as nn
class HingeMarginLoss(nn.Module):
"""
计算hinge loss 接口
"""
def __init__(self):
super(HingeMarginLoss, self).__init__()
def forward(self, t, tr, delt=None, size_average=False):
"""
计算hingle loss
"""
if delt is None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Aurelius84/SPWE | SSWELoss | false | 16,954 | [
"MIT"
] | 9 | 5f9fc5495e879b5272c118271a69c5adad4ba260 | https://github.com/Aurelius84/SPWE/tree/5f9fc5495e879b5272c118271a69c5adad4ba260 |
PMA | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AntonValk/BagGraph-Graph-MIL | PMA | false | 16,955 | [
"MIT"
] | 8 | 1447b52b32995cf6c71e731dd1261104cd66ced0 | https://github.com/AntonValk/BagGraph-Graph-MIL/tree/1447b52b32995cf6c71e731dd1261104cd66ced0 |
ScaleLayer | import torch
import torch.nn as nn
class ScaleLayer(nn.Module):
def __init__(self, init_value=0.001):
super(ScaleLayer, self).__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
None
return input * self.scale
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Anurag14/STar-framework | ScaleLayer | false | 16,956 | [
"MIT"
] | 4 | 6670499c681fce8d76aae1d1910bc849ec5f56ea | https://github.com/Anurag14/STar-framework/tree/6670499c681fce8d76aae1d1910bc849ec5f56ea |
ISAB | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AntonValk/BagGraph-Graph-MIL | ISAB | false | 16,957 | [
"MIT"
] | 8 | 1447b52b32995cf6c71e731dd1261104cd66ced0 | https://github.com/AntonValk/BagGraph-Graph-MIL/tree/1447b52b32995cf6c71e731dd1261104cd66ced0 |
OutConv | import torch
import torch.nn as nn
class OutConv(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutConv, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1)
def forward(self, x):
return self.conv(x)
def get_inputs():
return [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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AyoubOuddah/SAR_River_Segmentation_Pytorch-Unet | OutConv | false | 16,958 | [
"MIT"
] | 10 | e7da2414d6158a5f6358df92ded273a1a016cb91 | https://github.com/AyoubOuddah/SAR_River_Segmentation_Pytorch-Unet/tree/e7da2414d6158a5f6358df92ded273a1a016cb91 |
ResNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResNet(nn.Module):
def __init__(self, n_in, n_out):
super(ResNet, self).__init__()
self.fc1 = nn.Linear(n_in, n_out)
self.fc2 = nn.Linear(n_in, n_out)
def forward(self, x):
h1 = F.relu(self.fc1(x))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AutumnCrocus/shadow_sim | ResNet | false | 16,959 | [
"MIT"
] | 6 | 79ad13ff9bd7131c82f269af32a3970f3e4bf2ca | https://github.com/AutumnCrocus/shadow_sim/tree/79ad13ff9bd7131c82f269af32a3970f3e4bf2ca |
SAB | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AntonValk/BagGraph-Graph-MIL | SAB | false | 16,960 | [
"MIT"
] | 8 | 1447b52b32995cf6c71e731dd1261104cd66ced0 | https://github.com/AntonValk/BagGraph-Graph-MIL/tree/1447b52b32995cf6c71e731dd1261104cd66ced0 |
MinibatchStdDev | import torch
import torch as th
import torch.nn.parallel
import torch.utils.data
class MinibatchStdDev(th.nn.Module):
"""
Minibatch standard deviation layer for the discriminator
"""
def __init__(self):
"""
derived class constructor
"""
super(MinibatchStdDev, self).__i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch as th
import torch.nn.parallel
import torch.utils.data
assert_size... | AshwinRJ/Face-Generation-from-Speech | MinibatchStdDev | false | 16,961 | [
"MIT"
] | 4 | 6d8afe8a61185bfe67cd5fd19c7f993630f481b4 | https://github.com/AshwinRJ/Face-Generation-from-Speech/tree/6d8afe8a61185bfe67cd5fd19c7f993630f481b4 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
"""https://www.kaggle.com/c/human-protein-atlas-image-classification/discussion/78109"""
def __init__(self, gamma=2):
super().__init__()
self.gamma = gamma
def forward(self, logit, target):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | AutuanLiu/PyTorch-ML | FocalLoss | false | 16,962 | [
"MIT"
] | 9 | 884c7723843d9ffb4da09d95eb97886b2cc38f28 | https://github.com/AutuanLiu/PyTorch-ML/tree/884c7723843d9ffb4da09d95eb97886b2cc38f28 |
BernoulliLayer | import abc
import torch
class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta):
"""Probabilistic layer to be used by the encoder/decoder of a
Variational AutoEncoder.
"""
@abc.abstractmethod
def forward(self, inputs):
"""Compute the parameters of the distribution conditioned on... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 abc
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | BUTSpeechFIT/beer | BernoulliLayer | false | 16,963 | [
"MIT"
] | 6 | 43fb9027a859db28d2f2f8709260ca2ce9501e25 | https://github.com/BUTSpeechFIT/beer/tree/43fb9027a859db28d2f2f8709260ca2ce9501e25 |
TransposeLayer | import torch
class TransposeLayer(torch.nn.Module):
"""Transpose the input."""
def forward(self, data):
return data.t().contiguous()
def get_inputs():
return [torch.rand([4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | BUTSpeechFIT/beer | TransposeLayer | false | 16,964 | [
"MIT"
] | 6 | 43fb9027a859db28d2f2f8709260ca2ce9501e25 | https://github.com/BUTSpeechFIT/beer/tree/43fb9027a859db28d2f2f8709260ca2ce9501e25 |
PixelwiseNorm | import torch
import torch as th
import torch.nn.parallel
import torch.utils.data
class PixelwiseNorm(th.nn.Module):
def __init__(self):
super(PixelwiseNorm, self).__init__()
def forward(self, x, alpha=1e-08):
"""
forward pass of the module
:param x: input activations volume
... | 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 as th
import torch.nn.parallel
import torch.utils.data
assert_size... | AshwinRJ/Face-Generation-from-Speech | PixelwiseNorm | false | 16,965 | [
"MIT"
] | 4 | 6d8afe8a61185bfe67cd5fd19c7f993630f481b4 | https://github.com/AshwinRJ/Face-Generation-from-Speech/tree/6d8afe8a61185bfe67cd5fd19c7f993630f481b4 |
ScaledDotProductAttention | import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""Scaled dot-product attention mechanism."""
def __init__(self, temperature, attention_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attention_dropout)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AutuanLiu/PyTorch-ML | ScaledDotProductAttention | false | 16,966 | [
"MIT"
] | 9 | 884c7723843d9ffb4da09d95eb97886b2cc38f28 | https://github.com/AutuanLiu/PyTorch-ML/tree/884c7723843d9ffb4da09d95eb97886b2cc38f28 |
ResidualNetworkSegment | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResidualNetworkSegment(nn.Module):
"""Modified ResidualNetworkSegment model class"""
def __init__(self, block, num_blocks, width, depth):
super(ResidualNetworkSegment, self).__init__()
assert (depth - 4
) % 4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Arjung27/DeepThinking | ResidualNetworkSegment | false | 16,967 | [
"MIT"
] | 6 | 13a2ce534bcb0b9379a22fffef52d975d650adb2 | https://github.com/Arjung27/DeepThinking/tree/13a2ce534bcb0b9379a22fffef52d975d650adb2 |
ProductFusion | import torch
from torch import nn
class ProductFusion(nn.Module):
def __init__(self):
super(ProductFusion, self).__init__()
def forward(self, seq_features, img_features, **kwargs):
return seq_features * img_features
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Asichurter/MalFusionFSL | ProductFusion | false | 16,969 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
SpatialPurity | import torch
import torch.nn as nn
import torch.backends.cudnn
import torch.utils
import torch.distributed
class SpatialPurity(nn.Module):
def __init__(self, in_channels=19, padding_mode='zeros', size=3):
super(SpatialPurity, self).__init__()
assert size % 2 == 1, 'error size'
self.conv =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | BIT-DA/RIPU | SpatialPurity | false | 16,970 | [
"MIT"
] | 9 | 125edf112c9ded1e7497aedb2a092331824df100 | https://github.com/BIT-DA/RIPU/tree/125edf112c9ded1e7497aedb2a092331824df100 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 1, 1)
self.conv2 = nn.Conv2d(1, 1, 1)
def forward(self, x):
return self.conv2(F.relu(self.conv1(x)))
def get_inputs():
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AutuanLiu/PyTorch-ML | Net | false | 16,971 | [
"MIT"
] | 9 | 884c7723843d9ffb4da09d95eb97886b2cc38f28 | https://github.com/AutuanLiu/PyTorch-ML/tree/884c7723843d9ffb4da09d95eb97886b2cc38f28 |
ResidualFeedFowardBlock | import torch
class ResidualFeedFowardBlock(torch.nn.Module):
"""Block of two feed-forward layer with a reisdual connection:
f(W1^T x + b1) f(W2^T h1 + b2 ) h2 + x
x ------------------> h1 --------------------> h2 ----------> y
| ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | BUTSpeechFIT/beer | ResidualFeedFowardBlock | false | 16,972 | [
"MIT"
] | 6 | 43fb9027a859db28d2f2f8709260ca2ce9501e25 | https://github.com/BUTSpeechFIT/beer/tree/43fb9027a859db28d2f2f8709260ca2ce9501e25 |
VAE | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAE(nn.Module):
"""VAE 定义"""
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(784, 400)
self.fc21 = nn.Linear(400, 20)
self.fc22 = nn.Linear(400, 20)
self.fc3 = nn.Linear(20, 4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | AutuanLiu/PyTorch-ML | VAE | false | 16,973 | [
"MIT"
] | 9 | 884c7723843d9ffb4da09d95eb97886b2cc38f28 | https://github.com/AutuanLiu/PyTorch-ML/tree/884c7723843d9ffb4da09d95eb97886b2cc38f28 |
NormalIsotropicCovarianceLayer | import abc
import math
import torch
class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta):
"""Probabilistic layer to be used by the encoder/decoder of a
Variational AutoEncoder.
"""
@abc.abstractmethod
def forward(self, inputs):
"""Compute the parameters of the distribution co... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | BUTSpeechFIT/beer | NormalIsotropicCovarianceLayer | false | 16,974 | [
"MIT"
] | 6 | 43fb9027a859db28d2f2f8709260ca2ce9501e25 | https://github.com/BUTSpeechFIT/beer/tree/43fb9027a859db28d2f2f8709260ca2ce9501e25 |
LocationLayer | import torch
from torch import nn
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias)
torch.nn.init.xavier_uniform_(self.linear_layer.wei... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | BenAAndrew/tacotron2-model | LocationLayer | false | 16,975 | [
"BSD-3-Clause"
] | 4 | cd2aaf605f94e97225319fbf876e4213ae517b40 | https://github.com/BenAAndrew/tacotron2-model/tree/cd2aaf605f94e97225319fbf876e4213ae517b40 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""Calculates attention over the input nodes given the current state."""
def __init__(self, encoder_hidden_size, decoder_hidden_size):
super(Attention, self).__init__()
self.v = nn.Parameter(torch.z... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Bachery/Shape-driven-Coordinate-Ordering | Attention | false | 16,976 | [
"MIT"
] | 6 | 6afa933a882cbe7a40ddf1de169537eccfe415b7 | https://github.com/Bachery/Shape-driven-Coordinate-Ordering/tree/6afa933a882cbe7a40ddf1de169537eccfe415b7 |
ImgPatchConverter | import torch
from torch import nn
import torch as t
class ImgPatchConverter(nn.Module):
def __init__(self):
super(ImgPatchConverter, self).__init__()
def forward(self, x):
x = t.flatten(x, start_dim=2)
x = t.transpose(x, 1, 2).contiguous()
return x
def get_inputs():
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Asichurter/MalFusionFSL | ImgPatchConverter | false | 16,977 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
AddFusion | import torch
from torch import nn
class AddFusion(nn.Module):
def __init__(self):
super(AddFusion, self).__init__()
def forward(self, seq_features, img_features, **kwargs):
return seq_features + img_features
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Asichurter/MalFusionFSL | AddFusion | false | 16,978 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
CatFusion | import torch
from torch import nn
class CatFusion(nn.Module):
def __init__(self):
super(CatFusion, self).__init__()
def forward(self, seq_features, img_features, fuse_dim=1, **kwargs):
return torch.cat((seq_features, img_features), dim=fuse_dim)
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Asichurter/MalFusionFSL | CatFusion | false | 16,979 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
LocalDiscrepancy | import torch
import torch.nn as nn
import torch.backends.cudnn
import torch.utils
import torch.distributed
class LocalDiscrepancy(nn.Module):
def __init__(self, in_channels=19, padding_mode='replicate', neighbor=8,
l_type='l1'):
"""
depth-wise conv to calculate the mean of neighbor
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | BIT-DA/RIPU | LocalDiscrepancy | false | 16,980 | [
"MIT"
] | 9 | 125edf112c9ded1e7497aedb2a092331824df100 | https://github.com/BIT-DA/RIPU/tree/125edf112c9ded1e7497aedb2a092331824df100 |
SigmoidFocalClassificationLoss | import torch
import torch.nn as nn
def _sigmoid_cross_entropy_with_logits(logits, labels):
loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits)
loss += torch.log1p(torch.exp(-torch.abs(logits)))
return loss
class SigmoidFocalClassificationLoss(nn.Module):
"""Sigmoid focal cross entrop... | 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... | Benedict0819/pointrcnn_multiclass | SigmoidFocalClassificationLoss | false | 16,981 | [
"MIT"
] | 4 | 61781815920c0a5d44486ed25cf5bed805eb6b89 | https://github.com/Benedict0819/pointrcnn_multiclass/tree/61781815920c0a5d44486ed25cf5bed805eb6b89 |
NormalDiagonalCovarianceLayer | import abc
import math
import torch
class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta):
"""Probabilistic layer to be used by the encoder/decoder of a
Variational AutoEncoder.
"""
@abc.abstractmethod
def forward(self, inputs):
"""Compute the parameters of the distribution co... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | BUTSpeechFIT/beer | NormalDiagonalCovarianceLayer | false | 16,982 | [
"MIT"
] | 6 | 43fb9027a859db28d2f2f8709260ca2ce9501e25 | https://github.com/BUTSpeechFIT/beer/tree/43fb9027a859db28d2f2f8709260ca2ce9501e25 |
criticAttention | import torch
import torch.nn as nn
class criticAttention(nn.Module):
"""Calculates attention over the input nodes given the current state."""
def __init__(self, hidden_size):
super(criticAttention, self).__init__()
self.v = nn.Parameter(torch.zeros((1, 1, hidden_size),
requires_gr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Bachery/Shape-driven-Coordinate-Ordering | criticAttention | false | 16,983 | [
"MIT"
] | 6 | 6afa933a882cbe7a40ddf1de169537eccfe415b7 | https://github.com/Bachery/Shape-driven-Coordinate-Ordering/tree/6afa933a882cbe7a40ddf1de169537eccfe415b7 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, ignore_target=-1):
super().__init__()
self.ignore_target = ignore_target
def forward(self, input, target):
"""
:param input: (N), logit
:param target: (N), {0, 1}
:return:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Benedict0819/pointrcnn_multiclass | DiceLoss | false | 16,984 | [
"MIT"
] | 4 | 61781815920c0a5d44486ed25cf5bed805eb6b89 | https://github.com/Benedict0819/pointrcnn_multiclass/tree/61781815920c0a5d44486ed25cf5bed805eb6b89 |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handle fp16."""
def forward(self, x: 'torch.Tensor'):
orig_type = x.dtype
ret = super().forward(x.type(torch.float32))
return ret.type(orig_type)
def get_inputs():
return [torch.ran... | 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... | Beximus/ResearchPortfolioCode | LayerNorm | false | 16,985 | [
"MIT"
] | 6 | db8343be6bbac361c3f6d01bbb82e458ff40f44e | https://github.com/Beximus/ResearchPortfolioCode/tree/db8343be6bbac361c3f6d01bbb82e458ff40f44e |
TransitionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class TransitionLayer(nn.Module):
""" TransitionLayer between dense blocks
"""
def __init__(self, n_in, n_out, use_dropout=False):
"""
Args:
n_in (int) : number of input channels
n_out (int) : numbe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | BingoH/ReinventingWheel | TransitionLayer | false | 16,986 | [
"MIT"
] | 4 | 5232d0ab697ad57a039c766355545bbde3b2a200 | https://github.com/BingoH/ReinventingWheel/tree/5232d0ab697ad57a039c766355545bbde3b2a200 |
QuickGELU | import torch
from torch import nn
class QuickGELU(nn.Module):
def forward(self, x: 'torch.Tensor'):
return x * torch.sigmoid(1.702 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Beximus/ResearchPortfolioCode | QuickGELU | false | 16,987 | [
"MIT"
] | 6 | db8343be6bbac361c3f6d01bbb82e458ff40f44e | https://github.com/Beximus/ResearchPortfolioCode/tree/db8343be6bbac361c3f6d01bbb82e458ff40f44e |
FocalLoss | import torch
import torch.nn as nn
from time import *
class FocalLoss(nn.Module):
def __init__(self, gamma=2, eps=1e-07):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.eps = eps
self.ce = nn.CrossEntropyLoss()
def forward(self, input, target):
logp = 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 math as tl_math
import torch.nn as nn
... | BillKerman/FaceNetCustomized | FocalLoss | false | 16,988 | [
"MIT"
] | 4 | 30bb99b62f960034c4aa4206d7dc22de672a997f | https://github.com/BillKerman/FaceNetCustomized/tree/30bb99b62f960034c4aa4206d7dc22de672a997f |
BiliAttnReduction | import torch
from torch import nn
import torch as t
from torch.nn import functional as F
def getMaskFromLens(lens, max_seq_len=200, expand_feature_dim=None):
if type(lens) == list:
lens = t.LongTensor(lens)
batch_size = len(lens)
idx_matrix = t.arange(0, max_seq_len, 1).repeat((batch_size, 1))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Asichurter/MalFusionFSL | BiliAttnReduction | false | 16,989 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
BahdanauAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class BahdanauAttention(nn.Module):
""" Class performs Additive Bahdanau Attention.
Source: https://arxiv.org/pdf/1409.0473.pdf
"""
def __init__(self, num_features, hidden_dim, output_dim=1):
super(BahdanauAttention, 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.... | BhushanMahajan25/image-captioning | BahdanauAttention | false | 16,990 | [
"MIT"
] | 5 | c3e1db358267fbb1b8abe723542f7fd8c6b0c966 | https://github.com/BhushanMahajan25/image-captioning/tree/c3e1db358267fbb1b8abe723542f7fd8c6b0c966 |
RSoftmax | import torch
import torch.nn.functional as F
import torch.nn as nn
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
... | Bin-ze/Food_detection | RSoftmax | false | 16,991 | [
"Apache-2.0"
] | 4 | 1c1a067f12644f2b0289e49aec4637d580722f70 | https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70 |
TransformerSet | import torch
from torch import nn
class TransformerSet(nn.Module):
def __init__(self, input_size, dropout=0.5, trans_head_nums=1, **kwargs):
super(TransformerSet, self).__init__()
self.Transformer = nn.MultiheadAttention(embed_dim=input_size,
num_heads=trans_head_nums, dropout=dropout... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Asichurter/MalFusionFSL | TransformerSet | false | 16,992 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
SeqAttendImgAttOnlyFusion | import torch
from torch import nn
class SeqAttendImgFusion(nn.Module):
def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout,
att_scale_factor=1, **kwargs):
super(SeqAttendImgFusion, self).__init__()
self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False)
self.ImgTrans =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Asichurter/MalFusionFSL | SeqAttendImgAttOnlyFusion | false | 16,993 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
MSE_Loss | import torch
import torch.nn as nn
from torch.nn import functional as F
class MSE_Loss(nn.Module):
def __init__(self):
super(MSE_Loss, self).__init__()
def forward(self, input, target):
return F.mse_loss(input, target, reduction='mean')
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | BennyZhang-Codes/LDCT-denoising-with-DL-Methods-and-Dicom-Viewer-by-Benny | MSE_Loss | false | 16,994 | [
"MIT"
] | 7 | 07e3dc1e3c6dcdea314b2a9e3cf9ac1036cf5eb6 | https://github.com/BennyZhang-Codes/LDCT-denoising-with-DL-Methods-and-Dicom-Viewer-by-Benny/tree/07e3dc1e3c6dcdea314b2a9e3cf9ac1036cf5eb6 |
SeqAttendImgCatFusion | import torch
from torch import nn
class SeqAttendImgFusion(nn.Module):
def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout,
att_scale_factor=1, **kwargs):
super(SeqAttendImgFusion, self).__init__()
self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False)
self.ImgTrans =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Asichurter/MalFusionFSL | SeqAttendImgCatFusion | false | 16,995 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
SeqAttendImgResAttOnlyFusion | import torch
from torch import nn
class SeqAttendImgFusion(nn.Module):
def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout,
att_scale_factor=1, **kwargs):
super(SeqAttendImgFusion, self).__init__()
self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False)
self.ImgTrans =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Asichurter/MalFusionFSL | SeqAttendImgResAttOnlyFusion | false | 16,996 | [
"MIT"
] | 4 | 713bf64cc07a3489f42941fd2299837075575ac0 | https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0 |
Conv1d2Score | import torch
import torch.nn as nn
import torch.optim
import torch.utils.data
class Conv1d2Score(nn.Module):
"""Calculate a N*out_dim tensor from N*in_dim*seq_len using nn.Conv1d
Essentially it is a linear layer
Args:
in_dim: int
out_dim: int, usually number of classes
seq_len: int
Shape... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.optim
import torch.utils.data
assert_size_str... | BeautyOfWeb/DeepBio | Conv1d2Score | false | 16,997 | [
"MIT"
] | 5 | 9207357bd3591f67d8e23c7dad217938dcc123ed | https://github.com/BeautyOfWeb/DeepBio/tree/9207357bd3591f67d8e23c7dad217938dcc123ed |
AttentionPool2d | import torch
import torch.nn.functional as F
from torch import nn
class AttentionPool2d(nn.Module):
def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads:
'int', output_dim: 'int'=None):
super().__init__()
self.positional_embedding = nn.Parameter(torch.randn(spacial_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.... | Beximus/ResearchPortfolioCode | AttentionPool2d | false | 16,998 | [
"MIT"
] | 6 | db8343be6bbac361c3f6d01bbb82e458ff40f44e | https://github.com/Beximus/ResearchPortfolioCode/tree/db8343be6bbac361c3f6d01bbb82e458ff40f44e |
CNN_MNIST | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN_MNIST(nn.Module):
def __init__(self, num_channels, num_classes):
super(CNN_MNIST, self).__init__()
self.conv1 = nn.Conv2d(num_channels, 32, 3, stride=1, padding=0)
self.conv2 = nn.Conv2d(32, 64, 3, stride=1, padd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Billy1900/Noise-Adaption-Layer | CNN_MNIST | false | 16,999 | [
"MIT"
] | 5 | 57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8 | https://github.com/Billy1900/Noise-Adaption-Layer/tree/57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8 |
CNN_CIFAR10 | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN_CIFAR10(nn.Module):
def __init__(self, num_channels, num_classes):
super(CNN_CIFAR10, self).__init__()
self.conv1 = nn.Conv2d(num_channels, 32, 3, stride=1, padding=0)
self.conv2 = nn.Conv2d(32, 64, 3, stride=1, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Billy1900/Noise-Adaption-Layer | CNN_CIFAR10 | false | 17,000 | [
"MIT"
] | 5 | 57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8 | https://github.com/Billy1900/Noise-Adaption-Layer/tree/57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8 |
Triangle_transform | import torch
import torch.nn as nn
class Triangle_transform(nn.Module):
def __init__(self, output_dim):
"""
output dim is the number of t parameters in the triangle point transformation
"""
super().__init__()
self.output_dim = output_dim
self.t_param = torch.nn.Par... | 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
... | BorgwardtLab/TOGL | Triangle_transform | false | 17,001 | [
"BSD-3-Clause"
] | 6 | d0c986cf829ca6bbae1a23e5cdab1c99146503cd | https://github.com/BorgwardtLab/TOGL/tree/d0c986cf829ca6bbae1a23e5cdab1c99146503cd |
Replicate_unit1d | import torch
class Replicate_unit1d(torch.nn.Module):
def __init__(self, width, height):
super(Replicate_unit1d, self).__init__()
self.width = width
self.height = height
def forward(self, x):
assert len(x.size()) == 2
batch_num = x.size()[0]
tmp = torch.cat([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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | BlackParure/AI-StarCraft-II | Replicate_unit1d | false | 17,002 | [
"Apache-2.0"
] | 7 | 7feee4addff9881b3c735791f4a43421f813fcfc | https://github.com/BlackParure/AI-StarCraft-II/tree/7feee4addff9881b3c735791f4a43421f813fcfc |
SEModule | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import Sigmoid
from torch.nn import AdaptiveAvgPool2d
from time import *
class SEModule(Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | BillKerman/FaceNetCustomized | SEModule | false | 17,003 | [
"MIT"
] | 4 | 30bb99b62f960034c4aa4206d7dc22de672a997f | https://github.com/BillKerman/FaceNetCustomized/tree/30bb99b62f960034c4aa4206d7dc22de672a997f |
NormedLinear | import torch
import torch.nn.functional as F
import torch.nn as nn
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): The minimal value... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Bin-ze/Food_detection | NormedLinear | false | 17,004 | [
"Apache-2.0"
] | 4 | 1c1a067f12644f2b0289e49aec4637d580722f70 | https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70 |
Chebyshev_GL | from torch.nn import Module
import math
import torch
from torch.nn.modules import Module
from torch.nn.parameter import Parameter
class Chebyshev_GL(Module):
"""
GCN k-hop Layers
x' = Sigma^k-1 (Z^k * w0^k), Z^k= polynomial
"""
def __init__(self, in_features, out_features, k_hop, bias=True):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch.nn.modules import Module
from... | Brain03Yao/M2TGCN | Chebyshev_GL | false | 17,005 | [
"MIT"
] | 6 | 72c65687fa52c618740cd6d1db7366116f68398c | https://github.com/Brain03Yao/M2TGCN/tree/72c65687fa52c618740cd6d1db7366116f68398c |
L2Norm | import torch
import torch.nn as nn
import torch._utils
from math import sqrt as sqrt
from itertools import product as product
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma... | 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
from math import sqrt as sqrt
from it... | BingzheWu/ssd-pytorch | L2Norm | false | 17,006 | [
"MIT"
] | 7 | bc3f1f5473170082e3b01adb1f4e5d4fb7e0077e | https://github.com/BingzheWu/ssd-pytorch/tree/bc3f1f5473170082e3b01adb1f4e5d4fb7e0077e |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self, n_dims, scale=20.0, eps=1e-10):
"""L2 normalization layer.
Args:
n_dims (int): Number of dimensions to be normalized
scale (float, optional): Defaults to 20..
eps (float, optional):... | 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_... | Bin-ze/Food_detection | L2Norm | false | 17,007 | [
"Apache-2.0"
] | 4 | 1c1a067f12644f2b0289e49aec4637d580722f70 | https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70 |
GCN | from torch.nn import Module
import math
import torch
from torch.nn.modules import Module
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
Z = f(X, A) = softmax(A` * ReLU(A` * X * W0)* ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | Brain03Yao/M2TGCN | GCN | false | 17,008 | [
"MIT"
] | 6 | 72c65687fa52c618740cd6d1db7366116f68398c | https://github.com/Brain03Yao/M2TGCN/tree/72c65687fa52c618740cd6d1db7366116f68398c |
Gaussian_transform | import torch
import torch.nn as nn
class Gaussian_transform(nn.Module):
def __init__(self, output_dim):
"""
output dim is the number of t parameters in the Gaussian point transformation
"""
super().__init__()
self.output_dim = output_dim
self.t_param = torch.nn.Par... | 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... | BorgwardtLab/TOGL | Gaussian_transform | false | 17,009 | [
"BSD-3-Clause"
] | 6 | d0c986cf829ca6bbae1a23e5cdab1c99146503cd | https://github.com/BorgwardtLab/TOGL/tree/d0c986cf829ca6bbae1a23e5cdab1c99146503cd |
NormedConv2d | import torch
import torch.nn as nn
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
keep... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Bin-ze/Food_detection | NormedConv2d | false | 17,010 | [
"Apache-2.0"
] | 4 | 1c1a067f12644f2b0289e49aec4637d580722f70 | https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70 |
DoubleConvRelu | import torch
from torch import nn
from torch.nn import functional as F
class DoubleConvRelu(nn.Module):
def __init__(self, in_dec_filters: 'int', out_filters: 'int'):
super().__init__()
self.conv1 = nn.Conv2d(in_dec_filters, out_filters, kernel_size=3,
padding=1, stride=1)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | BloodAxe/Catalyst-CamVid-Segmentation-Example | DoubleConvRelu | false | 17,011 | [
"MIT"
] | 7 | a24ed6301c2f2a97cbd4d5ba4ef2348d7ed1d9f3 | https://github.com/BloodAxe/Catalyst-CamVid-Segmentation-Example/tree/a24ed6301c2f2a97cbd4d5ba4ef2348d7ed1d9f3 |
WeightedView | import torch
import torch.nn as nn
import torch.optim
import torch.utils.data
class WeightedView(nn.Module):
"""Calculate weighted view
Args:
num_groups: int, number of groups (views)
reduce_dimension: bool, default False. If True, reduce dimension dim
dim: default -1. Only used w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.optim
import torch.utils.data
assert_s... | BeautyOfWeb/DeepBio | WeightedView | false | 17,012 | [
"MIT"
] | 5 | 9207357bd3591f67d8e23c7dad217938dcc123ed | https://github.com/BeautyOfWeb/DeepBio/tree/9207357bd3591f67d8e23c7dad217938dcc123ed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.