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
ResBlock
import torch from torch import nn import torch.nn.functional as F class ResBlock(nn.Module): def __init__(self, dim, dropout=0): super(ResBlock, self).__init__() self.dim = dim self.dropout = nn.Dropout(dropout) self.linear1 = nn.Linear(self.dim, self.dim) self.linear2 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JiwanChung/tapm
ResBlock
false
8,388
[ "MIT" ]
14
ec42b139d1c012daccc55f85e67744488d526476
https://github.com/JiwanChung/tapm/tree/ec42b139d1c012daccc55f85e67744488d526476
FeatureEncoder
import torch from torch import nn import torch.nn.functional as F class FeatureEncoder(nn.Module): def __init__(self, video_dim, dim): super(FeatureEncoder, self).__init__() self.linear = nn.Linear(video_dim, dim) def forward(self, feature, h=None): feature = self.linear(feature) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
JiwanChung/tapm
FeatureEncoder
false
8,389
[ "MIT" ]
14
ec42b139d1c012daccc55f85e67744488d526476
https://github.com/JiwanChung/tapm/tree/ec42b139d1c012daccc55f85e67744488d526476
net
import torch import torch.nn as nn import torch.nn.functional as F class net(nn.Module): def __init__(self, input_dim, output_dim): super(net, self).__init__() self.fc1 = nn.Linear(input_dim, 30) self.fc1.weight.data.normal_(0, 1) self.fc2 = nn.Linear(30, 20) self.fc2.weig...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Kernels-K/DDPG-pytorch-
net
false
8,390
[ "MIT" ]
26
9a80a56f52f2232e5bd197521d3d2d388b48c882
https://github.com/Kernels-K/DDPG-pytorch-/tree/9a80a56f52f2232e5bd197521d3d2d388b48c882
GraphConvolution
import torch import torch.nn as nn class GraphConvolution(nn.Module): def __init__(self, in_dim, out_dim): super(GraphConvolution, self).__init__() self.relu = nn.LeakyReLU(0.2) self.weight = nn.Conv1d(in_dim, out_dim, 1) def forward(self, adj, nodes): nodes = torch.matmul(no...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Kanaricc/TDRG
GraphConvolution
false
8,391
[ "Apache-2.0" ]
16
91416976c8887877775f516ebee60469449e7e5f
https://github.com/Kanaricc/TDRG/tree/91416976c8887877775f516ebee60469449e7e5f
ANet
import torch import torch.nn as nn import torch.nn.functional as F class ANet(nn.Module): def __init__(self, s_dim, a_dim): super(ANet, self).__init__() self.fc1 = nn.Linear(s_dim, 30) self.fc1.weight.data.normal_(0, 0.1) self.out = nn.Linear(30, a_dim) self.out.weight.dat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Kernels-K/DDPG-pytorch-
ANet
false
8,392
[ "MIT" ]
26
9a80a56f52f2232e5bd197521d3d2d388b48c882
https://github.com/Kernels-K/DDPG-pytorch-/tree/9a80a56f52f2232e5bd197521d3d2d388b48c882
DiceLoss
import torch import torch.nn as nn import torch.utils.data def flatten_samples(input_): """ Flattens a tensor or a variable such that the channel axis is first and the sample axis is second. The shapes are transformed as follows: (N, C, H, W) --> (C, N * H * W) (N, C, D, H, W) --> (C, 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
JonasHell/torch-em
DiceLoss
false
8,393
[ "MIT" ]
13
2e008e0cd2f0ea6681581374fce4f9f47b986d55
https://github.com/JonasHell/torch-em/tree/2e008e0cd2f0ea6681581374fce4f9f47b986d55
TopKMaxPooling
import torch import torch.nn as nn class TopKMaxPooling(nn.Module): def __init__(self, kmax=1.0): super(TopKMaxPooling, self).__init__() self.kmax = kmax @staticmethod def get_positive_k(k, n): if k <= 0: return 0 elif k < 1: return round(k * 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Kanaricc/TDRG
TopKMaxPooling
false
8,394
[ "Apache-2.0" ]
16
91416976c8887877775f516ebee60469449e7e5f
https://github.com/Kanaricc/TDRG/tree/91416976c8887877775f516ebee60469449e7e5f
HadamardProduct
import torch import torch.nn as nn class HadamardProduct(nn.Module): def __init__(self, shape): super(HadamardProduct, self).__init__() self.weights = nn.Parameter(torch.rand(shape)) def forward(self, x): return x * self.weights 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
KimUyen/LSTM-BCI-Decoder
HadamardProduct
false
8,395
[ "MIT" ]
38
c7b4bd108335a4d6c7d99c00c263346026186b0b
https://github.com/KimUyen/LSTM-BCI-Decoder/tree/c7b4bd108335a4d6c7d99c00c263346026186b0b
ResNetBottleneck
import torch from torch import nn import torch.nn.functional as F class ResNetBottleneck(nn.Module): def __init__(self, in_channels, out_channels, bottleneck_channels, stride, downsample=None): super(ResNetBottleneck, self).__init__() self.conv1 = nn.Conv2d(in_channels, bottleneck_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
KH-Kyle/rmp_nav
ResNetBottleneck
false
8,396
[ "MIT" ]
30
d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551
https://github.com/KH-Kyle/rmp_nav/tree/d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551
GlobalAttention_text
import torch import torch.nn as nn import torch.nn.parallel class GlobalAttention_text(nn.Module): def __init__(self, idf, cdf): super(GlobalAttention_text, self).__init__() self.conv_context = nn.Conv1d(cdf, idf, kernel_size=1, stride=1, padding=0) self.sm = nn.Softmax() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JoonHong-Kim/T2I_CL
GlobalAttention_text
false
8,397
[ "MIT" ]
35
c52aa73da903d6e4174eeef2663e5bc1163785b1
https://github.com/JoonHong-Kim/T2I_CL/tree/c52aa73da903d6e4174eeef2663e5bc1163785b1
GRUCell
import torch from torch import nn class GRUCell(nn.Module): def __init__(self, input_size, hidden_size, init_scale=1.0, no_weight_init=False): super(GRUCell, self).__init__() self.recurrent = nn.GRUCell(input_size, hidden_size) if not no_weight_init: for name, param 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
KH-Kyle/rmp_nav
GRUCell
false
8,398
[ "MIT" ]
30
d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551
https://github.com/KH-Kyle/rmp_nav/tree/d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551
Fusion
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Fusion(nn.Module): """ Crazy multi-modal fusion: negative squared difference minus relu'd sum """ def __init__(self): super().__init__() def forward(self, x, y): return -(x - y) ** 2 + F....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
KaihuaTang/VCTree-Visual-Question-Answering
Fusion
false
8,399
[ "MIT" ]
31
b6b0a8bdb01d45d36de3bded91db42544ad6a593
https://github.com/KaihuaTang/VCTree-Visual-Question-Answering/tree/b6b0a8bdb01d45d36de3bded91db42544ad6a593
CommandEmbedding
import torch from torch import Tensor from torch import nn class CommandEmbedding(nn.Module): def __init__(self, input_size, output_size): super().__init__() self.embedding = nn.Linear(input_size, output_size // 2) self.encoding = nn.Parameter(torch.rand(1, 1, output_size // 2)) def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Kaixhin/GUDRL
CommandEmbedding
false
8,400
[ "MIT" ]
26
c13fa605a9ffb4c2932390b0b86e476aec62c142
https://github.com/Kaixhin/GUDRL/tree/c13fa605a9ffb4c2932390b0b86e476aec62c142
BertLayerNormNoVar
import torch import torch.nn as nn class BertLayerNormNoVar(nn.Module): def __init__(self, hidden_size, eps=1e-12): super(BertLayerNormNoVar, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.bias = nn.Parameter(torch.zeros(hidden_size)) self.variance_epsil...
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...
KaidiXu/LiRPA_Verify
BertLayerNormNoVar
false
8,401
[ "BSD-2-Clause" ]
14
71f5327a8abf136bcfb3e1ec07604628abf8126e
https://github.com/KaidiXu/LiRPA_Verify/tree/71f5327a8abf136bcfb3e1ec07604628abf8126e
ConvLSTMCell
import torch import torch.nn as nn from torch.autograd import Variable class ConvLSTMCell(nn.Module): def __init__(self, input_channels, hidden_channels, kernel_size, bias=True ): super(ConvLSTMCell, self).__init__() assert hidden_channels % 2 == 0 self.input_channels = input_chan...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Kwanss/PCLNet
ConvLSTMCell
false
8,402
[ "MIT" ]
31
d288820975a9daf23eab47c52d7ea6f7dd564725
https://github.com/Kwanss/PCLNet/tree/d288820975a9daf23eab47c52d7ea6f7dd564725
CAMBlock
import torch class CAMBlock(torch.nn.Module): def __init__(self, inplanes, redr, pool='full'): super(CAMBlock, self).__init__() self.planes = inplanes // redr self.poolingavg = torch.nn.AdaptiveAvgPool2d((1, 1)) self.poolingmax = torch.nn.AdaptiveMaxPool2d((1, 1)) self.avg...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Knight825/models-pytorch
CAMBlock
false
8,403
[ "Apache-2.0" ]
16
133559eebb8795d78a32fa44d49408d0c5167ae9
https://github.com/Knight825/models-pytorch/tree/133559eebb8795d78a32fa44d49408d0c5167ae9
Gram
import torch import torch.nn as nn class Gram(nn.Module): def __init__(self): super(Gram, self).__init__() def forward(self, input): a, b, c, d = input.size() feature = input.view(a * b, c * d) gram = torch.mm(feature, feature.t()) gram /= a * b * c * d return...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
L1aoXingyu/neural-transfer
Gram
false
8,404
[ "MIT" ]
45
bed445791d823872d9a40ea8927681d8cc99e8df
https://github.com/L1aoXingyu/neural-transfer/tree/bed445791d823872d9a40ea8927681d8cc99e8df
BiLSTM_Encoder
import torch import torch as T import torch.nn as nn class BiLSTM_Encoder(nn.Module): def __init__(self, D: 'int', hidden_size: 'int', dropout: 'float'): super(BiLSTM_Encoder, self).__init__() self.D = D self.hidden_size = hidden_size self.initial_hidden_f = nn.Parameter(T.randn(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.triton_helpers import libdevice import torch as T i...
JRC1995/BERT-Disaster-Classification-Capsule-Routing
BiLSTM_Encoder
false
8,405
[ "MIT" ]
16
520d2b37af309c95f09bcda321915cffae803086
https://github.com/JRC1995/BERT-Disaster-Classification-Capsule-Routing/tree/520d2b37af309c95f09bcda321915cffae803086
MultiHeadQKVAttention
import math import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def qkv_attention(queries, keys, values, presence=None): """ Transformer-like self-attention. Args: queries: Tensor of shape [B, N, d_k]. keys: Tensor of shape [B, M, d_k]. values: : Tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KohavTal/SCAE_Project
MultiHeadQKVAttention
false
8,406
[ "Apache-2.0" ]
40
bc6d1c3697fcb9327dd96e9657c3299b47cf355e
https://github.com/KohavTal/SCAE_Project/tree/bc6d1c3697fcb9327dd96e9657c3299b47cf355e
MAB
import math import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def qkv_attention(queries, keys, values, presence=None): """ Transformer-like self-attention. Args: queries: Tensor of shape [B, N, d_k]. keys: Tensor of shape [B, M, d_k]. values: : Tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KohavTal/SCAE_Project
MAB
false
8,407
[ "Apache-2.0" ]
40
bc6d1c3697fcb9327dd96e9657c3299b47cf355e
https://github.com/KohavTal/SCAE_Project/tree/bc6d1c3697fcb9327dd96e9657c3299b47cf355e
ConditionalLayerNorm
import torch from sklearn.metrics import * from torch import nn class ConditionalLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-06): super(ConditionalLayerNorm, self).__init__() self.eps = eps self.gamma_dense = nn.Linear(hidden_size, hidden_size, bias=False) self.be...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 sklearn.metric...
JiaweiSheng/CasEE
ConditionalLayerNorm
false
8,408
[ "MIT" ]
44
af69432baf34d150f4721a4b4119002555758601
https://github.com/JiaweiSheng/CasEE/tree/af69432baf34d150f4721a4b4119002555758601
VisTransformerDecoderLayer
import torch from torch import Tensor from typing import Tuple from typing import Optional import torch.nn as nn class VisTransformerDecoderLayer(nn.TransformerDecoderLayer): def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu', layer_norm_eps=1e-05, batch_first=False, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Kamino666/Video-Captioning-Transformer
VisTransformerDecoderLayer
false
8,409
[ "Apache-2.0" ]
14
06e6c95d9bf11d61f5825be3c640e489521f9934
https://github.com/Kamino666/Video-Captioning-Transformer/tree/06e6c95d9bf11d61f5825be3c640e489521f9934
SAB
import math import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def qkv_attention(queries, keys, values, presence=None): """ Transformer-like self-attention. Args: queries: Tensor of shape [B, N, d_k]. keys: Tensor of shape [B, M, d_k]. values: : Tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KohavTal/SCAE_Project
SAB
false
8,410
[ "Apache-2.0" ]
40
bc6d1c3697fcb9327dd96e9657c3299b47cf355e
https://github.com/KohavTal/SCAE_Project/tree/bc6d1c3697fcb9327dd96e9657c3299b47cf355e
AvgPoolShortCut
import torch from torch import nn from torch.nn import functional as F class AvgPoolShortCut(nn.Module): def __init__(self, stride, out_c, in_c): super(AvgPoolShortCut, self).__init__() self.stride = stride self.out_c = out_c self.in_c = in_c def forward(self, x): if ...
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...
Karthik-Ragunath/DDU
AvgPoolShortCut
false
8,411
[ "MIT" ]
43
b9daae9304bdeb222857884ef8cb3b6b3d004d33
https://github.com/Karthik-Ragunath/DDU/tree/b9daae9304bdeb222857884ef8cb3b6b3d004d33
CNet
import torch import torch.nn as nn import torch.nn.functional as F class CNet(nn.Module): def __init__(self, s_dim, a_dim): super(CNet, self).__init__() self.fcs = nn.Linear(s_dim, 30) self.fcs.weight.data.normal_(0, 0.1) self.fca = nn.Linear(a_dim, 30) self.fca.weight.dat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Kernels-K/DDPG-pytorch-
CNet
false
8,412
[ "MIT" ]
26
9a80a56f52f2232e5bd197521d3d2d388b48c882
https://github.com/Kernels-K/DDPG-pytorch-/tree/9a80a56f52f2232e5bd197521d3d2d388b48c882
HSwish
import torch import torch.nn as nn import torch.nn class HSwish(nn.Module): """ H-Swish activation function from 'Searching for MobileNetV3,' https://arxiv.org/abs/1905.02244. Parameters: ---------- inplace : bool Whether to use inplace version of the module. """ def __init__(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert...
Kthyeon/micronet_neurips_challenge
HSwish
false
8,413
[ "MIT" ]
19
9f71fb752e8fbd5abca07be530f7fb19e164125c
https://github.com/Kthyeon/micronet_neurips_challenge/tree/9f71fb752e8fbd5abca07be530f7fb19e164125c
SAMblock
import torch class SAMblock(torch.nn.Module): def __init__(self, size=7, model='full', outplanes=None): super(SAMblock, self).__init__() self.outplanes = outplanes if self.outplanes is None: self.outplanes = 1 self.model = model self.conv1 = torch.nn.Conv2d(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 assert_size_stride = torch._C...
Knight825/models-pytorch
SAMblock
false
8,414
[ "Apache-2.0" ]
16
133559eebb8795d78a32fa44d49408d0c5167ae9
https://github.com/Knight825/models-pytorch/tree/133559eebb8795d78a32fa44d49408d0c5167ae9
CrossAttention
import torch import torch.nn as nn class CrossAttention(nn.Module): def __init__(self, in_channel=256, ratio=8): super(CrossAttention, self).__init__() self.conv_query = nn.Conv2d(in_channel, in_channel // ratio, kernel_size=1) self.conv_key = nn.Conv2d(in_channel, in_channel ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JosephChenHub/DPANet
CrossAttention
false
8,415
[ "MIT" ]
19
68cf40a405d8c8c6506884079cd0a206d6d58e63
https://github.com/JosephChenHub/DPANet/tree/68cf40a405d8c8c6506884079cd0a206d6d58e63
ISAB
import math import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def qkv_attention(queries, keys, values, presence=None): """ Transformer-like self-attention. Args: queries: Tensor of shape [B, N, d_k]. keys: Tensor of shape [B, M, d_k]. values: : Tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KohavTal/SCAE_Project
ISAB
false
8,416
[ "Apache-2.0" ]
40
bc6d1c3697fcb9327dd96e9657c3299b47cf355e
https://github.com/KohavTal/SCAE_Project/tree/bc6d1c3697fcb9327dd96e9657c3299b47cf355e
PositionWiseFeedForwardNetworks
import torch from torch import nn from torch.nn import functional as F def Linear(in_features, out_features, bias=True): m = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(m.weight) if bias: nn.init.constant_(m.bias, 0.0) return m class PositionWiseFeedForwardNetworks(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...
L-Zhe/FasySeq
PositionWiseFeedForwardNetworks
false
8,417
[ "Apache-2.0" ]
34
2cd2abd290666b1e118d8ad11c973b58ca4f0573
https://github.com/L-Zhe/FasySeq/tree/2cd2abd290666b1e118d8ad11c973b58ca4f0573
SEBlock
import torch class SEBlock(torch.nn.Module): def __init__(self, inplanes, redr, poolflag='avg'): super(SEBlock, self).__init__() if poolflag == 'max': self.pool = torch.nn.AdaptiveMaxPool2d((1, 1)) if poolflag == 'avg': self.pool = torch.nn.AdaptiveAvgPool2d((1, 1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Knight825/models-pytorch
SEBlock
false
8,418
[ "Apache-2.0" ]
16
133559eebb8795d78a32fa44d49408d0c5167ae9
https://github.com/Knight825/models-pytorch/tree/133559eebb8795d78a32fa44d49408d0c5167ae9
FourierEmbedding
import torch from torch import nn class FourierEmbedding(nn.Module): def __init__(self, features, height, width, **kwargs): super().__init__(**kwargs) self.projector = nn.Linear(2, features) self._height = height self._width = width def forward(self, y, x): x_norm = 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.triton_helpers import math as tl_math from torch im...
LS4GAN/uvcgan
FourierEmbedding
false
8,419
[ "BSD-2-Clause" ]
20
376439ae2a9be684ff279ddf634fe137aadc5df5
https://github.com/LS4GAN/uvcgan/tree/376439ae2a9be684ff279ddf634fe137aadc5df5
Critic
import torch import torch.nn as nn class Critic(nn.Module): def __init__(self, state_dim, hidden_dim=64): super(Critic, self).__init__() self.l1 = nn.Linear(state_dim, hidden_dim) self.l2 = nn.Linear(hidden_dim, hidden_dim) self.l3 = nn.Linear(hidden_dim, 1) def forward(self,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
LQNew/LWDRL
Critic
false
8,420
[ "MIT" ]
11
0e4fab077a0cfbd27590b840557f4fda033c74ff
https://github.com/LQNew/LWDRL/tree/0e4fab077a0cfbd27590b840557f4fda033c74ff
PMA
import math import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def qkv_attention(queries, keys, values, presence=None): """ Transformer-like self-attention. Args: queries: Tensor of shape [B, N, d_k]. keys: Tensor of shape [B, M, d_k]. values: : Tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KohavTal/SCAE_Project
PMA
false
8,421
[ "Apache-2.0" ]
40
bc6d1c3697fcb9327dd96e9657c3299b47cf355e
https://github.com/KohavTal/SCAE_Project/tree/bc6d1c3697fcb9327dd96e9657c3299b47cf355e
MeanMap
import torch import torch.nn as nn import torch.autograd class MeanMap(nn.Module): """ Compute vanilla mean on a 4D tensor. This acts as a standard PyTorch layer. The Mean is computed independantly for each batch item at each location x,y Input should be: (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 import torch.nn as nn import torch.autograd assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._d...
LLNL/fastcam
MeanMap
false
8,422
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
SMOEScaleMap
import torch import torch.nn as nn import torch.autograd class SMOEScaleMap(nn.Module): """ Compute SMOE Scale on a 4D tensor. This acts as a standard PyTorch layer. SMOE Scale is computed independantly for each batch item at each location x,y Input should be: ...
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.autograd assert_size_stride = torch._C._dyna...
LLNL/fastcam
SMOEScaleMap
false
8,423
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
EqualConv2d
import torch import torch.nn as nn from math import sqrt 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.name + '_orig') ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynam...
KwonGihyun/DiagonalGAN
EqualConv2d
false
8,424
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
SE
import torch import torch.nn as nn import torch.nn.functional as F class SE(nn.Module): """Squeeze-and-Excitation block.""" def __init__(self, in_planes, se_planes): super(SE, self).__init__() self.se1 = nn.Conv2d(in_planes, se_planes, kernel_size=1, bias=True) self.se2 = nn.Conv2d(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
LIJUNYI95/SuperAdam
SE
false
8,425
[ "MIT" ]
14
00fc8a4d90bd037ccb9b871fbc64482818457b93
https://github.com/LIJUNYI95/SuperAdam/tree/00fc8a4d90bd037ccb9b871fbc64482818457b93
StdMap
import torch import torch.nn as nn import torch.autograd class StdMap(nn.Module): """ Compute vanilla standard deviation on a 4D tensor. This acts as a standard PyTorch layer. Standard Deviation is computed independantly for each batch item at each location x,y Input should ...
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.autograd assert_size_stride = torch._C._dyna...
LLNL/fastcam
StdMap
false
8,426
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
RangeNorm2D
import torch import torch.nn as nn import torch.autograd class RangeNorm2D(nn.Module): """ This will normalize a saliency map to range from 0 to 1 via linear range function. Input and output will be a 3D tensor of size [batch size x height x width]. Input can be any rea...
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.autograd assert_size_stride = torch._C._dynamo.guards....
LLNL/fastcam
RangeNorm2D
false
8,427
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
MaxMap
import torch import torch.nn as nn import torch.autograd class MaxMap(nn.Module): """ Compute vanilla mean on a 4D tensor. This acts as a standard PyTorch layer. The Max is computed independantly for each batch item at each location x,y Input should be: (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.autograd assert_size_stride = torch._C._dynamo.guards....
LLNL/fastcam
MaxMap
false
8,428
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
InfoNCE_loss_vectorized
import torch import torch.nn as nn class InfoNCE_loss_vectorized(nn.Module): """ SimCLR loss: https://github.com/google-research/simclr // https://github.com/sthalles/SimCLR """ def __init__(self, temperature): super(InfoNCE_loss_vectorized, self).__init__() self.temperature = tem...
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...
LIIR-KULeuven/CLDR_CLNER_models
InfoNCE_loss_vectorized
false
8,429
[ "MIT" ]
12
5fe47a988b88a36d0ccf4484aff5ab70c59f39d6
https://github.com/LIIR-KULeuven/CLDR_CLNER_models/tree/5fe47a988b88a36d0ccf4484aff5ab70c59f39d6
ClassificationModel
import torch import torch.nn as nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
LLYXC/OXNet
ClassificationModel
false
8,430
[ "Apache-2.0" ]
13
4fb67a8c42b9158a8e563c4b68a157e4dedd9c66
https://github.com/LLYXC/OXNet/tree/4fb67a8c42b9158a8e563c4b68a157e4dedd9c66
TwoLayerNet
import torch class TwoLayerNet(torch.nn.Module): def __init__(self, D_in, H, D_out): super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) def forward(self, x): h_relu = self.linear1(x).clamp(min=0) y_pred...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
KentonMurray/ProxGradPytorch
TwoLayerNet
false
8,431
[ "MIT" ]
27
c534a49142ac9ec149ca67de24bb0487fde1607b
https://github.com/KentonMurray/ProxGradPytorch/tree/c534a49142ac9ec149ca67de24bb0487fde1607b
DiagonalwiseRefactorization
import torch import numpy as np import torch.nn.parallel import torch.optim import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed def get_mask(in_channels, channels, ks): in_channels = int(in_channels) channels = int(channels) if len(ks) == 1: mask = np.zer...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn.parallel import torch.optim import torch impo...
LaputaDream/region-based-non-local-network
DiagonalwiseRefactorization
false
8,432
[ "MIT" ]
18
98e5fb3d8010e8c5360ac3066fdc06c37106d7dc
https://github.com/LaputaDream/region-based-non-local-network/tree/98e5fb3d8010e8c5360ac3066fdc06c37106d7dc
GroupLinear
import torch import torch.nn as nn import torch.utils.data class GroupLinear(nn.Module): def __init__(self, in_features, out_features, groups, bias=True): super(GroupLinear, self).__init__() self.in_features = in_features self.out_features = out_features self.groups = groups ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Lakonik/EPro-PnP
GroupLinear
false
8,433
[ "Apache-2.0" ]
19
931df847190ce10eddd1dc3e3168ce1a2f295ffa
https://github.com/Lakonik/EPro-PnP/tree/931df847190ce10eddd1dc3e3168ce1a2f295ffa
GammaScaleMap
import torch import torch.nn as nn import torch.autograd class GammaScaleMap(nn.Module): """ Compute Gamma Scale on a 4D tensor (The hard way). This acts as a standard PyTorch layer. Gamma Scale is computed independantly for each batch item at each location x,y Input should ...
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.autograd assert_size_stride...
LLNL/fastcam
GammaScaleMap
false
8,434
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
L2Norm
import torch from math import sqrt as sqrt from itertools import product as product import torch.nn as nn 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 = scale or None ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from math import sqrt as sqrt from itertools import product as product import t...
Kalana304/realtime-action-detection
L2Norm
false
8,435
[ "MIT" ]
26
a40178c749d60c135290c40a8ac658bac253f0d4
https://github.com/Kalana304/realtime-action-detection/tree/a40178c749d60c135290c40a8ac658bac253f0d4
AdaptiveInstanceNorm
import torch import torch.nn as nn from math import sqrt 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.name + '_orig') ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
KwonGihyun/DiagonalGAN
AdaptiveInstanceNorm
false
8,437
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
AdaptiveAttention
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt 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(modul...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynam...
KwonGihyun/DiagonalGAN
AdaptiveAttention
false
8,438
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
ConvTemporalGraphical
import torch import torch.nn as nn class ConvTemporalGraphical(nn.Module): """The basic module for applying a graph convolution. Args: in_channels (int): Number of channels in the input sequence data out_channels (int): Number of channels produced by the convolution kernel_size (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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Levigty/AimCLR
ConvTemporalGraphical
false
8,439
[ "MIT" ]
25
6cd73767f17748792508647355fa324fa63e235d
https://github.com/Levigty/AimCLR/tree/6cd73767f17748792508647355fa324fa63e235d
DropBlockT_1d
import torch import torch.nn as nn class DropBlockT_1d(nn.Module): def __init__(self, keep_prob=0.9): super(DropBlockT_1d, self).__init__() self.keep_prob = keep_prob def forward(self, input, mask): n, c, t, v = input.size() input1 = input.permute(0, 1, 3, 2).contiguous().vie...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Levigty/AimCLR
DropBlockT_1d
false
8,440
[ "MIT" ]
25
6cd73767f17748792508647355fa324fa63e235d
https://github.com/Levigty/AimCLR/tree/6cd73767f17748792508647355fa324fa63e235d
GaussNorm2D
import torch import torch.nn as nn import torch.autograd class GaussNorm2D(nn.Module): """ This will normalize a saliency map to range from 0 to 1 via normal cumulative distribution function. Input and output will be a 3D tensor of size [batch size x height x width]. In...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.autograd assert_size_stride = torch._C._dyna...
LLNL/fastcam
GaussNorm2D
false
8,441
[ "BSD-3-Clause" ]
25
99cefe37528014247319468cf05f54fef259d3bf
https://github.com/LLNL/fastcam/tree/99cefe37528014247319468cf05f54fef259d3bf
FirstNet
import torch import torch.nn as nn import torch.nn.functional as F class FirstNet(nn.Module): def __init__(self): super(FirstNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=64, kernel_size= 3, padding=1, stride=1) self.conv2 = nn.Conv2d(64, 128, 3, pad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Koukyosyumei/AIJack
FirstNet
false
8,442
[ "MIT" ]
24
9545d3828907b54965ede85e0e12cb32eef54294
https://github.com/Koukyosyumei/AIJack/tree/9545d3828907b54965ede85e0e12cb32eef54294
FusedDownsample
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt class FusedDownsample(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, padding=0): super().__init__() weight = torch.randn(out_channel, in_channel, kernel_size, kernel_size) bias =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt assert_size_stride = torch._C._dynam...
KwonGihyun/DiagonalGAN
FusedDownsample
false
8,443
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
AttentionCrossEntropy
import torch import torch.nn as nn import torch.nn.functional as F class AttentionCrossEntropy(nn.Module): def __init__(self): super(AttentionCrossEntropy, self).__init__() def forward(self, input, target): cross_loss = torch.mul(target.float(), F.log_softmax(input, dim=1)) loss = to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
LindgeW/sentiment-analysis-based-on-attention
AttentionCrossEntropy
false
8,444
[ "Apache-2.0" ]
13
82ea37c8ef84eec56082d60001b1179b4c12f416
https://github.com/LindgeW/sentiment-analysis-based-on-attention/tree/82ea37c8ef84eec56082d60001b1179b4c12f416
CausalConv1d
import torch from torch import nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super(CausalConv1d, self).__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
LittleGuoKe/Entity-Concept-enhanced-Few-shot-Relation-Extraction
CausalConv1d
false
8,445
[ "MIT" ]
19
b41386bdc70a3b84731bdbf700ff1ba4eda6675d
https://github.com/LittleGuoKe/Entity-Concept-enhanced-Few-shot-Relation-Extraction/tree/b41386bdc70a3b84731bdbf700ff1ba4eda6675d
MultiHeadAttention
import math import torch from torch import nn from torch.nn import functional as F from numpy import inf from math import inf def Linear(in_features, out_features, bias=True): m = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(m.weight) if bias: nn.init.constant_(m.bias, 0.0) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn from torch.nn import functional as F from numpy...
L-Zhe/FasySeq
MultiHeadAttention
false
8,446
[ "Apache-2.0" ]
34
2cd2abd290666b1e118d8ad11c973b58ca4f0573
https://github.com/L-Zhe/FasySeq/tree/2cd2abd290666b1e118d8ad11c973b58ca4f0573
DenseBlock
import torch from torch import nn from torch.nn import functional as F class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super(CausalConv1d, self).__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
LittleGuoKe/Entity-Concept-enhanced-Few-shot-Relation-Extraction
DenseBlock
false
8,447
[ "MIT" ]
19
b41386bdc70a3b84731bdbf700ff1ba4eda6675d
https://github.com/LittleGuoKe/Entity-Concept-enhanced-Few-shot-Relation-Extraction/tree/b41386bdc70a3b84731bdbf700ff1ba4eda6675d
NoiseInjection
import torch import torch.nn as nn class NoiseInjection(nn.Module): def __init__(self, channel): super().__init__() self.weight = nn.Parameter(torch.zeros(1, channel, 1, 1)) def forward(self, image, noise): return image + self.weight * noise def get_inputs(): return [torch.rand...
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...
KwonGihyun/DiagonalGAN
NoiseInjection
false
8,448
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
SymmetricPad2d
import torch import torch.nn as nn class SymmetricPad2d(nn.Module): """symmetric 0-pad to splited tensors and concat""" def __init__(self, pad=1): super(SymmetricPad2d, self).__init__() self.padding1 = nn.ZeroPad2d((pad, 0, pad, 0)) self.padding2 = nn.ZeroPad2d((pad, 0, 0, pad)) ...
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...
Lee-Gihun/Micronet_GSJ
SymmetricPad2d
false
8,449
[ "MIT" ]
12
72289bb66507b6c3b4d14f2e5916dec718a1b198
https://github.com/Lee-Gihun/Micronet_GSJ/tree/72289bb66507b6c3b4d14f2e5916dec718a1b198
FusedUpsample
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt class FusedUpsample(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, padding=0): super().__init__() weight = torch.randn(in_channel, out_channel, kernel_size, kernel_size) bias = t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt assert_size_stride = torch._C._dynam...
KwonGihyun/DiagonalGAN
FusedUpsample
false
8,450
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
LogitCond
import torch import torch.nn as nn class LogitCond(nn.Module): """ from the softmax outputs, decides whether the samples are above or below threshold. """ def __init__(self, thres=1.0): super(LogitCond, self).__init__() self.thres = thres self.softmax = nn.Softmax(dim=1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Lee-Gihun/Micronet_GSJ
LogitCond
false
8,451
[ "MIT" ]
12
72289bb66507b6c3b4d14f2e5916dec718a1b198
https://github.com/Lee-Gihun/Micronet_GSJ/tree/72289bb66507b6c3b4d14f2e5916dec718a1b198
softCrossEntropy
import torch from torch import nn from torch.nn import functional as F class softCrossEntropy(nn.Module): def __init__(self, reduce=True): super(softCrossEntropy, self).__init__() self.reduce = reduce return def forward(self, inputs, target): """ :param inputs: predic...
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...
Lingkai-Kong/Calibrated-BERT-Fine-Tuning
softCrossEntropy
false
8,452
[ "Apache-2.0" ]
29
34b8dbf1bfb0d1e466621f149622933bfeab1555
https://github.com/Lingkai-Kong/Calibrated-BERT-Fine-Tuning/tree/34b8dbf1bfb0d1e466621f149622933bfeab1555
DropBlock_Ske
import torch import torch.nn as nn class DropBlock_Ske(nn.Module): def __init__(self, num_point=25, keep_prob=0.9): super(DropBlock_Ske, self).__init__() self.keep_prob = keep_prob self.num_point = num_point def forward(self, input, mask): n, _c, _t, _v = input.size() ...
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...
Levigty/AimCLR
DropBlock_Ske
false
8,453
[ "MIT" ]
25
6cd73767f17748792508647355fa324fa63e235d
https://github.com/Levigty/AimCLR/tree/6cd73767f17748792508647355fa324fa63e235d
ImageEncoderV4
import torch from torch import nn import torch.nn.functional as F class ImageEncoderV4(nn.Module): """ Outputs a 5 x 5 x 32 feature map that preserves spatial information. """ def __init__(self, input_channels=3, init_scale=1.0, no_weight_init= False, init_method='ortho', activation='relu'): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
KH-Kyle/rmp_nav
ImageEncoderV4
false
8,454
[ "MIT" ]
30
d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551
https://github.com/KH-Kyle/rmp_nav/tree/d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(FocalLoss, self).__init__() def forward(self, inputs: 'torch.Tensor', targets: 'torch.Tensor', alpha: 'float'=0.5, gamma: 'float'=0.5, smoo...
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...
Latterlig96/DCUnet
FocalLoss
false
8,455
[ "MIT" ]
11
87d1c137a60177d6daf1dfff0483678d5580fda0
https://github.com/Latterlig96/DCUnet/tree/87d1c137a60177d6daf1dfff0483678d5580fda0
DiceBCELoss
import torch import torch.nn as nn import torch.nn.functional as F class DiceBCELoss(nn.Module): def __init__(self, weight=None, size_average=True): super(DiceBCELoss, self).__init__() def forward(self, inputs: 'torch.Tensor', targets: 'torch.Tensor', smooth: 'int'=1): inputs = 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 libdevice, math as tl_math import torc...
Latterlig96/DCUnet
DiceBCELoss
false
8,456
[ "MIT" ]
11
87d1c137a60177d6daf1dfff0483678d5580fda0
https://github.com/Latterlig96/DCUnet/tree/87d1c137a60177d6daf1dfff0483678d5580fda0
ConvTranspose
import torch from typing import Union import torch.nn as nn import torch.nn.functional as F from typing import Tuple def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class ConvTranspose(nn.Module): def __init__(self, input_channels: '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 typing import Union import torch.nn as nn from typing import Tuple assert_s...
Latterlig96/DCUnet
ConvTranspose
false
8,457
[ "MIT" ]
11
87d1c137a60177d6daf1dfff0483678d5580fda0
https://github.com/Latterlig96/DCUnet/tree/87d1c137a60177d6daf1dfff0483678d5580fda0
EqualLinear
import torch import torch.nn as nn from math import sqrt 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.name + '_orig') ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynam...
KwonGihyun/DiagonalGAN
EqualLinear
false
8,458
[ "MIT" ]
13
9e401c00e741d700f85df2c715ee11c1e66e1d1c
https://github.com/KwonGihyun/DiagonalGAN/tree/9e401c00e741d700f85df2c715ee11c1e66e1d1c
AdaptiveBilinear
import torch import torch.nn.functional as F import torch.nn as nn class AdaptiveBilinear(nn.Module): def __init__(self): super(AdaptiveBilinear, self).__init__() def forward(self, x1, x2): """ :param x1: (b, l1, dim1) :param x2: (b, l2, dim2) :return: """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LindgeW/BiaffineNER
AdaptiveBilinear
false
8,459
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
OverHaulLoss
import torch import torch.nn as nn from torch.nn import functional as F class LabelSmoothingLoss(nn.Module): def __init__(self, classes, smoothing=0.0, dim=-1): super(LabelSmoothingLoss, self).__init__() self.confidence = 1.0 - smoothing self.smoothing = smoothing self.cls = class...
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 ...
Lee-Gihun/Micronet_GSJ
OverHaulLoss
false
8,460
[ "MIT" ]
12
72289bb66507b6c3b4d14f2e5916dec718a1b198
https://github.com/Lee-Gihun/Micronet_GSJ/tree/72289bb66507b6c3b4d14f2e5916dec718a1b198
length_evolution
import torch import torch.nn as nn class length_evolution(nn.Module): """ calcaulate the length of evolution curve by the gradient """ def __init__(self, func='l1'): super(length_evolution, self).__init__() self.func = func def forward(self, mask_score, class_weight): gra...
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...
LiWentomng/boxlevelset
length_evolution
false
8,461
[ "Apache-2.0" ]
25
8cc40bf6ae4a343c482c676c72259cc12c29d31c
https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c
evolution_area
import torch import torch.nn as nn class evolution_area(nn.Module): """ calcaulate the area of evolution curve """ def __init__(self): super(evolution_area, self).__init__() def forward(self, mask_score, class_weight): curve_area = torch.sum(class_weight * mask_score) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
LiWentomng/boxlevelset
evolution_area
false
8,462
[ "Apache-2.0" ]
25
8cc40bf6ae4a343c482c676c72259cc12c29d31c
https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c
DotProductAttention
import torch import torch.nn.functional as F import torch.nn as nn class DotProductAttention(nn.Module): def __init__(self, k_dim): super(DotProductAttention, self).__init__() self.scale = 1.0 / k_dim ** 0.5 def forward(self, hn, enc_out, mask=None): """ :param hn: query - rn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LindgeW/BiaffineNER
DotProductAttention
false
8,463
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
Bilinear
import torch import torch.nn as nn class Bilinear(nn.Module): def __init__(self, in_dim1, in_dim2, label_dim=1, use_input_bias=False): super(Bilinear, self).__init__() self.label_dim = label_dim self.use_input_bias = use_input_bias if self.use_input_bias: in_dim1 += 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
LindgeW/BiaffineNER
Bilinear
false
8,464
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
MaxPooling
import torch from typing import Union import torch.nn as nn from typing import Tuple def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class MaxPooling(nn.Module): def __init__(self, input_channels: 'int', kernel_size: 'Tuple[int,...
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 typing import Union import torch.nn as nn from typing import Tuple assert_size_strid...
Latterlig96/DCUnet
MaxPooling
false
8,465
[ "MIT" ]
11
87d1c137a60177d6daf1dfff0483678d5580fda0
https://github.com/Latterlig96/DCUnet/tree/87d1c137a60177d6daf1dfff0483678d5580fda0
FocalTverskyLoss
import torch import torch.nn as nn class FocalTverskyLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(FocalTverskyLoss, self).__init__() def forward(self, inputs: 'torch.Tensor', targets: 'torch.Tensor', smooth: 'int'=1, alpha: 'float'=0.5, beta: 'float'=0.5, 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Latterlig96/DCUnet
FocalTverskyLoss
false
8,466
[ "MIT" ]
11
87d1c137a60177d6daf1dfff0483678d5580fda0
https://github.com/Latterlig96/DCUnet/tree/87d1c137a60177d6daf1dfff0483678d5580fda0
AdditiveAttention
import torch import torch.nn.functional as F import torch.nn as nn class AdditiveAttention(nn.Module): def __init__(self, k_size, v_size, hidden_size=None, bias=True): super(AdditiveAttention, self).__init__() if hidden_size is None: hidden_size = v_size self.W1 = nn.Linear(k_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LindgeW/BiaffineNER
AdditiveAttention
false
8,467
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
DilatedCircularConv
import torch import torch.nn as nn class DilatedCircularConv(nn.Module): def __init__(self, state_dim, out_state_dim=None, n_adj=4, dilation=1): super(DilatedCircularConv, self).__init__() self.n_adj = n_adj self.dilation = dilation out_state_dim = state_dim if out_state_dim is No...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
LiWentomng/boxlevelset
DilatedCircularConv
false
8,468
[ "Apache-2.0" ]
25
8cc40bf6ae4a343c482c676c72259cc12c29d31c
https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c
CrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F def mask_cross_entropy(pred, target, label): num_rois = pred.size()[0] inds = torch.arange(0, num_rois, dtype=torch.long, device=pred.device) pred_slice = pred[inds, label].squeeze(1) return F.binary_cross_entropy_with_logits(pred_slic...
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 ...
LiWentomng/boxlevelset
CrossEntropyLoss
false
8,469
[ "Apache-2.0" ]
25
8cc40bf6ae4a343c482c676c72259cc12c29d31c
https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c
SmoothL1Loss
import torch import torch.nn as nn import torch.nn.functional as F def smooth_l1_loss(pred, target, beta=1.0, reduction='mean'): assert beta > 0 assert pred.size() == target.size() and target.numel() > 0 diff = torch.abs(pred - target) loss = torch.where(diff < beta, 0.5 * diff * diff / beta, diff - 0...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
LiWentomng/boxlevelset
SmoothL1Loss
false
8,470
[ "Apache-2.0" ]
25
8cc40bf6ae4a343c482c676c72259cc12c29d31c
https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c
Biaffine
import torch import torch.nn as nn class Biaffine(nn.Module): def __init__(self, in_features, out_features=1, bias=(True, True)): super(Biaffine, self).__init__() self.in_features = in_features self.out_features = out_features self.bias = bias self.linear_input_size = in_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
LindgeW/BiaffineNER
Biaffine
false
8,471
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
BiaffineScorer
import torch import torch.nn as nn def timestep_dropout(inputs, p=0.5, batch_first=True): """ :param inputs: (bz, time_step, feature_size) :param p: probability p mask out output nodes :param batch_first: default True :return: """ if not batch_first: inputs = inputs.transpose(0, 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.triton_helpers import libdevice import torch.nn as ...
LindgeW/BiaffineNER
BiaffineScorer
false
8,472
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
ILN
import torch import torch.utils.data import torch.utils.data.distributed import torch import torch.nn as nn from torch.nn.parameter import Parameter class ILN(nn.Module): def __init__(self, num_features, eps=1e-05): super(ILN, self).__init__() self.eps = eps self.rho = Parameter(torch.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.triton_helpers import libdevice import torch.utils.data import torch.utils.data.distributed import torch import...
Lornatang/UGATIT_PyTorch
ILN
false
8,473
[ "Apache-2.0" ]
25
03519e4829b85ceee67c031a28d5a9318ac932b5
https://github.com/Lornatang/UGATIT_PyTorch/tree/03519e4829b85ceee67c031a28d5a9318ac932b5
MedianPool2d
import torch import torch.nn.functional as F import torch.nn as nn from torch.nn.modules.utils import _pair from torch.nn.modules.utils import _quadruple class MedianPool2d(nn.Module): """Median pool (usable as median filter when stride=1) module. Args: kernel_size: size of pooling kernel, int or 2-...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn from torch.nn.modules.utils import _pair from torch...
LuckMonkeys/ATSPrivacy
MedianPool2d
false
8,474
[ "MIT" ]
14
6b580942c6b98b6348d313f2bf90202ec19cefce
https://github.com/LuckMonkeys/ATSPrivacy/tree/6b580942c6b98b6348d313f2bf90202ec19cefce
MaskedLanguageModel
import torch import torch.optim.lr_scheduler import torch.nn as nn import torch.optim import torch.onnx.operators class MaskedLanguageModel(nn.Module): """ predicting origin token from masked input sequence n-class classification problem, n-class = vocab_size """ def __init__(self, hidden, vocab_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LogIntelligence/LogADEmpirical
MaskedLanguageModel
false
8,475
[ "MIT" ]
11
48458aee65c1c84466b04dd4092fae79a7f341fd
https://github.com/LogIntelligence/LogADEmpirical/tree/48458aee65c1c84466b04dd4092fae79a7f341fd
ToRGB
from torch.autograd import Function import abc import math import torch from torch import nn import torch.nn.functional as F from collections import abc def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if k.ndim == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.autograd import Function import abc import math from torch import nn ...
LizhenWangT/FaceVerse
ToRGB
false
8,476
[ "BSD-2-Clause", "MIT" ]
20
bb4a5d3e52fb10b34bbe94f055ff637095bf9152
https://github.com/LizhenWangT/FaceVerse/tree/bb4a5d3e52fb10b34bbe94f055ff637095bf9152
HausdorffLoss
import torch import torch.nn as nn class HausdorffLoss(nn.Module): def __init__(self, loss_weight=1.0): super(HausdorffLoss, self).__init__() self.weight = loss_weight def forward(self, set1, set2): """ Compute the Averaged Hausdorff Distance function between two unor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
LiWentomng/boxlevelset
HausdorffLoss
false
8,477
[ "Apache-2.0" ]
25
8cc40bf6ae4a343c482c676c72259cc12c29d31c
https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c
Generator
import torch import torch.optim.lr_scheduler import torch.nn as nn import torch.optim import torch.onnx.operators def masked_softmax(vector: 'torch.Tensor', mask: 'torch.Tensor', dim: 'int' =-1, memory_efficient: 'bool'=False, mask_fill_value: 'float'=-1e+32 ) ->torch.Tensor: """ ``torch.nn.functional...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LogIntelligence/LogADEmpirical
Generator
false
8,478
[ "MIT" ]
11
48458aee65c1c84466b04dd4092fae79a7f341fd
https://github.com/LogIntelligence/LogADEmpirical/tree/48458aee65c1c84466b04dd4092fae79a7f341fd
NextSentencePrediction
import torch import torch.optim.lr_scheduler import torch.nn as nn import torch.optim import torch.onnx.operators class NextSentencePrediction(nn.Module): """ 2-class classification model : is_next, is_not_next """ def __init__(self, hidden): """ :param hidden: BERT model output 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....
LogIntelligence/LogADEmpirical
NextSentencePrediction
false
8,479
[ "MIT" ]
11
48458aee65c1c84466b04dd4092fae79a7f341fd
https://github.com/LogIntelligence/LogADEmpirical/tree/48458aee65c1c84466b04dd4092fae79a7f341fd
FCLayer
import torch from torch import nn class FCLayer(nn.Module): def __init__(self, input_dim, output_dim, dropout_rate=0.0, use_activation=True): super(FCLayer, self).__init__() self.use_activation = use_activation self.dropout = nn.Dropout(dropout_rate) self.linear = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
LostCow/KLUE
FCLayer
false
8,480
[ "MIT" ]
18
73b1b0526cf6b1b6f5ef535b9527d8abe6ca1a77
https://github.com/LostCow/KLUE/tree/73b1b0526cf6b1b6f5ef535b9527d8abe6ca1a77
psi
import torch import torch.nn as nn class psi(nn.Module): def __init__(self, block_size): super(psi, self).__init__() self.block_size = block_size self.block_size_sq = block_size * block_size def inverse(self, input): output = input.permute(0, 2, 3, 1) batch_size, d_he...
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...
LuckMonkeys/ATSPrivacy
psi
false
8,481
[ "MIT" ]
14
6b580942c6b98b6348d313f2bf90202ec19cefce
https://github.com/LuckMonkeys/ATSPrivacy/tree/6b580942c6b98b6348d313f2bf90202ec19cefce
Conv_Blocks
import torch import torch.nn as nn class Conv_Blocks(nn.Module): def __init__(self, input_dim, output_dim, filter_size=3, batch_norm= False, non_lin='tanh', dropout=0.0, first_block=False, last_block= False, skip_connection=False): super(Conv_Blocks, self).__init__() self.skip_con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LuigiFilippoChiara/GoalGAN
Conv_Blocks
false
8,482
[ "MIT" ]
36
11ac7448af7ac8934e6eb47a06c51d92f04dec8c
https://github.com/LuigiFilippoChiara/GoalGAN/tree/11ac7448af7ac8934e6eb47a06c51d92f04dec8c
UpConv_Blocks
import torch import torch.nn as nn class UpConv_Blocks(nn.Module): def __init__(self, input_dim, output_dim, filter=4, padding=1, first_block=False, last_block=False, batch_norm=False, non_lin= 'relu', dropout=0, skip_connection=False): super(UpConv_Blocks, self).__init__() self.B...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
LuigiFilippoChiara/GoalGAN
UpConv_Blocks
false
8,483
[ "MIT" ]
36
11ac7448af7ac8934e6eb47a06c51d92f04dec8c
https://github.com/LuigiFilippoChiara/GoalGAN/tree/11ac7448af7ac8934e6eb47a06c51d92f04dec8c
ScaleDotProductAttention
import torch import torch.nn.functional as F import torch.nn as nn class ScaleDotProductAttention(nn.Module): def __init__(self, k_dim, dropout=0.1): super(ScaleDotProductAttention, self).__init__() self.scale = 1.0 / k_dim ** 0.5 self.dropout = dropout def forward(self, q, k, v, mas...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LindgeW/BiaffineNER
ScaleDotProductAttention
false
8,484
[ "Apache-2.0" ]
13
0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
https://github.com/LindgeW/BiaffineNER/tree/0ae179e9ff731362f6c8ba6d0b24485ad45e8bbf
GRU
import torch import torch.nn as nn class GRU(nn.Module): def __init__(self, outfea): super(GRU, self).__init__() self.ff = nn.Linear(2 * outfea, 2 * outfea) self.zff = nn.Linear(2 * outfea, outfea) self.outfea = outfea def forward(self, x, xh): r, u = torch.split(torc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
LMissher/STGNN
GRU
false
8,485
[ "MIT" ]
26
9c35d994738ad768ca4385273235bd30e994b746
https://github.com/LMissher/STGNN/tree/9c35d994738ad768ca4385273235bd30e994b746
VanillaGenerativeAdversarialLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.utils.data.distributed class VanillaGenerativeAdversarialLoss(nn.Module): """ Loss for `Vanilla Generative Adversarial Network <https://arxiv.org/abs/1406.2661>`_ Args: reduction (str, optional): Spec...
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...
Liuhong99/CST
VanillaGenerativeAdversarialLoss
false
8,486
[ "MIT" ]
20
f6653a4ee7968fa3ba875a182670636f648be783
https://github.com/Liuhong99/CST/tree/f6653a4ee7968fa3ba875a182670636f648be783
SAC
import torch import torch.nn as nn class SAC(nn.Module): def __init__(self, input_channel, out_channel): super(SAC, self).__init__() self.conv_1 = nn.Conv3d(input_channel, out_channel, kernel_size=3, stride=1, padding=1) self.conv_3 = nn.Conv3d(input_channel, out_channel, kern...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Luoxd1996/SCPM-Net
SAC
false
8,487
[ "MIT" ]
26
2039ea5253ec831dcae79c2f0caa6e5d2641a1f9
https://github.com/Luoxd1996/SCPM-Net/tree/2039ea5253ec831dcae79c2f0caa6e5d2641a1f9
GaussianKernel
import torch import torch.nn as nn from typing import Optional import torch.nn.parallel import torch.utils.data import torch.utils.data.distributed class GaussianKernel(nn.Module): """Gaussian Kernel Matrix Gaussian Kernel k is defined by .. math:: k(x_1, x_2) = \\exp \\left( - \\dfrac{\\| x_1 -...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Liuhong99/CST
GaussianKernel
false
8,488
[ "MIT" ]
20
f6653a4ee7968fa3ba875a182670636f648be783
https://github.com/Liuhong99/CST/tree/f6653a4ee7968fa3ba875a182670636f648be783