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
spatial_attn_layer
import torch import torch.nn as nn import torch.onnx import torch.nn.parallel class BasicConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=False, bias=False): super(BasicConv, self).__init__() self.out_channels...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Ganzooo/soil_segmentation
spatial_attn_layer
false
2,296
[ "MIT" ]
0
56f410e3e184f24e52dd4b542ea309f0d203ca00
https://github.com/Ganzooo/soil_segmentation/tree/56f410e3e184f24e52dd4b542ea309f0d203ca00
AvgPoolPad
import torch import torch.utils.data import torch.nn as nn from torch import optim as optim import torch.nn.parallel class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, 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.utils.data import torch.nn as nn from torch import optim as optim import torch.nn.parallel assert_size_stride = torch._C._dynam...
Exir-lxr/crldr-prune-pytorch
AvgPoolPad
false
2,297
[ "Apache-2.0" ]
0
adeb5e0b24ce66ff9531d4d947f72412c1b5c033
https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033
Contract
import torch import torch.nn as nn class Contract(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): b, c, h, w = x.size() s = self.gain x = x.view(b, c, h // s, s, w // s, s) x = x.permute(0, 3, 5, 1, 2, 4).conti...
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...
GoalballAnalysis/GUI
Contract
false
2,298
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
Quantizing_cossim
import torch import torch.nn as nn from typing import Tuple class Quantizing_cossim(nn.Module): """ This is quantizing layer. """ __initialized: 'bool' = True def __init__(self, num_quantizing: 'int', quantizing_dim: 'int', _weight: 'torch.Tensor'=None, initialize_by_dataset: '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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Geson-anko/VQ_AutoEncoder
Quantizing_cossim
false
2,299
[ "MIT" ]
0
62e1694de38ea6f152891e19abc190ad4048e587
https://github.com/Geson-anko/VQ_AutoEncoder/tree/62e1694de38ea6f152891e19abc190ad4048e587
MultiHeadAttentionLayer
import math import torch import torch.nn as nn class MultiHeadAttentionLayer(nn.Module): def __init__(self, hidden_dim, n_heads, dropout=0.1): super().__init__() assert hidden_dim % n_heads == 0 self.hidden_dim = hidden_dim self.n_heads = n_heads self.head_dim = hidden_dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GaroneHuang/pan_pp.pytorch
MultiHeadAttentionLayer
false
2,300
[ "Apache-2.0" ]
0
dde41ad652179433ad8a9650f671dc6742b783f9
https://github.com/GaroneHuang/pan_pp.pytorch/tree/dde41ad652179433ad8a9650f671dc6742b783f9
MaxPoolPad
import torch import torch.nn as nn class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) x = self.pool(x) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
GoalballAnalysis/GUI
MaxPoolPad
false
2,301
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
AconC
import torch import torch.nn as nn class AconC(nn.Module): """ ACON activation (activate or not). AconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is a learnable parameter according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. """ def __i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
GoalballAnalysis/GUI
AconC
false
2,302
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
Encoder
import torch import torch.nn.functional as F from torch import nn class Encoder(nn.Module): def __init__(self, input_size: 'int', output_size: 'int', max_temp: 'float'=10.0, min_temp: 'float'=0.1, reg_threshold: 'float'=3.0, reg_eps: 'float'=1e-10) ->None: """Feature selection encoder ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import nn assert_size_stride = torch....
GewoonMaarten/spherical-dmri-conv
Encoder
false
2,303
[ "MIT" ]
0
6a5bbb31cf70a5f8b839f92e534f49664001ea09
https://github.com/GewoonMaarten/spherical-dmri-conv/tree/6a5bbb31cf70a5f8b839f92e534f49664001ea09
Expand
import torch import torch.nn as nn class Expand(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): b, c, h, w = x.size() s = self.gain x = x.view(b, s, s, c // s ** 2, h, w) x = x.permute(0, 3, 4, 1, 5, 2).contigu...
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...
GoalballAnalysis/GUI
Expand
false
2,304
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
SEModule
import torch import torch.utils.data import torch.nn as nn from torch import optim as optim import torch.nn.parallel class SEModule(nn.Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
Exir-lxr/crldr-prune-pytorch
SEModule
false
2,305
[ "Apache-2.0" ]
0
adeb5e0b24ce66ff9531d4d947f72412c1b5c033
https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033
PANNsLoss
import torch import torch.nn as nn class PANNsLoss(nn.Module): def __init__(self): super().__init__() self.bce = nn.BCEWithLogitsLoss() self.cel = nn.CrossEntropyLoss() def forward(self, input, target): """ input_ = input input_ = torch.where( 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Gopi-Durgaprasad/Kaggle-Cornell-Birdcall-Identification
PANNsLoss
false
2,306
[ "Apache-2.0" ]
0
9eafbcba3323c29b0f9271911debc2f18af78f23
https://github.com/Gopi-Durgaprasad/Kaggle-Cornell-Birdcall-Identification/tree/9eafbcba3323c29b0f9271911debc2f18af78f23
AvgPoolPad
import torch import torch.nn as nn class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=False) def forwa...
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...
GoalballAnalysis/GUI
AvgPoolPad
false
2,307
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
Classifier
import torch import torch.distributed import torch.nn as nn class Classifier(nn.Module): def __init__(self, hidden_size): super(Classifier, self).__init__() self.linear1 = nn.Linear(hidden_size, 1) self.sigmoid = nn.Sigmoid() def forward(self, x, mask_cls): h = self.linear1(x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.distributed import torch.nn as nn assert_size_stride = torch._C._dy...
GraphGrailAi/summ-abs-dev
Classifier
false
2,308
[ "MIT" ]
0
512f253bf72b6529589b29d06959b560b79f1cde
https://github.com/GraphGrailAi/summ-abs-dev/tree/512f253bf72b6529589b29d06959b560b79f1cde
BCEBlurWithLogitsLoss
import torch import torch.nn as nn class BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super().__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): loss = self.loss_fcn(pred, true) pred...
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...
GoalballAnalysis/GUI
BCEBlurWithLogitsLoss
false
2,309
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
BAP
import torch import torch.nn as nn class BAP(nn.Module): def __init__(self, **kwargs): super(BAP, self).__init__() def forward(self, feature_maps, attention_maps): feature_shape = feature_maps.size() attention_shape = attention_maps.size() phi_I = torch.einsum('imjk,injk->imn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GunjanChourasia/WS_DAN_PyTorch
BAP
false
2,310
[ "MIT" ]
0
6c12a1b5b0b8980e3b69d44474e0b5edb455570c
https://github.com/GunjanChourasia/WS_DAN_PyTorch/tree/6c12a1b5b0b8980e3b69d44474e0b5edb455570c
SpatialAttention
import torch from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HT-hlf/mmdetection_miner-2.22.0
SpatialAttention
false
2,311
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
MeanVoxelFeatureExtractor
import torch import torch.nn as nn class VoxelFeatureExtractor(nn.Module): def __init__(self, **kwargs): super().__init__() def get_output_feature_dim(self): raise NotImplementedError def forward(self, **kwargs): raise NotImplementedError class MeanVoxelFeatureExtractor(VoxelF...
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...
GuilinZ/PCDet
MeanVoxelFeatureExtractor
false
2,312
[ "Apache-2.0" ]
0
f39769160854871bec9954630b9a4369b603391d
https://github.com/GuilinZ/PCDet/tree/f39769160854871bec9954630b9a4369b603391d
HardAttn
import torch from torch.nn import functional as F import torch.nn as nn class HardAttn(nn.Module): """Hard Attention (Sec. 3.1.II)""" def __init__(self, in_channels): super(HardAttn, self).__init__() self.fc = nn.Linear(in_channels, 4 * 2) self.init_params() def init_params(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 ...
GoalballAnalysis/GUI
HardAttn
false
2,313
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
MetaAconC
import torch import torch.nn as nn class MetaAconC(nn.Module): """ ACON activation (activate or not). MetaAconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is generated by a small network according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. "...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
GoalballAnalysis/GUI
MetaAconC
false
2,314
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
TransformerLayer
import torch import torch.nn as nn class TransformerLayer(nn.Module): def __init__(self, c, num_heads): super().__init__() self.q = nn.Linear(c, c, bias=False) self.k = nn.Linear(c, c, bias=False) self.v = nn.Linear(c, c, bias=False) self.ma = nn.MultiheadAttention(embed_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GoalballAnalysis/GUI
TransformerLayer
false
2,315
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
ResizeCat
import torch import torch.nn as nn class ResizeCat(nn.Module): def __init__(self, **kwargs): super(ResizeCat, self).__init__() def forward(self, at1, at3, at5): _N, _C, H, W = at1.size() resized_at3 = nn.functional.interpolate(at3, (H, W)) resized_at5 = nn.functional.interpol...
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...
GunjanChourasia/WS_DAN_PyTorch
ResizeCat
false
2,316
[ "MIT" ]
0
6c12a1b5b0b8980e3b69d44474e0b5edb455570c
https://github.com/GunjanChourasia/WS_DAN_PyTorch/tree/6c12a1b5b0b8980e3b69d44474e0b5edb455570c
MMD_loss
import torch import torch.utils.data import torch import torch.nn as nn class MMD_loss(nn.Module): def __init__(self, kernel_mul=2.0, kernel_num=5): super(MMD_loss, self).__init__() self.kernel_num = kernel_num self.kernel_mul = kernel_mul self.fix_sigma = None def guassian_k...
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.utils.data import torch import torch.nn as nn assert_size_st...
HC-Feynman/10708-proj
MMD_loss
false
2,317
[ "BSD-3-Clause" ]
0
592ed86671539b6e910dac72391ef0d3ae8e79ef
https://github.com/HC-Feynman/10708-proj/tree/592ed86671539b6e910dac72391ef0d3ae8e79ef
ChannelAttention_avg
import torch from torch import nn class ChannelAttention_avg(nn.Module): def __init__(self, in_planes, ratio=8): super(ChannelAttention_avg, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(in_planes, ratio, 1, bias=False) self.relu1 = nn.ReLU() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HT-hlf/mmdetection_miner-2.22.0
ChannelAttention_avg
false
2,318
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
NormedConv2d
import torch from torch import nn class NormedConv2d(nn.Conv2d): """Normalized Conv2d Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of divisor to keep ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
HT-hlf/mmdetection_miner-2.22.0
NormedConv2d
false
2,319
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
MultiHeadAttention
import torch import numpy as np import torch.nn as nn class MultiHeadAttention(nn.Module): """Multi-Head Attention Layer""" def __init__(self, hidden_size, num_attention_heads, attention_dropout_prob ): super(MultiHeadAttention, self).__init__() self.h = num_attention_heads 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 from torch._inductor.runtime....
Ginga1892/bert-x
MultiHeadAttention
false
2,320
[ "MIT" ]
0
903970ef0a6967aa20a82bcf56b874602e37a04d
https://github.com/Ginga1892/bert-x/tree/903970ef0a6967aa20a82bcf56b874602e37a04d
GlobalAttention
import torch import torch.distributed import torch.nn as nn import torch.nn.functional as F def sequence_mask(lengths, max_len=None): """ Creates a boolean mask from sequence lengths. """ batch_size = lengths.numel() max_len = max_len or lengths.max() return torch.arange(0, max_len).type_as(le...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GraphGrailAi/summ-abs-dev
GlobalAttention
false
2,321
[ "MIT" ]
0
512f253bf72b6529589b29d06959b560b79f1cde
https://github.com/GraphGrailAi/summ-abs-dev/tree/512f253bf72b6529589b29d06959b560b79f1cde
ChannelAttention
import torch from torch import nn class ChannelAttention(nn.Module): def __init__(self, in_planes, ratio=8): super(ChannelAttention, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.max_pool = nn.AdaptiveMaxPool2d(1) self.fc1 = nn.Conv2d(in_planes, ratio, 1, bias=Fals...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
HT-hlf/mmdetection_miner-2.22.0
ChannelAttention
false
2,322
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
NormedLinear
import torch import torch.nn.functional as F from torch import nn class NormedLinear(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
HT-hlf/mmdetection_miner-2.22.0
NormedLinear
false
2,323
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
ChannelAttention_a
import torch from torch import nn class ChannelAttention_a(nn.Module): def __init__(self, in_planes, ratio=8): super(ChannelAttention_a, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.max_pool = nn.AdaptiveMaxPool2d(1) self.fc1 = nn.Conv2d(in_planes, ratio, 1, 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HT-hlf/mmdetection_miner-2.22.0
ChannelAttention_a
false
2,324
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
UpConv
import torch import torch.nn as nn from enum import Enum from enum import auto class UpsampleType(Enum): CONV_TRANSPOSE = auto() NEAREST_NEIGHBOUR = auto() BILINEAR = auto() class UpConv(nn.Module): """ Custom module to handle a single Upsample + Convolution block used in the decoder layer. ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 enum import Enum from enum import auto assert_size_st...
HalestormAI/efficientnet-unet
UpConv
false
2,325
[ "MIT" ]
0
b6d5ec86d667ce7ac1f689bc16269dca83a079f0
https://github.com/HalestormAI/efficientnet-unet/tree/b6d5ec86d667ce7ac1f689bc16269dca83a079f0
InstockMask
import torch import torch.nn as nn class InstockMask(nn.Module): def __init__(self, time_step, ltsp, min_instock_ratio=0.5, eps_instock_dph=0.001, eps_total_dph=0.001, **kwargs): super(InstockMask, self).__init__(**kwargs) if not eps_total_dph > 0: raise ValueError( ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
GoldbergData/pytorch-forecasting
InstockMask
false
2,326
[ "MIT" ]
0
e2ef3794da5d996c9740d932a4f55269bb4003f2
https://github.com/GoldbergData/pytorch-forecasting/tree/e2ef3794da5d996c9740d932a4f55269bb4003f2
EncoderImagePrecomp
import torch import numpy as np import torch.nn as nn import torch.nn.init from collections import OrderedDict def l2norm(X): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt() X = torch.div(X, norm) return X class EncoderImagePrecomp(nn.Module): def __i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
Harshdeep1996/jina-hub
EncoderImagePrecomp
false
2,327
[ "Apache-2.0" ]
0
880ff719715b89969860c70219d26a931a031d10
https://github.com/Harshdeep1996/jina-hub/tree/880ff719715b89969860c70219d26a931a031d10
Attention
import math import torch from torch import nn class Attention(nn.Module): """A generic attention module for a decoder in seq2seq""" def __init__(self, dim, use_tanh=False, C=10): super(Attention, self).__init__() self.use_tanh = use_tanh self.project_query = nn.Linear(dim, dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
GuyLor/attention-learn-to-route
Attention
false
2,328
[ "MIT" ]
0
d07d5c1465f7ee5d18651e23cfae9aa1f52a9c6c
https://github.com/GuyLor/attention-learn-to-route/tree/d07d5c1465f7ee5d18651e23cfae9aa1f52a9c6c
DiceCoefficientLoss
import torch import torch.nn as nn class DiceCoefficientLoss(nn.Module): def __init__(self, apply_softmax: 'bool'=False, eps: 'float'=1e-06): super().__init__() self.apply_softmax = apply_softmax self.eps = eps def forward(self, x: 'torch.Tensor', y: 'torch.Tensor', multiclass=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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
HalestormAI/efficientnet-unet
DiceCoefficientLoss
false
2,329
[ "MIT" ]
0
b6d5ec86d667ce7ac1f689bc16269dca83a079f0
https://github.com/HalestormAI/efficientnet-unet/tree/b6d5ec86d667ce7ac1f689bc16269dca83a079f0
NormalizationLayer
import torch import torch.nn.init class NormalizationLayer(torch.nn.Module): """Class for normalization layer.""" def __init__(self, normalize_scale=1.0, learn_scale=True): super(NormalizationLayer, self).__init__() self.norm_s = float(normalize_scale) if learn_scale: 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.triton_helpers import libdevice import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Harshdeep1996/jina-hub
NormalizationLayer
false
2,330
[ "Apache-2.0" ]
0
880ff719715b89969860c70219d26a931a031d10
https://github.com/Harshdeep1996/jina-hub/tree/880ff719715b89969860c70219d26a931a031d10
LinearZeros
import torch import torch.nn as nn class LinearZeros(nn.Linear): def __init__(self, in_channels, out_channels, logscale_factor=3): super().__init__(in_channels, out_channels) self.logscale_factor = logscale_factor self.register_parameter('logs', nn.Parameter(torch.zeros(out_channels)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
GauriJagatap/glow-pytorch
LinearZeros
false
2,331
[ "MIT" ]
0
e379f524b7cc0b57a9bc2849f4115f97bda5a1de
https://github.com/GauriJagatap/glow-pytorch/tree/e379f524b7cc0b57a9bc2849f4115f97bda5a1de
LayerNorm
import torch from torch import nn from torch.nn import functional as F class LayerNorm(nn.Module): def __init__(self, channels, eps=1e-05): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) self.beta = nn.Parameter(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 libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
HalimSD/A-eye
LayerNorm
false
2,332
[ "MIT" ]
0
502dcdf47d54d93e8745be7c49897064550db8c7
https://github.com/HalimSD/A-eye/tree/502dcdf47d54d93e8745be7c49897064550db8c7
ResampleNorm
import torch import torch.nn.functional as F import torch.nn as nn import torch.functional as F class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional as F import torch.nn as nn import torch.functional a...
GoldbergData/pytorch-forecasting
ResampleNorm
false
2,333
[ "MIT" ]
0
e2ef3794da5d996c9740d932a4f55269bb4003f2
https://github.com/GoldbergData/pytorch-forecasting/tree/e2ef3794da5d996c9740d932a4f55269bb4003f2
JaccardLoss
import torch import torch.nn as nn class JaccardLoss(nn.Module): def __init__(self, apply_softmax: 'bool'=False, eps: 'float'=1e-06): super().__init__() self.apply_softmax = apply_softmax self.eps = eps def forward(self, x, y, eps=1e-06): if self.apply_softmax: x ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
HalestormAI/efficientnet-unet
JaccardLoss
false
2,334
[ "MIT" ]
0
b6d5ec86d667ce7ac1f689bc16269dca83a079f0
https://github.com/HalestormAI/efficientnet-unet/tree/b6d5ec86d667ce7ac1f689bc16269dca83a079f0
TwoMLPHead
import torch from torch import nn import torch.nn.functional as F class TwoMLPHead(nn.Module): """ Standard heads for FPN-based models Arguments: in_channels (int): number of input channels representation_size (int): size of the intermediate representation """ def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
GreenCUBIC/Gas-Prices-of-America
TwoMLPHead
false
2,335
[ "MIT" ]
0
e2a045db99d061b5d2acbe208da8cc19af12659d
https://github.com/GreenCUBIC/Gas-Prices-of-America/tree/e2a045db99d061b5d2acbe208da8cc19af12659d
IndexedSegmentationMap
import torch import torch.nn as nn class IndexedSegmentationMap(nn.Module): """ Takes the raw logits from the n-channel output convolution and uses argmax to convert to an indexed output map. """ def __init__(self): super().__init__() def forward(self, x: 'torch.Tensor') ->torch.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
HalestormAI/efficientnet-unet
IndexedSegmentationMap
false
2,336
[ "MIT" ]
0
b6d5ec86d667ce7ac1f689bc16269dca83a079f0
https://github.com/HalestormAI/efficientnet-unet/tree/b6d5ec86d667ce7ac1f689bc16269dca83a079f0
Attention
import math import torch import torch.nn as nn from abc import * import torch.nn.functional as F from torch import optim as optim class Attention(nn.Module): """ Compute 'Scaled Dot Product Attention """ def forward(self, query, key, value, mask=None, dropout=None): scores = torch.matmul(quer...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
HeegyuKim/RecSys-MovieLens100k
Attention
false
2,337
[ "MIT" ]
0
aa3a272e6045d8230ecbabbf94a6f68170a26c9e
https://github.com/HeegyuKim/RecSys-MovieLens100k/tree/aa3a272e6045d8230ecbabbf94a6f68170a26c9e
CBAM
import torch from torch import nn class ChannelAttention(nn.Module): def __init__(self, in_planes, ratio=8): super(ChannelAttention, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.max_pool = nn.AdaptiveMaxPool2d(1) self.fc1 = nn.Conv2d(in_planes, ratio, 1, bias=Fals...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
HT-hlf/mmdetection_miner-2.22.0
CBAM
false
2,338
[ "Apache-2.0" ]
0
76eb94d6547f9f95cd58f41bb5c91941e82322b9
https://github.com/HT-hlf/mmdetection_miner-2.22.0/tree/76eb94d6547f9f95cd58f41bb5c91941e82322b9
ActorNetwork
import torch import torch.nn.functional as F import torch.nn as nn class ActorNetwork(nn.Module): def __init__(self, state_dim, action_dim, seed, fc1_units=256, fc2_units=128): """ Initialize parameters of model and build its. Parameters: =========== state_dim (int): State...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HatemSelim94/RL-MADDPG
ActorNetwork
false
2,339
[ "MIT" ]
0
037a722f59e2e461fe6615685b434365fc5540b1
https://github.com/HatemSelim94/RL-MADDPG/tree/037a722f59e2e461fe6615685b434365fc5540b1
ShuffleBlock
import torch import torch.nn as nn class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.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...
Geunwoo-Jeon/pytorch-cifar
ShuffleBlock
false
2,340
[ "MIT" ]
0
b06eeb65bbc0a4eccd124ed3c5367da70ab1ed20
https://github.com/Geunwoo-Jeon/pytorch-cifar/tree/b06eeb65bbc0a4eccd124ed3c5367da70ab1ed20
ScaledDotProductAttention
import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout: 'float'=None, scale: 'bool'=True): super(ScaledDotProductAttention, self).__init__() if dropout is not None: self.dropout = nn.Dropout(p=dropout) else: self.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....
GoldbergData/pytorch-forecasting
ScaledDotProductAttention
false
2,341
[ "MIT" ]
0
e2ef3794da5d996c9740d932a4f55269bb4003f2
https://github.com/GoldbergData/pytorch-forecasting/tree/e2ef3794da5d996c9740d932a4f55269bb4003f2
BiInteractionPooling
import torch import torch.nn as nn import torch.utils.data class BiInteractionPooling(nn.Module): def __init__(self): super(BiInteractionPooling, self).__init__() def forward(self, inputs): concated_embeds_value = inputs square_of_sum = torch.pow(torch.sum(concated_embeds_value, 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Holldean/pytorch-models
BiInteractionPooling
false
2,342
[ "MIT" ]
0
9509d0d462b1a98164b266d49ada199071a855ac
https://github.com/Holldean/pytorch-models/tree/9509d0d462b1a98164b266d49ada199071a855ac
AddNorm
import torch import torch.nn.functional as F import torch.nn as nn import torch.functional as F class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional as F import torch.nn as nn import torch.functional a...
GoldbergData/pytorch-forecasting
AddNorm
false
2,343
[ "MIT" ]
0
e2ef3794da5d996c9740d932a4f55269bb4003f2
https://github.com/GoldbergData/pytorch-forecasting/tree/e2ef3794da5d996c9740d932a4f55269bb4003f2
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_...
Geunwoo-Jeon/pytorch-cifar
SE
false
2,344
[ "MIT" ]
0
b06eeb65bbc0a4eccd124ed3c5367da70ab1ed20
https://github.com/Geunwoo-Jeon/pytorch-cifar/tree/b06eeb65bbc0a4eccd124ed3c5367da70ab1ed20
PositionwiseFeedForward
import torch import torch.nn as nn class PositionwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_hid, d_inner_hid=None, dropout=0): super(PositionwiseFeedForward, self).__init__() if d_inner_hid is None: d_inner_hid = d_hid self.w_1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HeGuanyuan/ABSA-PyTorch
PositionwiseFeedForward
false
2,345
[ "MIT" ]
0
8244aeb39007a2714ccbfd54629ddbbb013ea87e
https://github.com/HeGuanyuan/ABSA-PyTorch/tree/8244aeb39007a2714ccbfd54629ddbbb013ea87e
Conv2dZeros
import torch import torch.nn as nn class _ActNorm(nn.Module): """ Activation Normalization Initialize the bias and scale with a given minibatch, so that the output per-channel have zero mean and unit variance for that. After initialization, `bias` and `logs` will be trained as parameters. """...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
GauriJagatap/glow-pytorch
Conv2dZeros
false
2,346
[ "MIT" ]
0
e379f524b7cc0b57a9bc2849f4115f97bda5a1de
https://github.com/GauriJagatap/glow-pytorch/tree/e379f524b7cc0b57a9bc2849f4115f97bda5a1de
PredictionLayer
import torch import torch.nn as nn import torch.utils.data class PredictionLayer(nn.Module): def __init__(self, task='binary', use_bias=True, **kwargs): if task not in ['binary', 'multiclass', 'regression']: raise ValueError('task must be binary, multiclass or regression') super(Predi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Holldean/pytorch-models
PredictionLayer
false
2,347
[ "MIT" ]
0
9509d0d462b1a98164b266d49ada199071a855ac
https://github.com/Holldean/pytorch-models/tree/9509d0d462b1a98164b266d49ada199071a855ac
Pool
from torch.nn import Module import torch from torch import nn class Pool(Module): """多尺度特征融合,借鉴Inception网络结构""" def __init__(self): super(Pool, self).__init__() self.max1 = nn.MaxPool2d(5, 1, 2) self.max2 = nn.MaxPool2d(9, 1, 4) self.max3 = nn.MaxPool2d(13, 1, 6) def forw...
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.nn import Module from torch import nn assert_size_stride = torch._C._dynamo.gu...
HibikiJie/MONet
Pool
false
2,348
[ "Apache-2.0" ]
0
931400df28cb62aab90662abe00acd1d3688073d
https://github.com/HibikiJie/MONet/tree/931400df28cb62aab90662abe00acd1d3688073d
ConvRelu
import torch import torch.utils.data import torch.nn as nn import torch.backends.cudnn class ConvRelu(nn.Module): """3x3 convolution followed by ReLU activation building block.""" def __init__(self, num_in, num_out): super().__init__() self.block = nn.Conv2d(num_in, num_out, kernel_size=3, pa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
HugoPopo/robosat.pink
ConvRelu
false
2,349
[ "MIT" ]
0
daa6a0cd6dff68103b9bcc78a8c9a15d8912c42d
https://github.com/HugoPopo/robosat.pink/tree/daa6a0cd6dff68103b9bcc78a8c9a15d8912c42d
FM
import torch import torch.nn as nn import torch.utils.data class FM(nn.Module): def __init__(self): super(FM, self).__init__() def forward(self, X): square_of_sum = torch.pow(torch.sum(X, dim=1, keepdim=True), 2) sum_of_square = torch.sum(X * X, dim=1, keepdim=True) cross_ter...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Holldean/pytorch-models
FM
false
2,350
[ "MIT" ]
0
9509d0d462b1a98164b266d49ada199071a855ac
https://github.com/Holldean/pytorch-models/tree/9509d0d462b1a98164b266d49ada199071a855ac
ReOrgLayer
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch._utils class ReOrgLayer(nn.Module): def __init__(self, stride=2): super(ReOrgLayer, self).__init__() self.stride = stride def forward(self, x): assert x.data.dim() == 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 import torch.utils.data import torch.utils.data.distributed import torch._utils assert_size_stride = torch._C._dynamo....
Humoon/motion_reconstruction
ReOrgLayer
false
2,351
[ "BSD-3-Clause" ]
0
9f0d0af3aeafa97455ec19dc4988f1577005c294
https://github.com/Humoon/motion_reconstruction/tree/9f0d0af3aeafa97455ec19dc4988f1577005c294
Attention
import math import torch import torch.nn.functional as F import torch.nn as nn class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HeGuanyuan/ABSA-PyTorch
Attention
false
2,352
[ "MIT" ]
0
8244aeb39007a2714ccbfd54629ddbbb013ea87e
https://github.com/HeGuanyuan/ABSA-PyTorch/tree/8244aeb39007a2714ccbfd54629ddbbb013ea87e
DecoderBlock
import torch import torch.utils.data import torch.nn as nn import torch.backends.cudnn class ConvRelu(nn.Module): """3x3 convolution followed by ReLU activation building block.""" def __init__(self, num_in, num_out): super().__init__() self.block = nn.Conv2d(num_in, num_out, kernel_size=3, pa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
HugoPopo/robosat.pink
DecoderBlock
false
2,353
[ "MIT" ]
0
daa6a0cd6dff68103b9bcc78a8c9a15d8912c42d
https://github.com/HugoPopo/robosat.pink/tree/daa6a0cd6dff68103b9bcc78a8c9a15d8912c42d
MaxPoolStride1
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F import torch._utils class MaxPoolStride1(nn.Module): def __init__(self, kernel_size): super(MaxPoolStride1, self).__init__() self.kernel_size = kernel_size self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import ...
Humoon/motion_reconstruction
MaxPoolStride1
false
2,354
[ "BSD-3-Clause" ]
0
9f0d0af3aeafa97455ec19dc4988f1577005c294
https://github.com/Humoon/motion_reconstruction/tree/9f0d0af3aeafa97455ec19dc4988f1577005c294
sSEmodule
import torch import torch.nn as nn class sSEmodule(nn.Module): """ ChannelSequeezeExcitationModule input: [B, C, H, W] torch tensor output: [B, C, H, W] torch tensor """ def __init__(self, in_channel): super().__init__() self.conv2d = nn.Conv2d(in_channel, 1, 1) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
HwangJohn/feature_representation
sSEmodule
false
2,355
[ "MIT" ]
0
27389caacc9c026b65f47ab0cbb4e6d0465e6a60
https://github.com/HwangJohn/feature_representation/tree/27389caacc9c026b65f47ab0cbb4e6d0465e6a60
cSEmodule
import torch import torch.nn as nn class cSEmodule(nn.Module): """ SpatialSequeezeExcitationModule input: [B, C, H, W] torch tensor output: [B, C, H, W] torch tensor """ def __init__(self, in_channel): super().__init__() self.global_avg = nn.AdaptiveAvgPool2d(1) 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_...
HwangJohn/feature_representation
cSEmodule
false
2,356
[ "MIT" ]
0
27389caacc9c026b65f47ab0cbb4e6d0465e6a60
https://github.com/HwangJohn/feature_representation/tree/27389caacc9c026b65f47ab0cbb4e6d0465e6a60
JointsMSELoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class JointsMSELoss(nn.Module): def __init__(self, use_target_weight): super(JointsMSELoss, self).__init__() self.criterion = nn.MSELoss(reduction='mean') ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed assert_size_st...
HongJinSeong/COW_KEY_POINT_DETECTION
JointsMSELoss
false
2,357
[ "MIT" ]
0
ea62ed875e9b8533f1c09b56eb8aefba94b1b906
https://github.com/HongJinSeong/COW_KEY_POINT_DETECTION/tree/ea62ed875e9b8533f1c09b56eb8aefba94b1b906
scSEmodule
import torch import torch.nn as nn class cSEmodule(nn.Module): """ SpatialSequeezeExcitationModule input: [B, C, H, W] torch tensor output: [B, C, H, W] torch tensor """ def __init__(self, in_channel): super().__init__() self.global_avg = nn.AdaptiveAvgPool2d(1) 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_...
HwangJohn/feature_representation
scSEmodule
false
2,358
[ "MIT" ]
0
27389caacc9c026b65f47ab0cbb4e6d0465e6a60
https://github.com/HwangJohn/feature_representation/tree/27389caacc9c026b65f47ab0cbb4e6d0465e6a60
Hsigmoid
import torch import torch.nn as nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3.0, inplace=self.inplace) / 6.0 def get_inputs(): re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IgorDavidyuk/pytorch-mobilenet-v3
Hsigmoid
false
2,359
[ "Apache-2.0" ]
0
48678f80d9390b530cb97966db492cf01d1c4a43
https://github.com/IgorDavidyuk/pytorch-mobilenet-v3/tree/48678f80d9390b530cb97966db492cf01d1c4a43
Hswish
import torch import torch.nn as nn import torch.nn.functional as F class Hswish(nn.Module): def __init__(self, inplace=True): super(Hswish, self).__init__() self.inplace = inplace def forward(self, x): return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.0 def get_inputs(): re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IgorDavidyuk/pytorch-mobilenet-v3
Hswish
false
2,360
[ "Apache-2.0" ]
0
48678f80d9390b530cb97966db492cf01d1c4a43
https://github.com/IgorDavidyuk/pytorch-mobilenet-v3/tree/48678f80d9390b530cb97966db492cf01d1c4a43
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...
Hunkzer/mmskeleton
ConvTemporalGraphical
false
2,361
[ "Apache-2.0" ]
0
551e3b4fa01330b23caab5815a40fbd848400b15
https://github.com/Hunkzer/mmskeleton/tree/551e3b4fa01330b23caab5815a40fbd848400b15
L1Part
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain from collections import OrderedDict import torch.hub class concatLayer(nn.Module): def __init__(self, in_channels, out_channels_perSub, i, j, appendix): super(concat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.u...
EddieMG/LateTemporalModeling3DCNN
L1Part
false
2,362
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
L2Part
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain from collections import OrderedDict import torch.hub class concatLayer(nn.Module): def __init__(self, in_channels, out_channels_perSub, i, j, appendix): super(concat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.u...
EddieMG/LateTemporalModeling3DCNN
L2Part
false
2,363
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
BasicBlock
import torch import torch.nn as nn import torch.nn.functional as F def apply_init_(modules): """ Initialize NN modules """ for m in modules: if isinstance(m, nn.Conv2d): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bias, 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 ...
IanYHWu/msc_2021
BasicBlock
false
2,364
[ "MIT" ]
0
0ae09ed392cce5fdf0e85d1f96b7af82900835f8
https://github.com/IanYHWu/msc_2021/tree/0ae09ed392cce5fdf0e85d1f96b7af82900835f8
InputInjection
import torch import torch.nn as nn import torch._C import torch.serialization class InputInjection(nn.Module): """Downsampling module for CGNet.""" def __init__(self, num_downsampling): super(InputInjection, self).__init__() self.pool = nn.ModuleList() for i in range(num_downsampling)...
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._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
ImportPaddle/APCNet
InputInjection
false
2,365
[ "MIT" ]
0
68ade1f83827b4cdd60ee4b6ac25454397100316
https://github.com/ImportPaddle/APCNet/tree/68ade1f83827b4cdd60ee4b6ac25454397100316
MultiHeadAttn
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_model = d_model self.d_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HikariNoMJ14/bebopnet-code
MultiHeadAttn
false
2,366
[ "MIT" ]
0
9dfa800d3e24c53de5dc948b87a7db2bc2919b54
https://github.com/HikariNoMJ14/bebopnet-code/tree/9dfa800d3e24c53de5dc948b87a7db2bc2919b54
Encoding
import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization class Encoding(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels). Ar...
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 ...
ImportPaddle/APCNet
Encoding
false
2,367
[ "MIT" ]
0
68ade1f83827b4cdd60ee4b6ac25454397100316
https://github.com/ImportPaddle/APCNet/tree/68ade1f83827b4cdd60ee4b6ac25454397100316
PositionwiseFeedForward
import math import torch import torch.distributed import torch.nn as nn def gelu(x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
GraphGrailAi/summ-abs-dev
PositionwiseFeedForward
false
2,368
[ "MIT" ]
0
512f253bf72b6529589b29d06959b560b79f1cde
https://github.com/GraphGrailAi/summ-abs-dev/tree/512f253bf72b6529589b29d06959b560b79f1cde
DiceLoss
import functools import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "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 functools impor...
ImportPaddle/APCNet
DiceLoss
false
2,369
[ "MIT" ]
0
68ade1f83827b4cdd60ee4b6ac25454397100316
https://github.com/ImportPaddle/APCNet/tree/68ade1f83827b4cdd60ee4b6ac25454397100316
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F def scaled_dot_product_attention(q, k, v, mask): """ q: query = (..., seq_len_q, depth) k: key = (..., seq_len_k, depth) v: value = (..., seq_len_v, depth_v) mask: float tensor with shape broadcastable to (..., seq_len_q, 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....
IanYHWu/transformers-for-translation
MultiHeadAttention
false
2,370
[ "MIT" ]
0
b763e58deb2263507eecd2eb569fbaf5c1dd9df8
https://github.com/IanYHWu/transformers-for-translation/tree/b763e58deb2263507eecd2eb569fbaf5c1dd9df8
BilinearUpsample
import torch from typing import Union from typing import List import torch.nn as nn import torch.nn.functional as F import torch.utils.data class BilinearUpsample(nn.Module): """ Overview: Upsamples the input to the given member varible scale_factor using mode biliner Interface: forward ...
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 from typing import List import torch.nn as nn import torch.utils...
Hcnaeg/DI-engine
BilinearUpsample
false
2,371
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
SpatialGatherModule
import torch import torch.nn as nn import torch.nn.functional as F import torch._C import torch.serialization class SpatialGatherModule(nn.Module): """Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted method to aggregate the context. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ImportPaddle/APCNet
SpatialGatherModule
false
2,372
[ "MIT" ]
0
68ade1f83827b4cdd60ee4b6ac25454397100316
https://github.com/ImportPaddle/APCNet/tree/68ade1f83827b4cdd60ee4b6ac25454397100316
LabelSmoothCELoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def one_hot(val: 'torch.LongTensor', num: 'int', num_first: 'bool'=False ) ->torch.FloatTensor: """ Overview: Convert a ``torch.LongTensor`` to one hot encoding. This implementation can be slightly 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Hcnaeg/DI-engine
LabelSmoothCELoss
false
2,373
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
DiceLoss
import torch import torch.nn as nn import torch.nn.functional as F class BinaryDiceLoss(nn.Module): """Dice loss of binary class Args: smooth: A float number to smooth loss, and avoid NaN error, default: 1 p: Denominator value: \\sum{x^p} + \\sum{y^p}, default: 2 predict: A tensor of s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Ignas-S/retinanet-simple
DiceLoss
false
2,374
[ "Apache-2.0" ]
0
81b17f65fa5278e6b9a4918e6a20b77949a7e87d
https://github.com/Ignas-S/retinanet-simple/tree/81b17f65fa5278e6b9a4918e6a20b77949a7e87d
AttnScore
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def sequence_mask(lengths, max_len=None): """ Creates a boolean mask from sequence lengths. """ batch_size = lengths.numel() max_len = max_len or lengths.max() return torch.arange(0, max_len).type_a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IndexFziQ/ASER
AttnScore
false
2,375
[ "MIT" ]
0
67dd1a2a25cec175c15675cc1f8a63ca065b447e
https://github.com/IndexFziQ/ASER/tree/67dd1a2a25cec175c15675cc1f8a63ca065b447e
CNN64x3
import torch import torch.nn as nn class CNN64x3(nn.Module): def __init__(self, input_channels, output_channels): super(CNN64x3, self).__init__() self.conv = nn.Conv2d(in_channels=input_channels, kernel_size=3, out_channels=output_channels) self.relu = nn.ReLU() self.p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
InExp123/pytorch-self_driving_car
CNN64x3
false
2,376
[ "MIT" ]
0
b4e8c8a76079085bf0471dad1820ee9995cffc74
https://github.com/InExp123/pytorch-self_driving_car/tree/b4e8c8a76079085bf0471dad1820ee9995cffc74
ATOCAttentionUnit
import torch from typing import Union import torch.nn as nn from typing import Dict import torch.utils.data class ATOCAttentionUnit(nn.Module): """ Overview: the attention unit of the atoc network. We now implement it as two-layer MLP, same as the original paper Interface: __init__, 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 ...
Hcnaeg/DI-engine
ATOCAttentionUnit
false
2,377
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
PositionwiseFeedForward
import torch import torch.nn as nn class LayerNorm(nn.Module): """ Layer Normalization class """ def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IndexFziQ/ASER
PositionwiseFeedForward
false
2,378
[ "MIT" ]
0
67dd1a2a25cec175c15675cc1f8a63ca065b447e
https://github.com/IndexFziQ/ASER/tree/67dd1a2a25cec175c15675cc1f8a63ca065b447e
LinearFBSP
import torch import numpy as np from typing import Tuple import torch.nn.functional as F from typing import cast def scale(old_value, old_min, old_max, new_min, new_max): old_range = old_max - old_min new_range = new_max - new_min new_value = (old_value - old_min) * new_range / old_range + new_min ret...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Gikiman/executors
LinearFBSP
false
2,379
[ "Apache-2.0" ]
0
98658b4136859164390cfccbde8cf0f7cf843593
https://github.com/Gikiman/executors/tree/98658b4136859164390cfccbde8cf0f7cf843593
GLU
import torch import torch.nn as nn import torch.utils.data class GLU(nn.Module): """ Overview: Gating Linear Unit. This class does a thing like this: .. code:: python # Inputs: input, context, output_size # The gate value is a learnt function of the 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Hcnaeg/DI-engine
GLU
false
2,380
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
Attention
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def sequence_mask(lengths, max_len=None): """ Creates a boolean mask from sequence lengths. """ batch_size = lengths.numel() max_len = max_len or lengths.max() return torch.arange(0, max_len).type_a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IndexFziQ/ASER
Attention
false
2,381
[ "MIT" ]
0
67dd1a2a25cec175c15675cc1f8a63ca065b447e
https://github.com/IndexFziQ/ASER/tree/67dd1a2a25cec175c15675cc1f8a63ca065b447e
SpatialGate3D
import torch import torch.nn as nn class BasicConv3D(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=True, bias=False): super(BasicConv3D, self).__init__() self.out_channels = out_planes self.conv = 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Healingl/3DAPRNet
SpatialGate3D
false
2,382
[ "BSD-2-Clause" ]
0
7c5e0028ae844df4e1f26327e8b438532ca0745f
https://github.com/Healingl/3DAPRNet/tree/7c5e0028ae844df4e1f26327e8b438532ca0745f
AvgPool2dSame
import math import torch import numpy as np from typing import List import torch.nn as nn import torch.nn.functional as F import torch.utils.data def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0) def pad_same(x, k: 'List[int]', s: 'List...
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 numpy as np from typing import List import torch.nn as nn import torch.nn.functional as F import torch.utils.data assert_...
Hcnaeg/DI-engine
AvgPool2dSame
false
2,383
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
EnsembleFC
import torch import torch.nn as nn import torch.utils.data class EnsembleFC(nn.Module): __constants__ = ['in_features', 'out_features'] in_features: 'int' out_features: 'int' ensemble_size: 'int' weight: 'torch.Tensor' def __init__(self, in_features: 'int', out_features: 'int', ensemb...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Hcnaeg/DI-engine
EnsembleFC
false
2,384
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
Encoder
import torch import torch.nn as nn import torch.utils.data class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=ker...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Hcnaeg/DI-engine
Encoder
false
2,385
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
Head
import torch import torch.nn as nn import torch.utils.data class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=ker...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Hcnaeg/DI-engine
Head
false
2,386
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
PPMConcat
import torch import torch.nn as nn import torch._C import torch.serialization class PPMConcat(nn.ModuleList): """Pyramid Pooling Module that only concat the features of each layer. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. """ def __init__(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 import torch.nn as nn import torch._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
ImportPaddle/APCNet
PPMConcat
false
2,387
[ "MIT" ]
0
68ade1f83827b4cdd60ee4b6ac25454397100316
https://github.com/ImportPaddle/APCNet/tree/68ade1f83827b4cdd60ee4b6ac25454397100316
MultiHeadedAttention
import math import torch from typing import Optional from typing import Tuple from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
InfluencerNGZK/wenet
MultiHeadedAttention
false
2,388
[ "Apache-2.0" ]
0
9a3c7f70a78ce675f5e013b1f67a06d1d23fba3e
https://github.com/InfluencerNGZK/wenet/tree/9a3c7f70a78ce675f5e013b1f67a06d1d23fba3e
SENet
import torch import torch.nn as nn import torch.utils.data class SENet(nn.Module): """support estimation network""" def __init__(self, input_size: 'int', hidden_size: 'int', output_dims: 'int') ->None: super(SENet, self).__init__() self.l_1 = nn.Linear(input_size, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Hcnaeg/DI-engine
SENet
false
2,389
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
ClippedLinearQuantization
import torch from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.optim.lr_scheduler import torch.nn.parallel import torch.utils.data import torch.onnx import torch.testing def linear_dequantize(input, scale, zero_point, inplace=False): if inplace: input.add_(zero_p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.optim.lr_schedule...
HatsuneMiku4/distiller
ClippedLinearQuantization
false
2,390
[ "Apache-2.0" ]
0
8fbacb01ebcb7d70c5d3ecb6a88093e6c4d42137
https://github.com/HatsuneMiku4/distiller/tree/8fbacb01ebcb7d70c5d3ecb6a88093e6c4d42137
GEGLU
import torch from torch import nn import torch.nn.functional as F class GEGLU(nn.Module): def forward(self, x): x, gates = x.chunk(2, dim=-1) return x * F.gelu(gates) 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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
JaireYu/perceiver-pytorch
GEGLU
false
2,391
[ "MIT" ]
0
23edd66a057bb0a6fc15126461b4409a522ca09e
https://github.com/JaireYu/perceiver-pytorch/tree/23edd66a057bb0a6fc15126461b4409a522ca09e
ScaledDotProductAttention
import torch from typing import Optional import torch.nn as nn import torch.nn.functional as F import torch.utils.data class ScaledDotProductAttention(nn.Module): """ Overview: Implementation of dot product attentionn with scaling. """ def __init__(self, d_k: 'int', dropout: 'float'=0.0) ->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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Hcnaeg/DI-engine
ScaledDotProductAttention
false
2,392
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
RewardModelNetwork
import torch import torch.nn as nn import torch.utils.data class RewardModelNetwork(nn.Module): def __init__(self, input_size: 'int', hidden_size: 'int', output_size: 'int') ->None: super(RewardModelNetwork, self).__init__() self.l1 = nn.Linear(input_size, hidden_size) self.l2 = 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.triton_helpers import libdevice import torch.nn as ...
Hcnaeg/DI-engine
RewardModelNetwork
false
2,393
[ "Apache-2.0" ]
0
aba0c629f87649854091e9e59d948f83962e3e1e
https://github.com/Hcnaeg/DI-engine/tree/aba0c629f87649854091e9e59d948f83962e3e1e
OutputTransition
import torch from torch import nn class OutputTransition(nn.Module): def __init__(self, inChans, n_labels): super(OutputTransition, self).__init__() self.final_conv = nn.Conv3d(inChans, n_labels, kernel_size=1) self.sigmoid = nn.Sigmoid() def forward(self, x): out = self.sigm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
JXQI/ModelsGenesis
OutputTransition
false
2,394
[ "MIT" ]
0
f961288313a78f03bd3045ac27722f791f365bd8
https://github.com/JXQI/ModelsGenesis/tree/f961288313a78f03bd3045ac27722f791f365bd8
ZeroPad1d
import torch import torch.nn.functional as F import torch.nn as nn import torch.optim.lr_scheduler import torch.utils.data import torch.onnx.operators import torch.optim class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.optim.lr_scheduler import torch.utils.data import torch.onnx.operators import torch.optim assert_size_str...
Fei00Wu/espresso
ZeroPad1d
false
2,395
[ "MIT" ]
0
4e8e6e2f9151a87448845c5142611c103dd4580c
https://github.com/Fei00Wu/espresso/tree/4e8e6e2f9151a87448845c5142611c103dd4580c