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
h_sigmoid
import torch import torch.utils.data import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 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 import triton_helpers import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guard...
Ghaust/SSD
h_sigmoid
false
9,114
[ "MIT" ]
0
2bf14a48795d20ad2177f622e84d62b3ff81183f
https://github.com/Ghaust/SSD/tree/2bf14a48795d20ad2177f622e84d62b3ff81183f
RegressionModel
import torch import torch.nn as nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=21, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=( 3, 3), padding=1) self.act1 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
HenryOsborne/Rotation
RegressionModel
false
9,115
[ "Apache-2.0" ]
0
417fa90bcbb2a144f0c1d2ce5d9fc110f6617bf2
https://github.com/HenryOsborne/Rotation/tree/417fa90bcbb2a144f0c1d2ce5d9fc110f6617bf2
GlobalAttentionGeneral
import torch import torch.nn as nn import torch.nn.parallel def conv1x1(in_planes, out_planes, bias=False): """1x1 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, padding=0, bias=bias) class GlobalAttentionGeneral(nn.Module): def __init__(self, idf, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Huy2122k/Project3-AttnGANwCLIP
GlobalAttentionGeneral
false
9,116
[ "MIT" ]
0
3fb8c643bf71599e1606ec468e86373ccde1ed20
https://github.com/Huy2122k/Project3-AttnGANwCLIP/tree/3fb8c643bf71599e1606ec468e86373ccde1ed20
BothContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select 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.triton_helpers import libdevice import torch.nn as ...
ESCM-summarization/ESCM-summary-evaluation
BothContextGate
false
9,117
[ "MIT" ]
0
3780b51f0ed44cbbea3f163a871d875f1e5e9393
https://github.com/ESCM-summarization/ESCM-summary-evaluation/tree/3780b51f0ed44cbbea3f163a871d875f1e5e9393
SourceContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select 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.triton_helpers import libdevice import torch.nn as ...
ESCM-summarization/ESCM-summary-evaluation
SourceContextGate
false
9,118
[ "MIT" ]
0
3780b51f0ed44cbbea3f163a871d875f1e5e9393
https://github.com/ESCM-summarization/ESCM-summary-evaluation/tree/3780b51f0ed44cbbea3f163a871d875f1e5e9393
TargetContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select 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.triton_helpers import libdevice import torch.nn as ...
ESCM-summarization/ESCM-summary-evaluation
TargetContextGate
false
9,119
[ "MIT" ]
0
3780b51f0ed44cbbea3f163a871d875f1e5e9393
https://github.com/ESCM-summarization/ESCM-summary-evaluation/tree/3780b51f0ed44cbbea3f163a871d875f1e5e9393
GlobalAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ESCM-summarization/ESCM-summary-evaluation
GlobalAttention
false
9,120
[ "MIT" ]
0
3780b51f0ed44cbbea3f163a871d875f1e5e9393
https://github.com/ESCM-summarization/ESCM-summary-evaluation/tree/3780b51f0ed44cbbea3f163a871d875f1e5e9393
ContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.cuda import torch.distributed assert_size_str...
ESCM-summarization/ESCM-summary-evaluation
ContextGate
false
9,121
[ "MIT" ]
0
3780b51f0ed44cbbea3f163a871d875f1e5e9393
https://github.com/ESCM-summarization/ESCM-summary-evaluation/tree/3780b51f0ed44cbbea3f163a871d875f1e5e9393
MaxPoolBlock
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super(Block, self).__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Repre...
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...
DevilMayNotCry/My_curl
MaxPoolBlock
false
9,122
[ "BSD-3-Clause" ]
0
a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
https://github.com/DevilMayNotCry/My_curl/tree/a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
GlobalPoolingBlock
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super(Block, self).__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Repre...
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...
DevilMayNotCry/My_curl
GlobalPoolingBlock
false
9,123
[ "BSD-3-Clause" ]
0
a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
https://github.com/DevilMayNotCry/My_curl/tree/a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
AddNorm
import torch import torch.nn.functional as F import torch.nn as nn class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_size self.batch_first = batch_...
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.functional as F import torch.nn as nn assert_size_stride = torc...
JakeForsey/pytorch-forecasting
AddNorm
false
9,124
[ "MIT" ]
0
e5291df3dd8f8d72ecd2b21869f69cebf9456028
https://github.com/JakeForsey/pytorch-forecasting/tree/e5291df3dd8f8d72ecd2b21869f69cebf9456028
h_swish
import torch import torch.utils.data import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class h_swish(nn.Module): def __in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guard...
Ghaust/SSD
h_swish
false
9,125
[ "MIT" ]
0
2bf14a48795d20ad2177f622e84d62b3ff81183f
https://github.com/Ghaust/SSD/tree/2bf14a48795d20ad2177f622e84d62b3ff81183f
ClassificationModel
import torch import torch.nn as nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=21, num_classes=15, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HenryOsborne/Rotation
ClassificationModel
false
9,126
[ "Apache-2.0" ]
0
417fa90bcbb2a144f0c1d2ce5d9fc110f6617bf2
https://github.com/HenryOsborne/Rotation/tree/417fa90bcbb2a144f0c1d2ce5d9fc110f6617bf2
ConvBlock
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super(Block, self).__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Repre...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
DevilMayNotCry/My_curl
ConvBlock
false
9,127
[ "BSD-3-Clause" ]
0
a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
https://github.com/DevilMayNotCry/My_curl/tree/a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
MidNet2
import torch import torch.nn as nn class MidNet2(nn.Module): def forward(self, x_in): """Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor """ x = self.lrelu(self.conv1...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
DevilMayNotCry/My_curl
MidNet2
false
9,128
[ "BSD-3-Clause" ]
0
a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
https://github.com/DevilMayNotCry/My_curl/tree/a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
AffineLayer
import torch import torch.utils.data import torch import torch.nn as nn class AffineLayer(nn.Module): def __init__(self, num_channels, bias=False): super(AffineLayer, self).__init__() weight = torch.FloatTensor(1, num_channels, 1, 1).fill_(1) self.weight = nn.Parameter(weight, requires_gr...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
JeyesHan/DeFRCN_Custom
AffineLayer
false
9,129
[ "MIT" ]
0
6a536408a61bb10a5ef84ce6683b6278e6e01f43
https://github.com/JeyesHan/DeFRCN_Custom/tree/6a536408a61bb10a5ef84ce6683b6278e6e01f43
LR
import torch import torch.nn as nn import torch.utils.data class LR(nn.Module): def __init__(self, feature_nums, output_dim=1): super(LR, self).__init__() self.linear = nn.Linear(feature_nums, output_dim) self.bias = nn.Parameter(torch.zeros((output_dim,))) def forward(self, 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
JiaXingBinggan/LSTM_Project
LR
false
9,130
[ "Apache-2.0" ]
0
9d84fb96951f2f6036cb58e9c839bb879a09cbcc
https://github.com/JiaXingBinggan/LSTM_Project/tree/9d84fb96951f2f6036cb58e9c839bb879a09cbcc
MidNet4
import torch import torch.nn as nn class MidNet4(nn.Module): def forward(self, x_in): """Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor """ x = self.lrelu(self.conv1(x_in)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DevilMayNotCry/My_curl
MidNet4
false
9,131
[ "BSD-3-Clause" ]
0
a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
https://github.com/DevilMayNotCry/My_curl/tree/a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
NetVLAD
import torch import torch.nn as nn import torch.nn.functional as F class NetVLAD(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters, dim, alpha=1.0): """ Args: num_clusters : int The number of clusters dim : int ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Guido27/project_vg
NetVLAD
false
9,132
[ "MIT" ]
0
3322fc355742929f43f3d97204398035645d968c
https://github.com/Guido27/project_vg/tree/3322fc355742929f43f3d97204398035645d968c
LocalNet
import torch import torch.nn as nn class LocalNet(nn.Module): def forward(self, x_in): """Defines a double convolution :param x_in: input convolutional features :returns: convolutional features :rtype: Tensor """ x = self.lrelu(self.conv1(self.refpad(x_in))) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
DevilMayNotCry/My_curl
LocalNet
false
9,133
[ "BSD-3-Clause" ]
0
a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
https://github.com/DevilMayNotCry/My_curl/tree/a8f65a3e58cbdeefb4679aa2f0c3d9d800b67381
TReLU
import torch import torch.nn as nn import torch.nn.functional as F class TReLU(nn.Module): def __init__(self): super(TReLU, self).__init__() self.alpha = nn.Parameter(torch.FloatTensor(1), requires_grad=True) self.alpha.data.fill_(0) def forward(self, x): x = F.relu(x - 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
HenryOsborne/LearningToPaint
TReLU
false
9,134
[ "MIT" ]
0
d8fdf41c8d193b91c78f73b7a092897e846e19eb
https://github.com/HenryOsborne/LearningToPaint/tree/d8fdf41c8d193b91c78f73b7a092897e846e19eb
DCGANGenerator_mnist
import functools import torch import torch.utils.data import torch import torch.nn as nn class DCGANGenerator_mnist(nn.Module): def __init__(self, z_dim, ngf=64, output_nc=1, norm_layer=nn.BatchNorm2d): super(DCGANGenerator_mnist, self).__init__() self.z_dim = z_dim self.ngf = ngf ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 functools im...
Gabriele91/EvolutionaryGAN-pytorch
DCGANGenerator_mnist
false
9,135
[ "MIT" ]
0
993cb13551908727e52aef738f8954072b5b398a
https://github.com/Gabriele91/EvolutionaryGAN-pytorch/tree/993cb13551908727e52aef738f8954072b5b398a
LinearAttentionLayer
import torch import torch.nn as nn import torch.nn.functional as F class LinearAttentionLayer(nn.Module): def __init__(self, input_dim): super().__init__() self.linear = nn.Linear(input_dim, 1) def forward(self, question, question_mask): qtn = question.view(-1, question.shape[-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....
HuyTu7/dl_optimizers
LinearAttentionLayer
false
9,136
[ "MIT" ]
0
245242718324cebcabe657bdbc704aa54ad0b8d2
https://github.com/HuyTu7/dl_optimizers/tree/245242718324cebcabe657bdbc704aa54ad0b8d2
AlignQuestionEmbedding
import torch import torch.nn as nn import torch.nn.functional as F class AlignQuestionEmbedding(nn.Module): def __init__(self, input_dim): super().__init__() self.linear = nn.Linear(input_dim, input_dim) self.relu = nn.ReLU() def forward(self, context, question, question_mask): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HuyTu7/dl_optimizers
AlignQuestionEmbedding
false
9,137
[ "MIT" ]
0
245242718324cebcabe657bdbc704aa54ad0b8d2
https://github.com/HuyTu7/dl_optimizers/tree/245242718324cebcabe657bdbc704aa54ad0b8d2
MergeLayer
import torch class MergeLayer(torch.nn.Module): def __init__(self, dim1, dim2, dim3, dim4): super().__init__() self.fc1 = torch.nn.Linear(dim1 + dim2, dim3) self.fc2 = torch.nn.Linear(dim3, dim4) self.act = torch.nn.ReLU() torch.nn.init.xavier_normal_(self.fc1.weight) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
IDSC-io/vre-tgn
MergeLayer
false
9,138
[ "Apache-2.0" ]
0
46e8327e3befe67003874fa70b384a511523f8f7
https://github.com/IDSC-io/vre-tgn/tree/46e8327e3befe67003874fa70b384a511523f8f7
EqualConvTranspose2d
import torch import torch.nn as nn from math import sqrt import torch.utils.data def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt import torch.utils.data assert_size_...
GuiCamargoX/gans_pytorch
EqualConvTranspose2d
false
9,139
[ "MIT" ]
0
3103184e54ea0d2922fc664a994a912bf61db426
https://github.com/GuiCamargoX/gans_pytorch/tree/3103184e54ea0d2922fc664a994a912bf61db426
MatrixTree
import torch import torch.nn as nn import torch.cuda import torch.distributed class MatrixTree(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :ci...
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.cuda import torch.distributed assert_s...
GarrettNicolai/OpenNMT-py
MatrixTree
false
9,140
[ "MIT" ]
0
9491d900ac1b50fe39da417bacc0b9d610331888
https://github.com/GarrettNicolai/OpenNMT-py/tree/9491d900ac1b50fe39da417bacc0b9d610331888
EqualConv2d
import torch import torch.nn as nn from math import sqrt import torch.utils.data def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt import torch.utils.data assert_size_...
GuiCamargoX/gans_pytorch
EqualConv2d
false
9,141
[ "MIT" ]
0
3103184e54ea0d2922fc664a994a912bf61db426
https://github.com/GuiCamargoX/gans_pytorch/tree/3103184e54ea0d2922fc664a994a912bf61db426
EqualLinear
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data 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 = 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
GuiCamargoX/gans_pytorch
EqualLinear
false
9,142
[ "MIT" ]
0
3103184e54ea0d2922fc664a994a912bf61db426
https://github.com/GuiCamargoX/gans_pytorch/tree/3103184e54ea0d2922fc664a994a912bf61db426
TimeEncode
import torch import numpy as np class TimeEncode(torch.nn.Module): def __init__(self, dimension): super(TimeEncode, self).__init__() self.dimension = dimension self.w = torch.nn.Linear(1, dimension) self.w.weight = torch.nn.Parameter(torch.from_numpy(1 / 10 ** np. lins...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
IDSC-io/vre-tgn
TimeEncode
false
9,143
[ "Apache-2.0" ]
0
46e8327e3befe67003874fa70b384a511523f8f7
https://github.com/IDSC-io/vre-tgn/tree/46e8327e3befe67003874fa70b384a511523f8f7
MLP
import torch class MLP(torch.nn.Module): def __init__(self, dim, drop=0.3): super().__init__() self.fc_1 = torch.nn.Linear(dim, 80) self.fc_2 = torch.nn.Linear(80, 10) self.fc_3 = torch.nn.Linear(10, 1) self.act = torch.nn.ReLU() self.dropout = torch.nn.Dropout(p=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 assert_size_stride = torch._C...
IDSC-io/vre-tgn
MLP
false
9,144
[ "Apache-2.0" ]
0
46e8327e3befe67003874fa70b384a511523f8f7
https://github.com/IDSC-io/vre-tgn/tree/46e8327e3befe67003874fa70b384a511523f8f7
L1Loss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
ChHanXiao/mmdetection
L1Loss
false
9,145
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
BalancedL1Loss
import functools import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
ChHanXiao/mmdetection
BalancedL1Loss
false
9,146
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
GaussianFocalLoss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
ChHanXiao/mmdetection
GaussianFocalLoss
false
9,147
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
SimpleModel
import torch import torch.nn as nn class SimpleModel(nn.Module): def __init__(self): super(SimpleModel, self).__init__() def forward(self, x): return x * 2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
JimmyCai91/tensorboardX
SimpleModel
false
9,148
[ "MIT" ]
0
9bff602008d71f4bbf6e83e99125033629f4ee6f
https://github.com/JimmyCai91/tensorboardX/tree/9bff602008d71f4bbf6e83e99125033629f4ee6f
BasicBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.weight_norm as weightNorm def conv3x3(in_planes, out_planes, stride=1): return weightNorm(nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=True)) class TReLU(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 import triton_helpers from torch._inductor.runtime....
HenryOsborne/LearningToPaint
BasicBlock
false
9,149
[ "MIT" ]
0
d8fdf41c8d193b91c78f73b7a092897e846e19eb
https://github.com/HenryOsborne/LearningToPaint/tree/d8fdf41c8d193b91c78f73b7a092897e846e19eb
VocabGraphConvolution
import math import torch import torch.nn as nn import torch.nn.init as init class VocabGraphConvolution(nn.Module): """Vocabulary GCN module. Params: `voc_dim`: The size of vocabulary graph `num_adj`: The number of the adjacency matrix of Vocabulary graph `hid_dim`: The hidden dimensi...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.init as init assert_size_strid...
JakobVokac/VGCN-BERT
VocabGraphConvolution
false
9,150
[ "MIT" ]
0
f82f1922c0d461c12d43c45bc58b61b92534b99b
https://github.com/JakobVokac/VGCN-BERT/tree/f82f1922c0d461c12d43c45bc58b61b92534b99b
GHMC
import torch import torch.nn.functional as F import torch.nn as nn def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero((labels >= 0) & (labels < label_channels), as_tuple=False).squeeze() if inds.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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ChHanXiao/mmdetection
GHMC
false
9,151
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
DenseCrossEntropy
import torch import torch.nn as nn class DenseCrossEntropy(nn.Module): def forward(self, x, target): x = x.float() target = target.float() logprobs = torch.nn.functional.log_softmax(x, dim=-1) loss = -logprobs * target loss = loss.sum(-1) return loss.mean() def g...
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 ...
Husky95/Google-Landmark-Recognition-2020-3rd-Place-Solution
DenseCrossEntropy
false
9,152
[ "Apache-2.0" ]
0
48806b9e09beabf74e8f96575855dcfa13a4f996
https://github.com/Husky95/Google-Landmark-Recognition-2020-3rd-Place-Solution/tree/48806b9e09beabf74e8f96575855dcfa13a4f996
GE2ELoss
import torch import torch.nn as nn import torch.nn.functional as F def calc_loss(sim_matrix): same_idx = list(range(sim_matrix.size(0))) pos = sim_matrix[same_idx, :, same_idx] neg = (torch.exp(sim_matrix).sum(dim=2) + 1e-06).log_() per_embedding_loss = -1 * (pos - neg) loss = per_embedding_loss.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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
JeffT13/SCOTUS_Speaker_Verification
GE2ELoss
false
9,153
[ "BSD-3-Clause" ]
0
276f52c23fe40d1f55ae77889b202350f3220d1d
https://github.com/JeffT13/SCOTUS_Speaker_Verification/tree/276f52c23fe40d1f55ae77889b202350f3220d1d
MSELoss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import functools import torch.nn.functional as F import torch.nn as nn assert_size_stride...
ChHanXiao/mmdetection
MSELoss
false
9,154
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
LabelwiseLinearOutput
import torch import torch.nn as nn class LabelwiseLinearOutput(nn.Module): """Applies a linear transformation to the incoming data for each label Args: input_size (int): The number of expected features in the input. num_classes (int): Total number of classes. """ def __init__(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
JamesLYC88/LibMultiLabel
LabelwiseLinearOutput
false
9,155
[ "MIT" ]
0
042b76b3564409d916cf735ace617319009ae118
https://github.com/JamesLYC88/LibMultiLabel/tree/042b76b3564409d916cf735ace617319009ae118
GHMR
import torch import torch.nn as nn class GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper `Gradient Harmonized Single-stage Detector <https://arxiv.org/abs/1811.05181>`_. Args: mu (float): The parameter for the Authentic Smooth L1 loss. b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ChHanXiao/mmdetection
GHMR
false
9,156
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
ArcMarginProduct_subcenter
import math import torch import torch.nn as nn import torch.nn.functional as F class ArcMarginProduct_subcenter(nn.Module): def __init__(self, in_features, out_features, k=3): super().__init__() self.weight = nn.Parameter(torch.FloatTensor(out_features * k, 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 from torch._inductor.runtime....
Husky95/Google-Landmark-Recognition-2020-3rd-Place-Solution
ArcMarginProduct_subcenter
false
9,157
[ "Apache-2.0" ]
0
48806b9e09beabf74e8f96575855dcfa13a4f996
https://github.com/Husky95/Google-Landmark-Recognition-2020-3rd-Place-Solution/tree/48806b9e09beabf74e8f96575855dcfa13a4f996
maximum_absolute_error
import torch from torch import nn class maximum_absolute_error(nn.Module): def forward(self, yhat, y): return torch.max(torch.abs(torch.sub(y, yhat))) 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 from torch import nn a...
JonasBrusokas/ModelarDB-ext
maximum_absolute_error
false
9,158
[ "Apache-2.0" ]
0
354678994cc5fa2d2264436f1d33f250e11d990d
https://github.com/JonasBrusokas/ModelarDB-ext/tree/354678994cc5fa2d2264436f1d33f250e11d990d
SmoothL1Loss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
ChHanXiao/mmdetection
SmoothL1Loss
false
9,159
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
VarifocalLoss
import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ChHanXiao/mmdetection
VarifocalLoss
false
9,160
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
LabelwiseAttention
import torch import torch.nn.functional as F import torch.nn as nn class LabelwiseAttention(nn.Module): """Applies attention technique to summarize the sequence for each label See `Explainable Prediction of Medical Codes from Clinical Text <https://aclanthology.org/N18-1100.pdf>`_ Args: input_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._inductor.runtime....
JamesLYC88/LibMultiLabel
LabelwiseAttention
false
9,161
[ "MIT" ]
0
042b76b3564409d916cf735ace617319009ae118
https://github.com/JamesLYC88/LibMultiLabel/tree/042b76b3564409d916cf735ace617319009ae118
Psi2QNet
import torch from torch.nn.parameter import Parameter import torch.nn as nn class Psi2QNet(nn.Module): def __init__(self, output_dim, feature_dim): super(Psi2QNet, self).__init__() self.w = Parameter(torch.Tensor(feature_dim)) nn.init.constant_(self.w, 0) self def forward(sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn.parameter import Parameter import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
IanWangg/Multi-Context-RL
Psi2QNet
false
9,162
[ "MIT" ]
0
a268b16c5ad421b35339cb85de5347d4cf56b3dd
https://github.com/IanWangg/Multi-Context-RL/tree/a268b16c5ad421b35339cb85de5347d4cf56b3dd
KeypointRCNNPredictor
import torch import torch.utils.data from torch import nn class KeypointRCNNPredictor(nn.Module): def __init__(self, in_channels, num_keypoints): super(KeypointRCNNPredictor, self).__init__() input_features = in_channels deconv_kernel = 4 self.kps_score_lowres = nn.ConvTranspose2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Jack-XHP/LabPicV2-MaskRCNN
KeypointRCNNPredictor
false
9,163
[ "MIT" ]
0
b0586b2827000c7b7337d5110b2b1fd6185053a8
https://github.com/Jack-XHP/LabPicV2-MaskRCNN/tree/b0586b2827000c7b7337d5110b2b1fd6185053a8
TripletLoss
import torch import torch.nn as nn class TripletLoss(nn.Module): def __init__(self, alpha=0.2): super(TripletLoss, self).__init__() self.alpha = alpha def calc_euclidean(self, x1, x2): return (x1 - x2).pow(2).sum(1) def forward(self, anchor, positive, negative): distance...
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...
Jovian-Dsouza/Avenger_FaceNet
TripletLoss
false
9,164
[ "Apache-2.0" ]
0
e8bdffd017c9c27d4dc0f347f6992f760f1af5db
https://github.com/Jovian-Dsouza/Avenger_FaceNet/tree/e8bdffd017c9c27d4dc0f347f6992f760f1af5db
LinearExcitability
import math import torch from torch import nn from torch.nn.parameter import Parameter def linearExcitability(input, weight, excitability=None, bias=None): """Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`. Shape: - input: :math:`(N, *, in_features)` - we...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn from torch.nn.parameter import Parameter assert...
JosephKJ/continual-learning
LinearExcitability
false
9,165
[ "MIT" ]
0
2e526cc58ab35d76cddc1df46ee421baea89a727
https://github.com/JosephKJ/continual-learning/tree/2e526cc58ab35d76cddc1df46ee421baea89a727
MultiHeadedAttention
import math import torch from typing import Optional from typing import Tuple from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JJoving/wenet
MultiHeadedAttention
false
9,166
[ "Apache-2.0" ]
0
4a2195744dba43fe4fb9ad8d46a2b90a80dbdc4e
https://github.com/JJoving/wenet/tree/4a2195744dba43fe4fb9ad8d46a2b90a80dbdc4e
BaselineTokenCNN
import torch import torch.nn as nn import torch.nn.functional as F class BaselineTokenCNN(nn.Module): def __init__(self, num_classes): super(BaselineTokenCNN, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=4, kernel_size=7) self.pool1 = nn.MaxPool2d(kernel_size=2, str...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Jesse-mk/10617_Project
BaselineTokenCNN
false
9,167
[ "MIT" ]
0
2290e582fddc74f2f2f3e64e25f33a3bef6b1841
https://github.com/Jesse-mk/10617_Project/tree/2290e582fddc74f2f2f3e64e25f33a3bef6b1841
SelfAttention
import torch import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, input_dim): super(SelfAttention, self).__init__() self.pre_pooling_linear = nn.Linear(input_dim, input_dim) self.pooling_linear = nn.Linear(input_dim, 1) def forward(self, x): self.pre_pooli...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
JunKong5/WestBERT
SelfAttention
false
9,168
[ "MIT" ]
0
8e0fc9aca290103698cd08239710193c36b06eff
https://github.com/JunKong5/WestBERT/tree/8e0fc9aca290103698cd08239710193c36b06eff
MultiheadAttention
import torch import torch.nn as nn class MultiheadAttention(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with residual connection, and positional encoding used in DETR is also passed as input. Args: embed_dims (int): The embedding dimens...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ChHanXiao/mmdetection
MultiheadAttention
false
9,169
[ "Apache-2.0" ]
0
324aa5a042857a9b57abe37385e1210709a20d02
https://github.com/ChHanXiao/mmdetection/tree/324aa5a042857a9b57abe37385e1210709a20d02
StyledConv
import math import torch from torch import nn import torch.utils.checkpoint from torch.nn import functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): rest_dim = [1] * (input.ndim - bias.ndim - 1) input = input if input.ndim == 3: return F.leaky_relu(input + bias.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.triton_helpers import libdevice import math from to...
Dokhyam/StyleCLIP
StyledConv
false
9,170
[ "MIT" ]
0
3953c6fda14672762897d3ee16c0458dc848c21d
https://github.com/Dokhyam/StyleCLIP/tree/3953c6fda14672762897d3ee16c0458dc848c21d
DiceLoss
import torch import warnings import numpy as np from torch.nn.modules.loss import _Loss def one_hot(labels, num_classes): """ Converts label image `labels` to a one-hot vector with `num_classes` number of channels as last dimension. """ labels = labels % num_classes y = np.eye(num_classes) one...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
JanSellner/MONAI
DiceLoss
false
9,171
[ "Apache-2.0" ]
0
ff8fa2bae94914030abb1bc0680417fdaa74afd8
https://github.com/JanSellner/MONAI/tree/ff8fa2bae94914030abb1bc0680417fdaa74afd8
FusedLeakyReLU
import torch from torch import nn import torch.utils.checkpoint from torch.nn import functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): rest_dim = [1] * (input.ndim - bias.ndim - 1) input = input if input.ndim == 3: return F.leaky_relu(input + bias.view(1, *rest...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.checkpoint from torch.nn import functional as F assert_size_stride = torch._C._dynamo.guards.assert_...
Dokhyam/StyleCLIP
FusedLeakyReLU
false
9,172
[ "MIT" ]
0
3953c6fda14672762897d3ee16c0458dc848c21d
https://github.com/Dokhyam/StyleCLIP/tree/3953c6fda14672762897d3ee16c0458dc848c21d
PolicyNet
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNet(nn.Module): def __init__(self): super(PolicyNet, self).__init__() self.fc1 = nn.Linear(64, 32) self.fc2 = nn.Linear(32, 16) self.fc3 = nn.Linear(16, 4) def forward(self, x): x = torch.f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Jontahan/kvad
PolicyNet
false
9,173
[ "MIT" ]
0
1b22db801048beb948b34bdd615ebe8630d13d9f
https://github.com/Jontahan/kvad/tree/1b22db801048beb948b34bdd615ebe8630d13d9f
Res
import torch from torch import nn import torch.distributions class Res(nn.Module): def __init__(self, H): super().__init__() self.u1 = nn.Linear(H, H) self.u2 = nn.Linear(H, H) self.v1 = nn.Linear(H, H) self.v2 = nn.Linear(H, H) self.w = nn.Linear(H, H) def fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
JohnReid/pytorch-struct
Res
false
9,174
[ "MIT" ]
0
d9d4dd166f90a012aef6917ff7a14c708ced3477
https://github.com/JohnReid/pytorch-struct/tree/d9d4dd166f90a012aef6917ff7a14c708ced3477
ConvertPointsToHomogeneous
import torch import torch.nn as nn def convert_points_to_homogeneous(points): """Function that converts points from Euclidean to homogeneous space. See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tgm.co...
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...
JudyYe/frankmocap
ConvertPointsToHomogeneous
false
9,175
[ "BSD-3-Clause" ]
0
b6e63f344e852ebdbca0095643b5bc0466370891
https://github.com/JudyYe/frankmocap/tree/b6e63f344e852ebdbca0095643b5bc0466370891
ATLoss
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F class ATLoss(nn.Module): def __init__(self): super().__init__() def forward(self, logits: 'Tensor', labels: 'Tensor') ->float: """ Args: logits: predicted probabilities (shape: bat...
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 Tens...
IgnatovFedor/DeepPavlov
ATLoss
false
9,176
[ "Apache-2.0" ]
0
02ba9c4b2919384c142c170c7f89c65cf05dd426
https://github.com/IgnatovFedor/DeepPavlov/tree/02ba9c4b2919384c142c170c7f89c65cf05dd426
BilinearRanking
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F class BilinearRanking(nn.Module): def __init__(self, n_classes: 'int'=2, emb_size: 'int'=768, block_size: 'int'=8): super().__init__() self.n_classes = n_classes self.emb_size = emb_size ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IgnatovFedor/DeepPavlov
BilinearRanking
false
9,177
[ "Apache-2.0" ]
0
02ba9c4b2919384c142c170c7f89c65cf05dd426
https://github.com/IgnatovFedor/DeepPavlov/tree/02ba9c4b2919384c142c170c7f89c65cf05dd426
ConvertPointsFromHomogeneous
import torch import torch.nn as nn def convert_points_from_homogeneous(points): """Function that converts points from homogeneous to Euclidean space. See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tg...
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...
JudyYe/frankmocap
ConvertPointsFromHomogeneous
false
9,178
[ "BSD-3-Clause" ]
0
b6e63f344e852ebdbca0095643b5bc0466370891
https://github.com/JudyYe/frankmocap/tree/b6e63f344e852ebdbca0095643b5bc0466370891
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamma = nn.Param...
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_...
JieFeng-cse/power-system-rl
LayerNorm
false
9,179
[ "MIT" ]
0
8295d14da83a40c755b8e6a14785c53a238f9a64
https://github.com/JieFeng-cse/power-system-rl/tree/8295d14da83a40c755b8e6a14785c53a238f9a64
UnbalancedLoss
import torch import torch.nn as nn import torch.utils.data class UnbalancedLoss(nn.Module): NUM_LABELS = 2 def __init__(self): super().__init__() self.crit = nn.BCEWithLogitsLoss() def forward(self, logits, label): return self.crit(logits, label) def get_inputs(): return [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, math as tl_math import torc...
Kausta/DeepGlobalRegistration
UnbalancedLoss
false
9,180
[ "MIT" ]
0
4f087d4c775f607e335616e95d8fb28e53d4b823
https://github.com/Kausta/DeepGlobalRegistration/tree/4f087d4c775f607e335616e95d8fb28e53d4b823
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, eps=1e-06): super().__init__() assert isinstance(eps, float) self.eps = eps def forward(self, pred, target, mask=None): pred = pred.contiguous().view(pred.size()[0], -1) target = target.c...
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...
HolyCrap96/mmocr-1
DiceLoss
false
9,181
[ "Apache-2.0" ]
0
c6c4acd39b1c56fec1b87530b2d241fe8af4ceed
https://github.com/HolyCrap96/mmocr-1/tree/c6c4acd39b1c56fec1b87530b2d241fe8af4ceed
RelPositionMultiHeadedAttention
import math import torch from typing import Optional from typing import Tuple from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JJoving/wenet
RelPositionMultiHeadedAttention
false
9,182
[ "Apache-2.0" ]
0
4a2195744dba43fe4fb9ad8d46a2b90a80dbdc4e
https://github.com/JJoving/wenet/tree/4a2195744dba43fe4fb9ad8d46a2b90a80dbdc4e
CNN_2
import torch import torch.nn as nn import torch.nn.functional as F class CNN_2(nn.Module): def __init__(self, input_size, n_feature, output_size): super(CNN_2, self).__init__() self.n_feature = n_feature self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5) self.co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IbrahimEl-Shal/CatDogClassifier
CNN_2
false
9,184
[ "MIT" ]
0
aa6e73b679a181593f8297726da94b70d3b51407
https://github.com/IbrahimEl-Shal/CatDogClassifier/tree/aa6e73b679a181593f8297726da94b70d3b51407
GeneralizedDiceLoss
import torch import warnings import numpy as np from typing import Callable from torch.nn.modules.loss import _Loss def one_hot(labels, num_classes): """ Converts label image `labels` to a one-hot vector with `num_classes` number of channels as last dimension. """ labels = labels % num_classes y =...
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 numpy as np from typi...
JanSellner/MONAI
GeneralizedDiceLoss
false
9,185
[ "Apache-2.0" ]
0
ff8fa2bae94914030abb1bc0680417fdaa74afd8
https://github.com/JanSellner/MONAI/tree/ff8fa2bae94914030abb1bc0680417fdaa74afd8
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super(Critic, self).__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JieFeng-cse/power-system-rl
Critic
false
9,186
[ "MIT" ]
0
8295d14da83a40c755b8e6a14785c53a238f9a64
https://github.com/JieFeng-cse/power-system-rl/tree/8295d14da83a40c755b8e6a14785c53a238f9a64
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=256, fc2_units=128): """Initialize parameters and build model. Params ====== state_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
KailinTong/my-deep-reinforcement-learning
QNetwork
false
9,188
[ "MIT" ]
0
2b284ff9475965303a1c9906c5666064229a90f1
https://github.com/KailinTong/my-deep-reinforcement-learning/tree/2b284ff9475965303a1c9906c5666064229a90f1
ScaledDotProductAttention
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """Scaled Dot-Product Attention Module. This code is adopted from https://github.com/jadore801120/attention-is-all-you-need-pytorch. Args: temperature (float): The scale factor for softm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
HolyCrap96/mmocr-1
ScaledDotProductAttention
false
9,190
[ "Apache-2.0" ]
0
c6c4acd39b1c56fec1b87530b2d241fe8af4ceed
https://github.com/HolyCrap96/mmocr-1/tree/c6c4acd39b1c56fec1b87530b2d241fe8af4ceed
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super(Actor, self).__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JieFeng-cse/power-system-rl
Actor
false
9,191
[ "MIT" ]
0
8295d14da83a40c755b8e6a14785c53a238f9a64
https://github.com/JieFeng-cse/power-system-rl/tree/8295d14da83a40c755b8e6a14785c53a238f9a64
KL_Loss
import torch from torch import nn import torch.nn.functional as F import torch.utils class KL_Loss(nn.Module): def __init__(self, temperature=1): super(KL_Loss, self).__init__() self.T = temperature def forward(self, output_batch, teacher_outputs): output_batch = F.log_softmax(output...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
BlakeDai/FedML-test
KL_Loss
false
9,192
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim, action_dim): super(Critic, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Kelym/TD3
Critic
false
9,194
[ "MIT" ]
0
ea565c9d6f74aeb47b096538274cbd5ffc657de5
https://github.com/Kelym/TD3/tree/ea565c9d6f74aeb47b096538274cbd5ffc657de5
Conv2dDynamicSamePadding
import math import torch from torch import nn import torch.nn.functional as F import torch.utils class Conv2dDynamicSamePadding(nn.Conv2d): """2D Convolutions like TensorFlow, for a dynamic image size. The padding is operated in forward function by calculating dynamically. """ def __init__(self, i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils assert_size_stride = torch._C._dynamo.gu...
BlakeDai/FedML-test
Conv2dDynamicSamePadding
false
9,196
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
LogisticRegression
import torch import torch.utils class LogisticRegression(torch.nn.Module): def __init__(self, input_dim, output_dim): super(LogisticRegression, self).__init__() self.linear = torch.nn.Linear(input_dim, output_dim) def forward(self, x): outputs = torch.sigmoid(self.linear(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 import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
BlakeDai/FedML-test
LogisticRegression
false
9,197
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
MaxPool2dDynamicSamePadding
import math import torch from torch import nn import torch.nn.functional as F import torch.utils class MaxPool2dDynamicSamePadding(nn.MaxPool2d): """2D MaxPooling like TensorFlow's 'SAME' mode, with a dynamic image size. The padding is operated in forward function by calculating dynamically. """ d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import torch.utils assert_size_stride = torch._C._dynamo.guards.asse...
BlakeDai/FedML-test
MaxPool2dDynamicSamePadding
false
9,198
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
Swish
import torch from torch import nn import torch.utils class Swish(nn.Module): def forward(self, x): return x * torch.sigmoid(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
BlakeDai/FedML-test
Swish
false
9,199
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
MemoryEfficientSwish
import torch from torch import nn import torch.utils class SwishImplementation(torch.autograd.Function): @staticmethod def forward(ctx, i): result = i * torch.sigmoid(i) ctx.save_for_backward(i) return result @staticmethod def backward(ctx, grad_output): i = ctx.saved...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
BlakeDai/FedML-test
MemoryEfficientSwish
false
9,200
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
MultiHeadAttn
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_model = d_model self.d_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JingzhaoZhang/transformerxl-noise
MultiHeadAttn
false
9,201
[ "Apache-2.0" ]
0
83b91c505217da2a32b6ca592e01b4a1e941937b
https://github.com/JingzhaoZhang/transformerxl-noise/tree/83b91c505217da2a32b6ca592e01b4a1e941937b
ZeroPad1d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler import torch.distributed class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left ...
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.onnx.operators import torch.optim import torch.optim.lr_scheduler import torch.di...
DCMMC/chineseocr
ZeroPad1d
false
9,202
[ "MIT" ]
0
0b8772615239ea7f212b1ab5bc75183e7e9f16b0
https://github.com/DCMMC/chineseocr/tree/0b8772615239ea7f212b1ab5bc75183e7e9f16b0
MiCrossEntropyLoss
import torch class MiCrossEntropyLoss(torch.nn.Module): def __init__(self): super(MiCrossEntropyLoss, self).__init__() self.ce_loss = torch.nn.CrossEntropyLoss() def forward(self, mi_cls_output, label, **_): return self.ce_loss(mi_cls_output, label).mean() 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._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Jinoh-Cho/Visual-Genome-Image-Inpainting
MiCrossEntropyLoss
false
9,203
[ "MIT" ]
0
f8c43bf2e4a9139d4c35903d0c323b9d8eb54859
https://github.com/Jinoh-Cho/Visual-Genome-Image-Inpainting/tree/f8c43bf2e4a9139d4c35903d0c323b9d8eb54859
Model
import torch from torch import Tensor from torch.functional import Tensor from torch import Tensor from torch import nn class Model(nn.Module): def __init__(self, input_n: 'int', output_n: 'int', hidden_n: 'int' ) ->None: super().__init__() self.input_shape = input_n, self.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.triton_helpers import libdevice, math as tl_math fr...
Kkun84/DifferentialEquation
Model
false
9,204
[ "MIT" ]
0
9da2681366363f15512f09a6aa1c640c56a0a754
https://github.com/Kkun84/DifferentialEquation/tree/9da2681366363f15512f09a6aa1c640c56a0a754
CE_Loss
import torch from torch import nn import torch.nn.functional as F import torch.utils class CE_Loss(nn.Module): def __init__(self, temperature=1): super(CE_Loss, self).__init__() self.T = temperature def forward(self, output_batch, teacher_outputs): output_batch = F.log_softmax(output...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
BlakeDai/FedML-test
CE_Loss
false
9,205
[ "Apache-2.0" ]
0
3cb9a7234f3f0294f3137e4be572153ba7b62f8f
https://github.com/BlakeDai/FedML-test/tree/3cb9a7234f3f0294f3137e4be572153ba7b62f8f
ScaleNorm
import math import torch import torch.nn as nn import torch.nn.parallel class ScaleNorm(nn.Module): """Apply Scale Normalization to input. The ScaleNorm layer first computes the square root of the scale, then computes the matrix/vector norm of the input tensor. The norm value is calculated as `sqrt(scale) / ...
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 math import torch.nn ...
JoseAntonioSiguenza/deepchem
ScaleNorm
false
9,206
[ "MIT" ]
0
05fe1b186ec154e18de9aa1b110e9258dc484e21
https://github.com/JoseAntonioSiguenza/deepchem/tree/05fe1b186ec154e18de9aa1b110e9258dc484e21
UPChannelBAN
import torch import torch.nn.functional as F import torch.nn as nn def xcorr_fast(x, kernel): """group conv2d to calculate cross correlation, fast version """ batch = kernel.size()[0] pk = kernel.view(-1, x.size()[1], kernel.size()[2], kernel.size()[3]) px = x.view(1, -1, x.size()[2], x.size()[3])...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F import torch.nn as nn assert_size_stride = torch...
Edwardsoft/siamban
UPChannelBAN
false
9,207
[ "Apache-2.0" ]
0
f89e70485437fa240bcf4ee4929e3cb6d5211ebc
https://github.com/Edwardsoft/siamban/tree/f89e70485437fa240bcf4ee4929e3cb6d5211ebc
MultiheadAttention
import torch import torch.nn.functional as F from torch import nn import torch.utils.data from torch.nn import Parameter import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class MultiheadAttention(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more deta...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ivan-Dimitrov/ml_systems_code_pruning
MultiheadAttention
false
9,208
[ "BSD-3-Clause" ]
0
54cc9f35a87e52c1fef870b7cb54cb03239d5c96
https://github.com/Ivan-Dimitrov/ml_systems_code_pruning/tree/54cc9f35a87e52c1fef870b7cb54cb03239d5c96
SetConv
import torch from torch import nn import torch.nn.functional as F class SetConv(nn.Module): def __init__(self, sample_feats, predicate_feats, join_feats, flow_feats, hid_units, num_hidden_layers=2): super(SetConv, self).__init__() self.flow_feats = flow_feats self.sample_mlp1 = 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 import nn assert_s...
JonathanRaiman/CEB
SetConv
false
9,209
[ "MIT" ]
0
ec5338dcaa939c5df36a47ea9d0895137b1e1b5e
https://github.com/JonathanRaiman/CEB/tree/ec5338dcaa939c5df36a47ea9d0895137b1e1b5e
Custom_dropout
import torch import torch.nn as nn import torch.nn.parallel class Custom_dropout(nn.Module): """ An implementation for few , Given a task perform a rowise sum of 2-d matrix , you get a zero out the contribution of few of rows in the matrix Given, X a 2-d matrix consisting of row vectors (1-d) x1 , x2 ,..xn....
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
JoseAntonioSiguenza/deepchem
Custom_dropout
false
9,210
[ "MIT" ]
0
05fe1b186ec154e18de9aa1b110e9258dc484e21
https://github.com/JoseAntonioSiguenza/deepchem/tree/05fe1b186ec154e18de9aa1b110e9258dc484e21
TwoLayerCNN
import torch import torch.nn as nn import torch.nn.functional as F class TwoLayerCNN(nn.Module): def __init__(self, C, M, embedding, channel, mtc_input): super(TwoLayerCNN, self).__init__() self.C = C self.M = M self.embedding = embedding self.mtc_input = C if mtc_input el...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
LFhase/string-embed
TwoLayerCNN
false
9,211
[ "MIT" ]
0
da8eb60186fcd26a94734f265f79fa5fc5096f76
https://github.com/LFhase/string-embed/tree/da8eb60186fcd26a94734f265f79fa5fc5096f76
Shifted_softplus
import torch import torch.nn as nn import torch.nn.parallel class Shifted_softplus(nn.Module): """ Performs a Shifter softplus loss, which modifies with a value of log(2) """ def __init__(self): super(Shifted_softplus, self).__init__() self.act = nn.Softplus() self.shift = nn.Para...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.nn.parallel assert_size_str...
JoseAntonioSiguenza/deepchem
Shifted_softplus
false
9,212
[ "MIT" ]
0
05fe1b186ec154e18de9aa1b110e9258dc484e21
https://github.com/JoseAntonioSiguenza/deepchem/tree/05fe1b186ec154e18de9aa1b110e9258dc484e21
GraphConv
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init class MeanAggregator(nn.Module): def forward(self, features, A): x = torch.bmm(A, features) return x class GraphConv(nn.Module): def __init__(self, in_dim, out_dim): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
HolyCrap96/mmocr-1
GraphConv
false
9,213
[ "Apache-2.0" ]
0
c6c4acd39b1c56fec1b87530b2d241fe8af4ceed
https://github.com/HolyCrap96/mmocr-1/tree/c6c4acd39b1c56fec1b87530b2d241fe8af4ceed
CmapPafHead
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn import torch.optim assert_size_stride = ...
KeithStoke/POSE_Test
CmapPafHead
false
9,214
[ "MIT" ]
0
581aaf6f3d4fd50e56aa16c43913292af7d36879
https://github.com/KeithStoke/POSE_Test/tree/581aaf6f3d4fd50e56aa16c43913292af7d36879
Atom_Wise_Convolution
import torch import torch.nn as nn import torch.nn.parallel class Shifted_softplus(nn.Module): """ Performs a Shifter softplus loss, which modifies with a value of log(2) """ def __init__(self): super(Shifted_softplus, self).__init__() self.act = nn.Softplus() self.shift = nn.Para...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
JoseAntonioSiguenza/deepchem
Atom_Wise_Convolution
false
9,215
[ "MIT" ]
0
05fe1b186ec154e18de9aa1b110e9258dc484e21
https://github.com/JoseAntonioSiguenza/deepchem/tree/05fe1b186ec154e18de9aa1b110e9258dc484e21
CrossUnit
import torch from torch import nn from torch.nn import functional class CrossUnit(nn.Module): def __init__(self, input_dim, inner_dim, out_dim) ->None: super().__init__() self.fc_1 = nn.Linear(input_dim, inner_dim) self.fc_2 = nn.Linear(inner_dim, out_dim) self.align = 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 import nn assert_s...
LSTM-Kirigaya/NUAA-guandan
CrossUnit
false
9,216
[ "MIT" ]
0
f6920868649c26536b3dc3fce8ecd1d4f7c755fa
https://github.com/LSTM-Kirigaya/NUAA-guandan/tree/f6920868649c26536b3dc3fce8ecd1d4f7c755fa
RNN
import torch import torch.nn as nn class RNN(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(RNN, self).__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(input_size + hidden_size, hidden_size) self.i2o = nn.Linear(input_size + hidden_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LatifB/char-level-classification
RNN
false
9,217
[ "MIT" ]
0
3d0e21e85571efafe0e26c6f27c5fa258a9503da
https://github.com/LatifB/char-level-classification/tree/3d0e21e85571efafe0e26c6f27c5fa258a9503da
DownConv
import torch import torch.nn as nn import torch.nn.functional as F import torch._utils import torch.optim def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class DownConv(nn.Mo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
HenryOsborne/SemanticSegmentation
DownConv
false
9,218
[ "MIT" ]
0
d41549c3fd22731d7a12cdb1b438f730b0ebfcbc
https://github.com/HenryOsborne/SemanticSegmentation/tree/d41549c3fd22731d7a12cdb1b438f730b0ebfcbc