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
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
QiuhongAnnaWei/IBRNet
MultiHeadAttention
false
14,276
[ "Apache-2.0" ]
254
6c8b68e6d95eae04535ff0906387ec7899f5d5ce
https://github.com/QiuhongAnnaWei/IBRNet/tree/6c8b68e6d95eae04535ff0906387ec7899f5d5ce
MixerBlock
import torch import torch.nn.functional as F from torch import nn class FeedForward(nn.Module): def __init__(self, num_features, expansion_factor, dropout): super().__init__() num_hidden = expansion_factor * num_features self.fc1 = nn.Linear(num_features, num_hidden) self.fc2 = 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.triton_helpers import libdevice import torch.nn.fun...
RAYTRAC3R/mlp-singer
MixerBlock
false
14,277
[ "MIT" ]
82
a68299b943815353fcc177e4873d24d1d0937cfb
https://github.com/RAYTRAC3R/mlp-singer/tree/a68299b943815353fcc177e4873d24d1d0937cfb
GPool
from torch.nn import Module import torch from torch.nn import Sequential from torch.nn import Linear class FullyConnected(torch.nn.Module): def __init__(self, in_features, out_features, bias=True, activation=None): super().__init__() self.linear = torch.nn.Linear(in_features, out_features, bias=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 from torch._inductor.runtime....
RRemixx/DMRDenoise
GPool
false
14,278
[ "MIT" ]
79
026d25f9eaf98fdfd85a67caeb9b49cab71148e9
https://github.com/RRemixx/DMRDenoise/tree/026d25f9eaf98fdfd85a67caeb9b49cab71148e9
Attention
import torch from typing import Tuple from torch import nn class Attention(nn.Module): """ Attention network Parameters ---------- rnn_size : int Size of Bi-LSTM """ def __init__(self, rnn_size: 'int') ->None: super(Attention, self).__init__() self.w = nn.Linear(r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Renovamen/Text-Classification
Attention
false
14,279
[ "MIT" ]
72
4a4aa4001c402ed4371ebaabe1393b27794e5992
https://github.com/Renovamen/Text-Classification/tree/4a4aa4001c402ed4371ebaabe1393b27794e5992
Downsampling
from torch.nn import Module import torch from torch.nn import Sequential from torch.nn import Linear class FullyConnected(torch.nn.Module): def __init__(self, in_features, out_features, bias=True, activation=None): super().__init__() self.linear = torch.nn.Linear(in_features, out_features, bias=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 from torch._inductor.runtime....
RRemixx/DMRDenoise
Downsampling
false
14,280
[ "MIT" ]
79
026d25f9eaf98fdfd85a67caeb9b49cab71148e9
https://github.com/RRemixx/DMRDenoise/tree/026d25f9eaf98fdfd85a67caeb9b49cab71148e9
PositionWiseFeedForward
import torch from torch import nn class PositionWiseFeedForward(nn.Module): """ Position-Wise Feed-Forward Network Parameters ---------- d_model : int Size of word embeddings hidden_size : int Size of position-wise feed forward network dropout : float Dropout ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Renovamen/Text-Classification
PositionWiseFeedForward
false
14,281
[ "MIT" ]
72
4a4aa4001c402ed4371ebaabe1393b27794e5992
https://github.com/Renovamen/Text-Classification/tree/4a4aa4001c402ed4371ebaabe1393b27794e5992
CLSTMCell
import torch import torch.nn as nn from torch.autograd import Variable class CLSTMCell(nn.Module): def __init__(self, input_channels, hidden_channels, kernel_size, bias=True ): super(CLSTMCell, self).__init__() assert hidden_channels % 2 == 0 self.input_channels = input_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Rehan-Ahmar/UNet-Zoo
CLSTMCell
false
14,282
[ "MIT" ]
345
630f9290d487fda828e7118a3d953575b27a2686
https://github.com/Rehan-Ahmar/UNet-Zoo/tree/630f9290d487fda828e7118a3d953575b27a2686
TorchClampOptionMaxMin
import torch class TorchClampOptionMaxMin(torch.nn.Module): def forward(self, x): return torch.clamp(x, min=-0.1, max=0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
PogChamper/torch2trt
TorchClampOptionMaxMin
false
14,283
[ "MIT" ]
3,363
43b12627ec0de4d212efb6d02b07570205085ccc
https://github.com/PogChamper/torch2trt/tree/43b12627ec0de4d212efb6d02b07570205085ccc
RMSEFeaturesLoss
import torch import torch.nn as nn import torch.utils.data def rmseOnFeatures(feature_difference): gt = torch.zeros_like(feature_difference) return torch.nn.functional.mse_loss(feature_difference, gt, size_average=False) class RMSEFeaturesLoss(nn.Module): def __init__(self): super(RMSEF...
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...
RerRayne/learn3d
RMSEFeaturesLoss
false
14,284
[ "MIT" ]
335
83e4ac657c6538fb4cbed6e00b2e3ed6cbf43555
https://github.com/RerRayne/learn3d/tree/83e4ac657c6538fb4cbed6e00b2e3ed6cbf43555
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class PositionwiseFeedForward(nn.Module): """Implements FFN equation.""" def __init__(self, d_model, d_ff, dropout=0.1): super(PositionwiseFeedForward, self).__init__() self.w_1 = nn.Linear(d_model, d_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 import ...
RerRayne/learn3d
PositionwiseFeedForward
false
14,285
[ "MIT" ]
335
83e4ac657c6538fb4cbed6e00b2e3ed6cbf43555
https://github.com/RerRayne/learn3d/tree/83e4ac657c6538fb4cbed6e00b2e3ed6cbf43555
DecoderLayer
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Rajathbharadwaj/algorithmic-efficiency
DecoderLayer
false
14,286
[ "Apache-2.0" ]
49
47d2928836e0574bc54cc3ad58860dd4daf86cce
https://github.com/Rajathbharadwaj/algorithmic-efficiency/tree/47d2928836e0574bc54cc3ad58860dd4daf86cce
ProjectionLoss
import math import torch import torch.nn as nn def get_knn_idx_dist(pos: 'torch.FloatTensor', query: 'torch.FloatTensor', k, offset=0): """ :param pos: (B, N, F) :param query: (B, M, F) :return knn_idx: (B, M, k) """ B, N, F = tuple(pos.size()) M = query.size(1) pos = pos.u...
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 math import tor...
RRemixx/DMRDenoise
ProjectionLoss
false
14,287
[ "MIT" ]
79
026d25f9eaf98fdfd85a67caeb9b49cab71148e9
https://github.com/RRemixx/DMRDenoise/tree/026d25f9eaf98fdfd85a67caeb9b49cab71148e9
Attn
import torch import torch.nn as nn import torch.nn.functional as F class Attn(nn.Module): def __init__(self, hidden_size): super().__init__() self.hidden_size = hidden_size def forward(self, hidden, encoder_output): attn_energies = torch.sum(hidden * encoder_output, dim=2) at...
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 ...
RedisAI/redisai-examples
Attn
false
14,288
[ "MIT" ]
51
c85c755781d4c45443aee0d7d52c306bfda87121
https://github.com/RedisAI/redisai-examples/tree/c85c755781d4c45443aee0d7d52c306bfda87121
EncoderLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
QiuhongAnnaWei/IBRNet
EncoderLayer
false
14,289
[ "Apache-2.0" ]
254
6c8b68e6d95eae04535ff0906387ec7899f5d5ce
https://github.com/QiuhongAnnaWei/IBRNet/tree/6c8b68e6d95eae04535ff0906387ec7899f5d5ce
AsymmetricLoss
import torch import torch.nn as nn class AsymmetricLoss(nn.Module): def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=True): super(AsymmetricLoss, self).__init__() self.gamma_neg = gamma_neg self.gamma_pos = gamma_pos self.cli...
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...
RetroCirce/Zero_Shot_Audio_Source_Separation
AsymmetricLoss
false
14,290
[ "MIT" ]
66
16b5c2cc9f263c6d17894d433a2da31b07788f4d
https://github.com/RetroCirce/Zero_Shot_Audio_Source_Separation/tree/16b5c2cc9f263c6d17894d433a2da31b07788f4d
LayerNorm
import torch from torch import nn import torch.utils.data import torch.optim import torch.distributions class LayerNorm(nn.Module): def __init__(self, channels, eps=0.0001): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.utils.data import torch.optim import torch.di...
Rexiome/NATSpeech
LayerNorm
false
14,291
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
MultiLayeredConv1d
import torch import torch.utils.data import torch.optim import torch.distributions class MultiLayeredConv1d(torch.nn.Module): """Multi-layered conv1d for Transformer block. This is a module of multi-leyered conv1d designed to replace positionwise feed-forward network in Transforner block, which is 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 import torch.utils.data impor...
Rexiome/NATSpeech
MultiLayeredConv1d
false
14,293
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
HighwayNetwork
import torch from torch import nn import torch.nn.functional as F import torch.utils.data import torch.optim import torch.distributions class HighwayNetwork(nn.Module): def __init__(self, size): super().__init__() self.W1 = nn.Linear(size, size) self.W2 = nn.Linear(size, size) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
Rexiome/NATSpeech
HighwayNetwork
false
14,294
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
GramMatrix
import torch import torch.nn as nn import torch.utils.data class GramMatrix(nn.Module): def forward(self, input): b, c, h, w = input.size() F = input.view(b, c, h * w) G = torch.bmm(F, F.transpose(1, 2)) G.div_(h * w) return G def get_inputs(): return [torch.rand([4,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Reytuag/non-stationary_texture_syn
GramMatrix
false
14,295
[ "MIT" ]
351
005d3e4ead3dfa2164b14c5b3bf41cdc15fd3b0b
https://github.com/Reytuag/non-stationary_texture_syn/tree/005d3e4ead3dfa2164b14c5b3bf41cdc15fd3b0b
PreNet
import torch from torch import nn import torch.nn.functional as F import torch.utils.data import torch.optim import torch.distributions class PreNet(nn.Module): def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5): super().__init__() self.fc1 = nn.Linear(in_dims, fc1_dims) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Rexiome/NATSpeech
PreNet
false
14,296
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
SinusoidalPosEmb
import math import torch from torch import nn import torch.utils.data import torch.optim import torch.distributions class SinusoidalPosEmb(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): """ :param x: [B, T] :return: [B, 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.triton_helpers import math as tl_math from torch import nn import torch.utils.data import torch.optim import to...
Rexiome/NATSpeech
SinusoidalPosEmb
false
14,297
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
ScaledDotProductAttention
import torch from torch import nn from typing import Optional class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Parameters ---------- scale : float Scale factor (sqrt(d_k)) dropout : float Dropout """ def __init__(self, scale: 'float', drop...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Renovamen/Text-Classification
ScaledDotProductAttention
false
14,298
[ "MIT" ]
72
4a4aa4001c402ed4371ebaabe1393b27794e5992
https://github.com/Renovamen/Text-Classification/tree/4a4aa4001c402ed4371ebaabe1393b27794e5992
DICELossMultiClass
import torch import torch.nn as nn class DICELossMultiClass(nn.Module): def __init__(self): super(DICELossMultiClass, self).__init__() def forward(self, output, input_mask): num_classes = output.size(1) - 1 dice_eso = 0 for i in range(num_classes): probs = torch.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Rehan-Ahmar/UNet-Zoo
DICELossMultiClass
false
14,299
[ "MIT" ]
345
630f9290d487fda828e7118a3d953575b27a2686
https://github.com/Rehan-Ahmar/UNet-Zoo/tree/630f9290d487fda828e7118a3d953575b27a2686
DICELoss
import torch import torch.nn as nn class DICELoss(nn.Module): def __init__(self): super(DICELoss, self).__init__() def forward(self, output, mask): probs = torch.squeeze(output, 1) mask = torch.squeeze(mask, 1) intersection = probs * mask intersection = torch.sum(inte...
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...
Rehan-Ahmar/UNet-Zoo
DICELoss
false
14,300
[ "MIT" ]
345
630f9290d487fda828e7118a3d953575b27a2686
https://github.com/Rehan-Ahmar/UNet-Zoo/tree/630f9290d487fda828e7118a3d953575b27a2686
ClipGlobalAvgPool2d
import torch import torch.nn as nn import torch.utils.data class FastGlobalAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastGlobalAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_size = x.size() 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
RichardDominik/AIC21-MTMC
ClipGlobalAvgPool2d
false
14,301
[ "MIT" ]
63
f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
https://github.com/RichardDominik/AIC21-MTMC/tree/f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
MultiHeadAttention
import torch from typing import Tuple from torch import nn from typing import Optional class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Parameters ---------- scale : float Scale factor (sqrt(d_k)) dropout : float Dropout """ def __init__(s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Renovamen/Text-Classification
MultiHeadAttention
false
14,302
[ "MIT" ]
72
4a4aa4001c402ed4371ebaabe1393b27794e5992
https://github.com/Renovamen/Text-Classification/tree/4a4aa4001c402ed4371ebaabe1393b27794e5992
GramMSELoss
import torch import torch.nn as nn import torch.utils.data class GramMatrix(nn.Module): def forward(self, input): b, c, h, w = input.size() F = input.view(b, c, h * w) G = torch.bmm(F, F.transpose(1, 2)) G.div_(h * w) return G class GramMSELoss(nn.Module): def forwa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Reytuag/non-stationary_texture_syn
GramMSELoss
false
14,303
[ "MIT" ]
351
005d3e4ead3dfa2164b14c5b3bf41cdc15fd3b0b
https://github.com/Reytuag/non-stationary_texture_syn/tree/005d3e4ead3dfa2164b14c5b3bf41cdc15fd3b0b
EncoderLayer
import torch from typing import Tuple from torch import nn from typing import Optional class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Parameters ---------- scale : float Scale factor (sqrt(d_k)) dropout : float Dropout """ def __init__(s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Renovamen/Text-Classification
EncoderLayer
false
14,304
[ "MIT" ]
72
4a4aa4001c402ed4371ebaabe1393b27794e5992
https://github.com/Renovamen/Text-Classification/tree/4a4aa4001c402ed4371ebaabe1393b27794e5992
LocalSnrLoss
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class LocalSnrLoss(nn.Module): def __init__(self, factor: 'float'=1): super().__init__() self.factor = factor def forward(self, input: 'Tensor', target_lsnr: 'Tensor'): input = input.squee...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Rikorose/DeepFilterNet
LocalSnrLoss
false
14,305
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
FreqUpsample
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class FreqUpsample(nn.Module): def __init__(self, factor: 'int', mode='nearest'): super().__init__() self.f = float(factor) self.mode = mode def forward(self, x: 'Tensor') ->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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Rikorose/DeepFilterNet
FreqUpsample
false
14,306
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
TransformerFFNLayer
import torch from torch import nn import torch.nn.functional as F from torch.nn import Linear import torch.utils.data import torch.optim import torch.distributions def _get_full_incremental_state_key(module_instance, key): module_name = module_instance.__class__.__name__ if not hasattr(module_instance, '_inst...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Rexiome/NATSpeech
TransformerFFNLayer
false
14,307
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
SiSdr
import torch from torch import Tensor from torch import nn class SiSdr(nn.Module): def __init__(self): super().__init__() def forward(self, input: 'Tensor', target: 'Tensor'): eps = torch.finfo(input.dtype).eps t = input.shape[-1] target = target.reshape(-1, t) input ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Rikorose/DeepFilterNet
SiSdr
false
14,308
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
GeneralizedMeanPooling
import torch import torch.nn as nn import torch.utils.data class GeneralizedMeanPooling(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, one gets Max Po...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
RichardDominik/AIC21-MTMC
GeneralizedMeanPooling
false
14,309
[ "MIT" ]
63
f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
https://github.com/RichardDominik/AIC21-MTMC/tree/f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
ResidualBlock
import torch from torch import nn from torch.nn import Linear from math import sqrt from torch.nn import Conv1d import torch.utils.data import torch.optim import torch.distributions class ResidualBlock(nn.Module): def __init__(self, encoder_hidden, residual_channels, dilation): 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.triton_helpers import libdevice from torch import n...
Rexiome/NATSpeech
ResidualBlock
false
14,310
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
GeM
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class GeM(nn.Module): def __init__(self, p=3.0, eps=1e-06, freeze_p=True): super(GeM, self).__init__() self.p = p if freeze_p else Parameter(torch.ones(1) * p) self.eps = eps def forward(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
RichardDominik/AIC21-MTMC
GeM
false
14,311
[ "MIT" ]
63
f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
https://github.com/RichardDominik/AIC21-MTMC/tree/f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
LocallyConnected
import math import torch from torch import nn class LocallyConnected(nn.Module): """ Local linear layer, i.e. Conv1dLocal() with filter size 1. """ def __init__(self, num_linear: 'int', input_features: 'int', output_features: 'int', bias: 'bool'=True): """ Create local linear ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
Rishab26/causalnex
LocallyConnected
false
14,312
[ "Apache-2.0" ]
1,523
127d9324a3d68c1795299c7522f22cdea880f344
https://github.com/Rishab26/causalnex/tree/127d9324a3d68c1795299c7522f22cdea880f344
ComplexMul
import torch from torch import nn class ComplexMul(nn.Module): def forward(self, a, b): re = a[:, :1] * b[:, :1] - a[:, 1:] * b[:, 1:] im = a[:, :1] * b[:, 1:] + a[:, :1] * b[:, 1:] return torch.cat((re, im), dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Rikorose/DeepFilterNet
ComplexMul
false
14,313
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
LocalLinearCF
import math import torch from torch import Tensor from typing import Optional from torch import nn from torch.nn import init from torch.nn.parameter import Parameter class LocalLinearCF(nn.Module): def __init__(self, in_ch: 'int', out_ch: 'int', n_freqs: 'int', bias: 'bool'=True): 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 import math from torch import Tensor from typing import Optional from torch impo...
Rikorose/DeepFilterNet
LocalLinearCF
false
14,314
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
CrossEntropyLoss
import torch import torch.nn.functional as F import torch.nn as nn def _is_long(x): return isinstance(x, torch.LongTensor) or isinstance(x, torch.LongTensor) def onehot(indexes, N=None, ignore_index=None): """ Creates a one-representation of indexes with N possible entries if N is not specified, it ...
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.functi...
RicJM/weighted_c2d
CrossEntropyLoss
false
14,315
[ "MIT" ]
49
38053869b77c1544349c53ba6f3c1325254aa413
https://github.com/RicJM/weighted_c2d/tree/38053869b77c1544349c53ba6f3c1325254aa413
GroupedLinearCF
import math import torch from torch import Tensor from typing import Optional from torch import nn from torch.nn import init from torch.nn.parameter import Parameter class GroupedLinearCF(nn.Module): def __init__(self, in_ch: 'int', out_ch: 'int', n_freqs: 'int', n_groups: 'int', bias: 'bool'=True): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import Tensor from typing import Optional from torch impo...
Rikorose/DeepFilterNet
GroupedLinearCF
false
14,316
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
MagCompression
import torch from torch import Tensor from torch import nn from torch.nn.parameter import Parameter class MagCompression(nn.Module): def __init__(self, n_freqs: 'int', init_value: 'float'=0.3): super().__init__() self.c: 'Tensor' self.register_parameter('c', Parameter(torch.full((n_freqs,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import Tensor from torch import nn from torch.nn.parameter import Pa...
Rikorose/DeepFilterNet
MagCompression
false
14,317
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
DfAlphaLoss
import torch from torch import Tensor from typing import Optional from torch import nn from typing import Final class DfAlphaLoss(nn.Module): """Add a penalty to use DF for very noisy segments. Starting from lsnr_thresh, the penalty is increased and has its maximum at lsnr_min. """ factor: 'Final[flo...
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...
Rikorose/DeepFilterNet
DfAlphaLoss
false
14,319
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
AdaptiveAvgMaxPool2d
import torch import torch.nn as nn import torch.utils.data class FastGlobalAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastGlobalAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_size = x.size() 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
RichardDominik/AIC21-MTMC
AdaptiveAvgMaxPool2d
false
14,320
[ "MIT" ]
63
f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
https://github.com/RichardDominik/AIC21-MTMC/tree/f69f63f9c40e2dc98e98c7af1cebe3d5605307ee
MultiHeadAttention
import math import torch from torch import nn import torch.nn.functional as F import torch.utils.data import torch.optim import torch.distributions def convert_pad_shape(pad_shape): l = pad_shape[::-1] pad_shape = [item for sublist in l for item in sublist] return pad_shape class MultiHeadAttention(nn.M...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Rexiome/NATSpeech
MultiHeadAttention
false
14,321
[ "MIT" ]
561
238165e8cd430531b69c484cabb032c1313ee73b
https://github.com/Rexiome/NATSpeech/tree/238165e8cd430531b69c484cabb032c1313ee73b
WeightedFeatureFusion
import torch import torch.nn as nn class WeightedFeatureFusion(nn.Module): def __init__(self, layers, weight=False): super(WeightedFeatureFusion, self).__init__() self.layers = layers self.weight = weight self.n = len(layers) + 1 if weight: self.w = nn.Paramete...
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...
Royzon/YOLOV4_MCMOT
WeightedFeatureFusion
false
14,322
[ "MIT" ]
94
cd4c8b1b60f9cf809579609caa29d408432845ba
https://github.com/Royzon/YOLOV4_MCMOT/tree/cd4c8b1b60f9cf809579609caa29d408432845ba
ComplexCompression
from torch.autograd import Function import torch from torch import Tensor from typing import Tuple from torch import nn from torch.nn.parameter import Parameter class angle_re_im(Function): """Similar to torch.angle but robustify the gradient for zero magnitude.""" @staticmethod def forward(ctx, re: '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 libdevice, math as tl_math from torch....
Rikorose/DeepFilterNet
ComplexCompression
false
14,324
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
C3D
import logging import torch import torch.nn as nn import torch.nn.parallel import torch.optim class C3D(nn.Module): def __init__(self, pretrained=None, modality='RGB'): super(C3D, self).__init__() self.pretrained = pretrained self.modality = modality inplace = True assert ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 logging import torch.n...
Lill98/mmaction_custom_data
C3D
false
14,325
[ "Apache-2.0" ]
1,929
a174e995b78a936a7c80a1feb884cbfa801af740
https://github.com/Lill98/mmaction_custom_data/tree/a174e995b78a936a7c80a1feb884cbfa801af740
sobel_net
import torch import numpy as np from torch import nn import torch.nn.functional as F class sobel_net(nn.Module): def __init__(self): super().__init__() self.conv_opx = nn.Conv2d(1, 1, 3, bias=False) self.conv_opy = nn.Conv2d(1, 1, 3, bias=False) sobel_kernelx = np.array([[-1, 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 import triton_helpers from torch._inductor.runtime....
Rming/DocTr
sobel_net
false
14,326
[ "MIT" ]
111
e61e3d34f65d1bd70997f2e2e583f640b8779a3c
https://github.com/Rming/DocTr/tree/e61e3d34f65d1bd70997f2e2e583f640b8779a3c
Head
import torch from torch import nn class ResBlock(nn.Module): def __init__(self, channels): super(ResBlock, self).__init__() self.conv1 = nn.Conv2d(channels, channels, kernel_size=5, stride=1, padding=2, bias=False) self.bn1 = nn.InstanceNorm2d(channels) self.relu = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Rming/DocTr
Head
false
14,327
[ "MIT" ]
111
e61e3d34f65d1bd70997f2e2e583f640b8779a3c
https://github.com/Rming/DocTr/tree/e61e3d34f65d1bd70997f2e2e583f640b8779a3c
DistanceNetwork
import torch import torch.nn as nn import torch.utils.checkpoint class DistanceNetwork(nn.Module): def __init__(self, n_feat, p_drop=0.1): super(DistanceNetwork, self).__init__() self.proj_symm = nn.Linear(n_feat, 37 * 2) self.proj_asymm = nn.Linear(n_feat, 37 + 19) self.reset_par...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.checkpoint assert_size_stride = torch._...
RosettaCommons/RFDesign
DistanceNetwork
false
14,328
[ "MIT" ]
45
b404b8b2c57f89c047529c30259aeeb8f6012b61
https://github.com/RosettaCommons/RFDesign/tree/b404b8b2c57f89c047529c30259aeeb8f6012b61
L1_Charbonnier_loss
import torch from torch.nn import init as init from torch.nn.modules.loss import _Loss class L1_Charbonnier_loss(_Loss): """ L1 Charbonnierloss """ def __init__(self, para): super(L1_Charbonnier_loss, self).__init__() self.eps = 0.001 def forward(self, X, Y): diff = torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import init as...
RunqiuBao/Event_ESTRNN
L1_Charbonnier_loss
false
14,329
[ "MIT" ]
180
6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
https://github.com/RunqiuBao/Event_ESTRNN/tree/6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
ResBlock
import torch from torch import nn class ResBlock(nn.Module): def __init__(self, channels): super(ResBlock, self).__init__() self.conv1 = nn.Conv2d(channels, channels, kernel_size=5, stride=1, padding=2, bias=False) self.bn1 = nn.InstanceNorm2d(channels) self.relu = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Rming/DocTr
ResBlock
false
14,330
[ "MIT" ]
111
e61e3d34f65d1bd70997f2e2e583f640b8779a3c
https://github.com/Rming/DocTr/tree/e61e3d34f65d1bd70997f2e2e583f640b8779a3c
EncoderLayer
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Rajathbharadwaj/algorithmic-efficiency
EncoderLayer
false
14,331
[ "Apache-2.0" ]
49
47d2928836e0574bc54cc3ad58860dd4daf86cce
https://github.com/Rajathbharadwaj/algorithmic-efficiency/tree/47d2928836e0574bc54cc3ad58860dd4daf86cce
PSNR
import torch from torch.nn import init as init from torch.nn.modules.loss import _Loss def normalize_reverse(x, centralize=False, normalize=False, val_range=255.0): if normalize: x = x * val_range if centralize: x = x + val_range / 2 return x class PSNR(_Loss): def __init__(self, ce...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import init as...
RunqiuBao/Event_ESTRNN
PSNR
false
14,332
[ "MIT" ]
180
6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
https://github.com/RunqiuBao/Event_ESTRNN/tree/6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
ZeroPad1d
import torch import torch.nn as nn import torch.nn.functional as F from torch import optim as optim import torchvision.transforms.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler import torch.utils.checkpoint class ZeroPad1d(nn.Module): def __...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch import optim as optim import torch.utils.data import torch.onnx.operators import torch.optim import torch.o...
Maria-philna/unilm
ZeroPad1d
false
14,333
[ "MIT" ]
5,129
5550a335c6d2ae5838b1a90e50cb46f81edcd50f
https://github.com/Maria-philna/unilm/tree/5550a335c6d2ae5838b1a90e50cb46f81edcd50f
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...
QiangliangHuang/siamban
UPChannelBAN
false
14,334
[ "Apache-2.0" ]
216
940208cb26f8146f87f7534d1674791dcb62468a
https://github.com/QiangliangHuang/siamban/tree/940208cb26f8146f87f7534d1674791dcb62468a
L1_Charbonnier_loss_color
import torch from torch.nn import init as init from torch.nn.modules.loss import _Loss class L1_Charbonnier_loss_color(_Loss): """ L1 Charbonnierloss color """ def __init__(self, para): super(L1_Charbonnier_loss_color, self).__init__() self.eps = 0.001 def forward(self, X, 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.triton_helpers import libdevice from torch.nn import init as init from torch.nn.modules.loss import _Loss asser...
RunqiuBao/Event_ESTRNN
L1_Charbonnier_loss_color
false
14,335
[ "MIT" ]
180
6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
https://github.com/RunqiuBao/Event_ESTRNN/tree/6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
TVLoss
import torch from torch import nn import torch.utils.data from torchvision.transforms import * class TVLoss(nn.Module): def __init__(self, tv_loss_weight=1): super(TVLoss, self).__init__() self.tv_loss_weight = tv_loss_weight def forward(self, x): batch_size = x.size()[0] h_x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data from torchvision.transforms import * assert_size_stride = torch._C._dynamo.guards.assert_size_s...
RyanMoussouni/iSeeBetter
TVLoss
false
14,336
[ "MIT" ]
327
af193ae0852f8e477fcd6875dce874eb5092a24a
https://github.com/RyanMoussouni/iSeeBetter/tree/af193ae0852f8e477fcd6875dce874eb5092a24a
GCN
import torch import torch.nn as nn 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_variables[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 torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
RuijieJ/pren
GCN
false
14,337
[ "Apache-2.0" ]
64
529d4d3366eb1885001200491d3d171d58028f6c
https://github.com/RuijieJ/pren/tree/529d4d3366eb1885001200491d3d171d58028f6c
PositionalEncoding2D
import torch import torch.nn as nn import torch.utils.checkpoint class PositionalEncoding2D(nn.Module): def __init__(self, d_model, minpos=-32, maxpos=32, p_drop=0.1): super(PositionalEncoding2D, self).__init__() self.minpos = minpos self.maxpos = maxpos self.nbin = abs(minpos) + ...
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.checkpoint assert_size_stride = torch._C._dynamo...
RosettaCommons/RFDesign
PositionalEncoding2D
false
14,338
[ "MIT" ]
45
b404b8b2c57f89c047529c30259aeeb8f6012b61
https://github.com/RosettaCommons/RFDesign/tree/b404b8b2c57f89c047529c30259aeeb8f6012b61
Gradient
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init as init class Gradient(nn.Module): def __init__(self): super(Gradient, self).__init__() kernel_v = [[0, -1, 0], [0, 0, 0], [0, 1, 0]] kernel_h = [[0, 0, 0], [-1, 0, 1], [0, 0, 0]] kernel_h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
RunqiuBao/Event_ESTRNN
Gradient
false
14,339
[ "MIT" ]
180
6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
https://github.com/RunqiuBao/Event_ESTRNN/tree/6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
GELayerv1
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data.distributed class GELayerv1(nn.Module): def __init__(self): super(GELayerv1, self).__init__() self.avg_pool = nn.AvgPool2d(kernel_size=(15, 15), stride=8) self.sigmod = nn.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 import torch.nn as nn import torch.nn.parallel import torch.utils.data.distributed assert...
SSusantAchary/OctaveConv_pytorch
GELayerv1
false
14,340
[ "MIT" ]
633
079f7da29d55c2eeed8985d33f0b2f765d7a469e
https://github.com/SSusantAchary/OctaveConv_pytorch/tree/079f7da29d55c2eeed8985d33f0b2f765d7a469e
MatrixArgMax
import torch import torch.nn as nn import torch.autograd class MatrixArgMax(nn.Module): def __init__(self): super(MatrixArgMax, self).__init__() def forward(self, x): z = torch.argmax(x) return z def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.autograd assert_size_stride = torch._C._dynamo.guards....
RyusukeYamano/nngen
MatrixArgMax
false
14,341
[ "Apache-2.0" ]
207
9ed1f7fb83908794aa94d70287d89545d45fe875
https://github.com/RyusukeYamano/nngen/tree/9ed1f7fb83908794aa94d70287d89545d45fe875
FeedForwardLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint class FeedForwardLayer(nn.Module): def __init__(self, d_model, r_ff, p_drop=0.1): super(FeedForwardLayer, self).__init__() self.norm = nn.LayerNorm(d_model) self.linear1 = nn.Linear(d_model, d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
RosettaCommons/RFDesign
FeedForwardLayer
false
14,342
[ "MIT" ]
45
b404b8b2c57f89c047529c30259aeeb8f6012b61
https://github.com/RosettaCommons/RFDesign/tree/b404b8b2c57f89c047529c30259aeeb8f6012b61
MeanSquared
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.parallel def mean_squared(y, target, mask=None): y = y.softmax(1) loss = F.mse_loss(y, target, reduction='none').mean(1) if mask is not None: loss = mask * loss return loss.mean() class MeanSquared(nn.Module):...
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.functi...
SHI-Labs/Semi-Supervised-Transfer-Learning
MeanSquared
false
14,343
[ "MIT" ]
81
f206750824ffe10f88a2b418b2b671da61b999f6
https://github.com/SHI-Labs/Semi-Supervised-Transfer-Learning/tree/f206750824ffe10f88a2b418b2b671da61b999f6
MatrixReduceMin
import torch import torch.nn as nn import torch.autograd class MatrixReduceMin(nn.Module): def __init__(self): super(MatrixReduceMin, self).__init__() def forward(self, x): z = torch.min(x) return z def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.autograd assert_size_stride = torch._C._dynamo.guards....
RyusukeYamano/nngen
MatrixReduceMin
false
14,344
[ "Apache-2.0" ]
207
9ed1f7fb83908794aa94d70287d89545d45fe875
https://github.com/RyusukeYamano/nngen/tree/9ed1f7fb83908794aa94d70287d89545d45fe875
Upsampler
import math import torch import torch.utils.data from torchvision.transforms import * class ConvBlock(torch.nn.Module): def __init__(self, input_size, output_size, kernel_size=3, stride=1, padding=1, bias=True, activation='prelu', norm=None): super(ConvBlock, self).__init__() self.conv = ...
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 math import torch.utils.data from torchvision.transforms import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
RyanMoussouni/iSeeBetter
Upsampler
false
14,345
[ "MIT" ]
327
af193ae0852f8e477fcd6875dce874eb5092a24a
https://github.com/RyanMoussouni/iSeeBetter/tree/af193ae0852f8e477fcd6875dce874eb5092a24a
UpBlock
import torch import torch.utils.data from torchvision.transforms import * class ConvBlock(torch.nn.Module): def __init__(self, input_size, output_size, kernel_size=3, stride=1, padding=1, bias=True, activation='prelu', norm=None): super(ConvBlock, self).__init__() self.conv = torch.nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torchvision.transforms import * assert_size_stride ...
RyanMoussouni/iSeeBetter
UpBlock
false
14,346
[ "MIT" ]
327
af193ae0852f8e477fcd6875dce874eb5092a24a
https://github.com/RyanMoussouni/iSeeBetter/tree/af193ae0852f8e477fcd6875dce874eb5092a24a
AmdimNCELoss
import torch from torch import nn as nn from torch import optim as optim from math import * def tanh_clip(x, clip_val=10.0): """ soft clip values to the range [-clip_val, +clip_val] """ if clip_val is not None: x_clip = clip_val * torch.tanh(1.0 / clip_val * x) else: x_clip = x ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SNUHDR2018/ConSSL
AmdimNCELoss
false
14,347
[ "MIT" ]
78
c7d406d0224e38895986c8fb7281a189e493c982
https://github.com/SNUHDR2018/ConSSL/tree/c7d406d0224e38895986c8fb7281a189e493c982
GELayerv2
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data.distributed class GELayerv2(nn.Module): def __init__(self): super(GELayerv2, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.sigmod = nn.Sigmoid() def forward(self, x): _b, _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 import torch.nn as nn import torch.nn.parallel import torch.utils.data.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_...
SSusantAchary/OctaveConv_pytorch
GELayerv2
false
14,348
[ "MIT" ]
633
079f7da29d55c2eeed8985d33f0b2f765d7a469e
https://github.com/SSusantAchary/OctaveConv_pytorch/tree/079f7da29d55c2eeed8985d33f0b2f765d7a469e
CrossEntropy
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.parallel def cross_entropy(y, target, mask=None): if len(target.shape) < 2: loss = F.cross_entropy(y, target, reduction='none') else: loss = -(target * F.log_softmax(y, 1)).sum(1) if mask is not None: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
SHI-Labs/Semi-Supervised-Transfer-Learning
CrossEntropy
false
14,349
[ "MIT" ]
81
f206750824ffe10f88a2b418b2b671da61b999f6
https://github.com/SHI-Labs/Semi-Supervised-Transfer-Learning/tree/f206750824ffe10f88a2b418b2b671da61b999f6
MatrixConv2dMultiResblock
import torch import torch.nn as nn import torch.autograd class MatrixConv2dMultiResblock(nn.Module): def __init__(self, weight_shape, stride=1, padding=0, with_batchnorm= False, act_func='ReLU'): super(MatrixConv2dMultiResblock, self).__init__() self.conv1 = nn.Conv2d(weight_shape[3], wei...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
RyusukeYamano/nngen
MatrixConv2dMultiResblock
false
14,350
[ "Apache-2.0" ]
207
9ed1f7fb83908794aa94d70287d89545d45fe875
https://github.com/RyusukeYamano/nngen/tree/9ed1f7fb83908794aa94d70287d89545d45fe875
L1GradientLoss
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init as init from torch.nn.modules.loss import _Loss class Gradient(nn.Module): def __init__(self): super(Gradient, self).__init__() kernel_v = [[0, -1, 0], [0, 0, 0], [0, 1, 0]] kernel_h = [[0, 0, 0],...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
RunqiuBao/Event_ESTRNN
L1GradientLoss
false
14,351
[ "MIT" ]
180
6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
https://github.com/RunqiuBao/Event_ESTRNN/tree/6d156cc42a3a33bd0b4b7c4c4be98f943ff53acb
MatrixConv2dResblock
import torch import torch.nn as nn import torch.autograd class MatrixConv2dResblock(nn.Module): def __init__(self, weight_shape, stride=1, padding=0, with_batchnorm= False, act_func='ReLU'): super(MatrixConv2dResblock, self).__init__() self.conv = nn.Conv2d(weight_shape[3], weight_shape[0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
RyusukeYamano/nngen
MatrixConv2dResblock
false
14,352
[ "Apache-2.0" ]
207
9ed1f7fb83908794aa94d70287d89545d45fe875
https://github.com/RyusukeYamano/nngen/tree/9ed1f7fb83908794aa94d70287d89545d45fe875
MatrixReduceSum
import torch import torch.nn as nn import torch.autograd class MatrixReduceSum(nn.Module): def __init__(self): super(MatrixReduceSum, self).__init__() def forward(self, x): z = torch.sum(x) return z def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.autograd assert_size_stride = torch._C._dynamo.guards....
RyusukeYamano/nngen
MatrixReduceSum
false
14,353
[ "Apache-2.0" ]
207
9ed1f7fb83908794aa94d70287d89545d45fe875
https://github.com/RyusukeYamano/nngen/tree/9ed1f7fb83908794aa94d70287d89545d45fe875
GroupedGRUMS
import torch from torch import Tensor from typing import List from typing import Tuple from torch import nn from functools import partial from torch.nn.parameter import Parameter class GroupedGRULayerMS(nn.Module): def __init__(self, in_ch: 'int', out_ch: 'int', n_freqs: 'int', n_groups: 'int', bias: 'bo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 T...
Rikorose/DeepFilterNet
GroupedGRUMS
false
14,354
[ "ECL-2.0", "Apache-2.0", "MIT" ]
54
afe6bfb53efae70207e18df7ed372c2cfe337fee
https://github.com/Rikorose/DeepFilterNet/tree/afe6bfb53efae70207e18df7ed372c2cfe337fee
eca_layer
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data.distributed class eca_layer(nn.Module): """Constructs a ECA module. Args: channel: Number of channels of the input feature map k_size: Adaptive selection of kernel size """ def __init__(self, channel, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data.distribut...
SSusantAchary/OctaveConv_pytorch
eca_layer
false
14,355
[ "MIT" ]
633
079f7da29d55c2eeed8985d33f0b2f765d7a469e
https://github.com/SSusantAchary/OctaveConv_pytorch/tree/079f7da29d55c2eeed8985d33f0b2f765d7a469e
CustomLoss
import torch import torch.nn as nn class CustomLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(CustomLoss, self).__init__() def forward(self, outputs, targets): gamma = 0.5 C4 = 10 gb_hat = outputs[:, :, :34] rb_hat = outputs[:, :, 34:68] ...
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...
Ryuk17/PercepNet
CustomLoss
false
14,356
[ "BSD-3-Clause" ]
170
94e91f1db242447593098afc1a844b822e154e09
https://github.com/Ryuk17/PercepNet/tree/94e91f1db242447593098afc1a844b822e154e09
Distribution_Loss
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.parallel def compute_kernel(x, y): x_size = x.size(0) y_size = y.size(0) dim = x.size(1) x = x.unsqueeze(1) y = y.unsqueeze(0) tiled_x = x.expand(x_size, y_size, dim) tiled_y = y.expand(x_size, y_size, dim) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
SHI-Labs/Semi-Supervised-Transfer-Learning
Distribution_Loss
false
14,357
[ "MIT" ]
81
f206750824ffe10f88a2b418b2b671da61b999f6
https://github.com/SHI-Labs/Semi-Supervised-Transfer-Learning/tree/f206750824ffe10f88a2b418b2b671da61b999f6
D_DownBlock
import torch import torch.utils.data from torchvision.transforms import * class ConvBlock(torch.nn.Module): def __init__(self, input_size, output_size, kernel_size=3, stride=1, padding=1, bias=True, activation='prelu', norm=None): super(ConvBlock, self).__init__() self.conv = torch.nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torchvision.transforms import * assert_size_stride ...
RyanMoussouni/iSeeBetter
D_DownBlock
false
14,358
[ "MIT" ]
327
af193ae0852f8e477fcd6875dce874eb5092a24a
https://github.com/RyanMoussouni/iSeeBetter/tree/af193ae0852f8e477fcd6875dce874eb5092a24a
FakeRKHSConvNet
import math import torch import numpy as np from torch import nn as nn from torch import optim as optim from math import * class MaybeBatchNorm2d(nn.Module): def __init__(self, n_ftr, affine, use_bn): super(MaybeBatchNorm2d, self).__init__() self.bn = nn.BatchNorm2d(n_ftr, affine=affine) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SNUHDR2018/ConSSL
FakeRKHSConvNet
false
14,359
[ "MIT" ]
78
c7d406d0224e38895986c8fb7281a189e493c982
https://github.com/SNUHDR2018/ConSSL/tree/c7d406d0224e38895986c8fb7281a189e493c982
DownBlock
import torch import torch.utils.data from torchvision.transforms import * class ConvBlock(torch.nn.Module): def __init__(self, input_size, output_size, kernel_size=3, stride=1, padding=1, bias=True, activation='prelu', norm=None): super(ConvBlock, self).__init__() self.conv = torch.nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torchvision.transforms import * assert_size_stride ...
RyanMoussouni/iSeeBetter
DownBlock
false
14,360
[ "MIT" ]
327
af193ae0852f8e477fcd6875dce874eb5092a24a
https://github.com/RyanMoussouni/iSeeBetter/tree/af193ae0852f8e477fcd6875dce874eb5092a24a
DecoderLayer
import torch from torch import nn class Ffn(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Rming/DocTr
DecoderLayer
false
14,361
[ "MIT" ]
111
e61e3d34f65d1bd70997f2e2e583f640b8779a3c
https://github.com/Rming/DocTr/tree/e61e3d34f65d1bd70997f2e2e583f640b8779a3c
FirstOctaveConv
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data.distributed class FirstOctaveConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, alpha=0.5, stride=1, padding=1, dilation=1, groups=1, bias=False): super(FirstOctaveConv, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data.distribut...
SSusantAchary/OctaveConv_pytorch
FirstOctaveConv
false
14,362
[ "MIT" ]
633
079f7da29d55c2eeed8985d33f0b2f765d7a469e
https://github.com/SSusantAchary/OctaveConv_pytorch/tree/079f7da29d55c2eeed8985d33f0b2f765d7a469e
DeNormalize
import torch import torch.nn as nn import torch.utils.cpp_extension class DeNormalize(nn.Module): def __init__(self, mean, std): super().__init__() self.mean = mean self.std = std def forward(self, x): return x.mul(self.std).add(self.mean) def get_inputs(): return [torc...
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.cpp_extension assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = ...
STomoya/animeface
DeNormalize
false
14,363
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
AppendClsToken
import torch import torch.nn as nn from functools import partial import torch.utils.cpp_extension class AppendClsToken(nn.Module): def __init__(self, embed_dim, init_func=partial(nn.init.normal_, std=0.02) ): super().__init__() self.cls_token = nn.Parameter(torch.zeros(1, 1, embed_dim)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from functools import partial import torch.utils.cpp_extension assert_size_stride = torch._C._dynamo.guards.assert_siz...
STomoya/animeface
AppendClsToken
false
14,364
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
UnBlock
import torch import torch.nn as nn import torch.utils.cpp_extension def unblock(tensor): """blocked tensor back to normal""" B, M, N, C = tensor.size() H = W = int(M ** 0.5) patch_size = int(N ** 0.5) tensor = tensor.reshape(B, H, W, patch_size, patch_size, C) tensor = tensor.permute(0, 5, 3, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.cpp_extension assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = ...
STomoya/animeface
UnBlock
false
14,365
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
MiniBatchStd
import torch import torch.nn as nn import torch.utils.cpp_extension class MiniBatchStd(nn.Module): """ minibatch standard deviation """ def forward(self, x): std = torch.std(x).expand(x.shape[0], 1, *x.shape[2:]) return torch.cat([x, std], dim=1) def get_inputs(): return [torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
STomoya/animeface
MiniBatchStd
false
14,366
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
AddPositionEmbed
import torch import torch.nn as nn from functools import partial import torch.utils.cpp_extension class AddPositionEmbed(nn.Module): def __init__(self, size, init_func=partial(nn.init.normal_, std=0.02)): super().__init__() self.pe = nn.Parameter(torch.zeros(size)) init_func(self.pe) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from functools import partial import torch.utils.cpp_extension assert_size_stride = torch._C._dynamo.guards.assert_siz...
STomoya/animeface
AddPositionEmbed
false
14,367
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
MiniBatchStdDev
import torch import torch.nn as nn import torch.utils.cpp_extension class MiniBatchStdDev(nn.Module): """Mini-Batch Standard Deviation""" def __init__(self, group_size: 'int'=4, eps: 'float'=0.0001) ->None: super().__init__() self.group_size = group_size self.eps = eps def forwar...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.cpp_extension assert_size_stride = tor...
STomoya/animeface
MiniBatchStdDev
false
14,368
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
Subspace
import torch import torch.nn as nn import torch.utils.cpp_extension class Subspace(nn.Module): def __init__(self, latent_dim, channels, resolution): super().__init__() self.U = nn.Parameter(torch.empty(latent_dim, channels, resolution, resolution)) nn.init.orthogonal_(self.U) ...
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.cpp_extension assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = ...
STomoya/animeface
Subspace
false
14,369
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
ChannelPool
import torch import torch.nn as nn import torch.nn.functional as F class ChannelPool(nn.MaxPool1d): def forward(self, x): n, c, w, h = x.size() x = x.view(n, c, w * h).permute(0, 2, 1) x = x.contiguous() pooled = F.max_pool1d(x, c, 1) _, _, c = pooled.size() pooled...
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...
Sapio-S/Neural-SLAM
ChannelPool
false
14,370
[ "MIT" ]
171
3a1e429fc54fe5682833bfe541512c8d62c2e2f7
https://github.com/Sapio-S/Neural-SLAM/tree/3a1e429fc54fe5682833bfe541512c8d62c2e2f7
MultiQueryAttention
import torch import torch.nn as nn import torch.utils.cpp_extension class MultiQueryAttention(nn.Module): def __init__(self, dim, latent_dim, num_heads): super().__init__() self.dim = dim self.num_heads = num_heads self.q = nn.Linear(dim, dim, bias=False) self.kv = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
STomoya/animeface
MultiQueryAttention
false
14,371
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
PSNR
import torch import torch.nn as nn import torch.nn.functional as F class PSNR(nn.Module): def __init__(self, max_val=1.0, mode='Y'): super(PSNR, self).__init__() self.max_val = max_val self.mode = mode def forward(self, x, y): if self.mode == 'Y' and x.shape[1] == 3 and y.sha...
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...
S-aiueo32/srntt-pytorch
PSNR
false
14,372
[ "Apache-2.0" ]
88
4ea0aa22a54a2d1b1f19c4a43596a693b9e7c067
https://github.com/S-aiueo32/srntt-pytorch/tree/4ea0aa22a54a2d1b1f19c4a43596a693b9e7c067
AdaptiveInstanceNorm
import math import torch import torch.nn as nn import torch.utils.cpp_extension @torch.no_grad() def scaling_init(tensor, scale=1, dist='u'): fan_in, fan_out = nn.init._calculate_fan_in_and_fan_out(tensor) scale /= (fan_in + fan_out) / 2 if dist == 'n': std = math.sqrt(scale) return 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.triton_helpers import libdevice import math import ...
STomoya/animeface
AdaptiveInstanceNorm
false
14,373
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42
DBLoss
import torch import numpy as np from torch import nn class DBLoss(nn.Module): def __init__(self, alpha=1.0, beta=10.0, ohem_ratio=3): """ Implement DB Loss. :param alpha: loss binary_map 前面的系数 :param beta: loss threshold 前面的系数 :param ohem_ratio: OHEM的比例 """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np fro...
SURFZJY/Real-time-Text-Detection
DBLoss
false
14,374
[ "Apache-2.0" ]
65
b76ee8d840b1fcebf7b9545402907416c7daf24e
https://github.com/SURFZJY/Real-time-Text-Detection/tree/b76ee8d840b1fcebf7b9545402907416c7daf24e
GeM
import torch import torch.nn as nn from torch.nn import functional as F from torch.nn.parameter import Parameter def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class GeM(nn.Module): def __init__(self, p=3, eps=1e-06, p_trainable=True...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from t...
SamYuen101234/Masked_Face_Recognition
GeM
false
14,375
[ "MIT" ]
60
2dc572573ebd9ac208314690b529ed69addf0913
https://github.com/SamYuen101234/Masked_Face_Recognition/tree/2dc572573ebd9ac208314690b529ed69addf0913
AdaptiveConv
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data.distributed class AdaptiveConv(nn.Module): def __init__(self, in_channels, out_channels, stride=1, padding=1, dilation=1, groups=1, bias=False, size=(256, 256)): super(AdaptiveConv,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SSusantAchary/OctaveConv_pytorch
AdaptiveConv
false
14,376
[ "MIT" ]
633
079f7da29d55c2eeed8985d33f0b2f765d7a469e
https://github.com/SSusantAchary/OctaveConv_pytorch/tree/079f7da29d55c2eeed8985d33f0b2f765d7a469e
L1Loss
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class L1Loss(nn.Module): """ A simple mean absolute error (MAE) implementation. """ def __init__(self, reduction='mean', **kwargs): super().__init__() self.reduction = reduction 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._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
SanghyukChun/rebias
L1Loss
false
14,377
[ "MIT" ]
129
6a4f6abdd68e080a08737d93a3c4b43e0f0ce055
https://github.com/SanghyukChun/rebias/tree/6a4f6abdd68e080a08737d93a3c4b43e0f0ce055
EqualizedLinear
import math import torch import torch.nn as nn import torch.utils.cpp_extension @torch.no_grad() def scaling_init(tensor, scale=1, dist='u'): fan_in, fan_out = nn.init._calculate_fan_in_and_fan_out(tensor) scale /= (fan_in + fan_out) / 2 if dist == 'n': std = math.sqrt(scale) return 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 import math import torch.nn as nn import torch.utils.cpp_extension assert_size_s...
STomoya/animeface
EqualizedLinear
false
14,378
[ "MIT" ]
61
37b3cd26097d7874559d4c152e41e5712b7a1a42
https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42