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
CELoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch._utils import torch.nn class CELoss(nn.Module): """ Distilling the Knowledge in a Neural Network, NIPS2014. https://arxiv.org/pdf/1503.02531.pdf """ def __init__(self, T=1, loss_weight=1.0): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ModelTC/EOD
CELoss
false
14,073
[ "Apache-2.0" ]
196
164bff80486e9ae6a095a97667b365c46ceabd86
https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86
BiaffineScorer
import torch import torch.nn as nn class BiaffineScorer(nn.Module): def __init__(self, input1_size, input2_size, output_size): super().__init__() self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1, output_size) self.W_bilin.weight.data.zero_() self.W_bilin.bia...
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...
NLPInBLCU/BiaffineDependencyParsing
BiaffineScorer
false
14,074
[ "MIT" ]
67
40b133648c747957dacd59916add0403371fe680
https://github.com/NLPInBLCU/BiaffineDependencyParsing/tree/40b133648c747957dacd59916add0403371fe680
DeepHeadModule
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt as sqrt class DeepHeadModule(nn.Module): def __init__(self, input_channels, output_channels): super(DeepHeadModule, self).__init__() self._input_channels = input_channels self._output_channels = outpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from ma...
NTech-Lab/deepfake-detection-challenge
DeepHeadModule
false
14,075
[ "Apache-2.0" ]
98
52095ce4a49f298faf075a5eb28391722b9e4103
https://github.com/NTech-Lab/deepfake-detection-challenge/tree/52095ce4a49f298faf075a5eb28391722b9e4103
ConvGelu
import torch import torch.nn as nn import torch.fx class ConvGelu(torch.nn.Module): def __init__(self): super(ConvGelu, self).__init__() self.conv = nn.Conv2d(3, 32, 3, 1) self.gelu = nn.GELU() def forward(self, x): x = self.conv(x) x = self.gelu(x) return 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.triton_helpers import libdevice import torch.nn as ...
NVIDIA/Torch-TensorRT
ConvGelu
false
14,076
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
decoderVH
import torch import torch.nn as nn import torch.nn.functional as F class decoderVH(nn.Module): def __init__(self): super(decoderVH, self).__init__() self.dconv0 = nn.Conv2d(in_channels=256, out_channels=128, kernel_size=3, stride=1, padding=1, bias=True) self.dgn0 = nn.GroupNo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Miles629/TransparentShapeRealData
decoderVH
false
14,077
[ "MIT" ]
91
b81098a2d1882f5fd33fba6167d7258dbe02d6d2
https://github.com/Miles629/TransparentShapeRealData/tree/b81098a2d1882f5fd33fba6167d7258dbe02d6d2
Pool
import torch import torch.nn as nn import torch.nn.functional as F import torch.fx class Pool(nn.Module): def __init__(self): super(Pool, self).__init__() def forward(self, x): return F.adaptive_avg_pool2d(x, (5, 5)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.fx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo....
NVIDIA/Torch-TensorRT
Pool
false
14,078
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
LoopFallbackNoEval
import torch import torch.nn as nn import torch.fx class LoopFallbackNoEval(nn.Module): def __init__(self): super(LoopFallbackNoEval, self).__init__() def forward(self, x): for _ in range(x.shape[1]): x = x + torch.ones_like(x) return x def get_inputs(): return [tor...
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.fx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo....
NVIDIA/Torch-TensorRT
LoopFallbackNoEval
false
14,079
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
KDLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch._utils import torch.nn class KDLoss(nn.Module): """ Distilling the Knowledge in a Neural Network, NIPS2014. https://arxiv.org/pdf/1503.02531.pdf """ def __init__(self, T=1, loss_weight=1.0): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ModelTC/EOD
KDLoss
false
14,080
[ "Apache-2.0" ]
196
164bff80486e9ae6a095a97667b365c46ceabd86
https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86
SeqExpandConv
import torch import torch.nn as nn from math import sqrt as sqrt class SeqExpandConv(nn.Module): def __init__(self, in_channels, out_channels, seq_length): super(SeqExpandConv, self).__init__() self.conv = nn.Conv3d(in_channels, out_channels, kernel_size=(3, 1, 1), padding=(1, 0, 0), ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt as sqrt assert_size_stride = torch._...
NTech-Lab/deepfake-detection-challenge
SeqExpandConv
false
14,081
[ "Apache-2.0" ]
98
52095ce4a49f298faf075a5eb28391722b9e4103
https://github.com/NTech-Lab/deepfake-detection-challenge/tree/52095ce4a49f298faf075a5eb28391722b9e4103
KLLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch._utils import torch.nn class KLLoss(nn.Module): """ KL Divergence loss """ def __init__(self, norm='softmax', loss_weight=1.0): super(KLLoss, self).__init__() self.loss_weight = loss_wei...
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...
ModelTC/EOD
KLLoss
false
14,082
[ "Apache-2.0" ]
196
164bff80486e9ae6a095a97667b365c46ceabd86
https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86
Norm
import torch import torch.fx class Norm(torch.nn.Module): def __init__(self): super(Norm, self).__init__() def forward(self, x): return torch.norm(x, 2, None, False) 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.fx assert_size_...
NVIDIA/Torch-TensorRT
Norm
false
14,083
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
ModuleFallbackSub
import torch import torch.nn as nn import torch.fx class ModuleFallbackSub(nn.Module): def __init__(self): super(ModuleFallbackSub, self).__init__() self.conv = nn.Conv2d(1, 3, 3) self.relu = nn.ReLU() def forward(self, x): return self.relu(self.conv(x)) def get_inputs(): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
NVIDIA/Torch-TensorRT
ModuleFallbackSub
false
14,084
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
NoiseLayer
import torch import torch.nn as nn class NoiseLayer(nn.Module): """adds noise. noise is per pixel (constant over channels) with per-channel weight""" def __init__(self, channels): super().__init__() self.weight = nn.Parameter(torch.zeros(channels)) self.noise = None def forward(s...
import torch from torch import device import 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...
NeuralBending/StyleCLIP
NoiseLayer
false
14,085
[ "MIT" ]
91
190d3a0d48823ccdbdd15c7f8af6e08703a6dbd8
https://github.com/NeuralBending/StyleCLIP/tree/190d3a0d48823ccdbdd15c7f8af6e08703a6dbd8
TestModel
import torch import torch.nn as nn import torch.fx class TestModel(nn.Module): def __init__(self): super().__init__() self.a = torch.nn.Module() self.b = torch.nn.Module() self.a.weights = torch.nn.Parameter(torch.randn(1, 2)) self.b.weights = torch.nn.Parameter(torch.rand...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.fx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo....
NVIDIA/Torch-TensorRT
TestModel
false
14,086
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
FEM
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt as sqrt class FEM(nn.Module): def __init__(self, channel_size): super(FEM, self).__init__() self.cs = channel_size self.cpm1 = nn.Conv2d(self.cs, 256, kernel_size=3, dilation=1, stride=1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from ma...
NTech-Lab/deepfake-detection-challenge
FEM
false
14,087
[ "Apache-2.0" ]
98
52095ce4a49f298faf075a5eb28391722b9e4103
https://github.com/NTech-Lab/deepfake-detection-challenge/tree/52095ce4a49f298faf075a5eb28391722b9e4103
Encoder
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict import torch.optim import torch._utils import torch.nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ModelTC/EOD
Encoder
false
14,089
[ "Apache-2.0" ]
196
164bff80486e9ae6a095a97667b365c46ceabd86
https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86
UpSampleLayer
import torch import torch.utils.data import torch.nn as torch_nn import torch.nn.functional as torch_nn_func class Conv1dKeepLength(torch_nn.Conv1d): """ Wrapper for causal convolution Input tensor: (batchsize=1, length, dim_in) Output tensor: (batchsize=1, length, dim_out) https://github.com/pytorch...
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 torch_nn import torch.nn.functional as torch_nn_func assert_size_stride = torch._C._dynamo.guards...
Ninushkat/Impact-Synth-Hardware
UpSampleLayer
false
14,090
[ "MIT" ]
55
37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
https://github.com/Ninushkat/Impact-Synth-Hardware/tree/37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
TimeVarFIRFilter
import torch import torch.utils.data import torch.nn as torch_nn import torch.nn.functional as torch_nn_func class TimeVarFIRFilter(torch_nn.Module): """ TimeVarFIRFilter Given sequences of filter coefficients and a signal, do filtering Filter coefs: (batchsize=1, signal_length, filter_order = 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 import torch.utils.data import torch.nn as torch_nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
Ninushkat/Impact-Synth-Hardware
TimeVarFIRFilter
false
14,091
[ "MIT" ]
55
37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
https://github.com/Ninushkat/Impact-Synth-Hardware/tree/37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
ModuleFallbackMain
import torch import torch.nn as nn import torch.fx class ModuleFallbackSub(nn.Module): def __init__(self): super(ModuleFallbackSub, self).__init__() self.conv = nn.Conv2d(1, 3, 3) self.relu = nn.ReLU() def forward(self, x): return self.relu(self.conv(x)) class ModuleFallbac...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
NVIDIA/Torch-TensorRT
ModuleFallbackMain
false
14,092
[ "BSD-3-Clause" ]
430
1a22204fecec690bc3c2a318dab4f57b98c57f05
https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05
Decoder5
import torch import torch.nn as nn class Decoder5(nn.Module): def __init__(self, model=None, fixed=False): super(Decoder5, self).__init__() self.fixed = fixed self.conv51 = nn.Conv2d(512, 512, 3, 1, 0) self.conv44 = nn.Conv2d(512, 512, 3, 1, 0) self.conv43 = nn.Conv2d(512,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
MingSun-Tse/Collaborative-Distillation
Decoder5
false
14,093
[ "MIT" ]
172
915712674af82ff91d926d922c14988cce0430f3
https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3
MyLinear
import torch import torch.nn as nn import torch.nn.functional as F class MyLinear(nn.Module): """Linear layer with equalized learning rate and custom learning rate multiplier.""" def __init__(self, input_size, output_size, gain=2 ** 0.5, use_wscale= False, lrmul=1, bias=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 torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
NeuralBending/StyleCLIP
MyLinear
false
14,094
[ "MIT" ]
91
190d3a0d48823ccdbdd15c7f8af6e08703a6dbd8
https://github.com/NeuralBending/StyleCLIP/tree/190d3a0d48823ccdbdd15c7f8af6e08703a6dbd8
encoderDepth
import torch import torch.nn as nn import torch.nn.functional as F class encoderDepth(nn.Module): def __init__(self): super(encoderDepth, self).__init__() self.conv1 = nn.Conv2d(in_channels=13, out_channels=64, kernel_size =4, stride=2, padding=1, bias=True) self.gn1 = nn.Grou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Miles629/TransparentShapeRealData
encoderDepth
false
14,095
[ "MIT" ]
91
b81098a2d1882f5fd33fba6167d7258dbe02d6d2
https://github.com/Miles629/TransparentShapeRealData/tree/b81098a2d1882f5fd33fba6167d7258dbe02d6d2
StyleMod
import torch import torch.nn as nn import torch.nn.functional as F class MyLinear(nn.Module): """Linear layer with equalized learning rate and custom learning rate multiplier.""" def __init__(self, input_size, output_size, gain=2 ** 0.5, use_wscale= False, lrmul=1, bias=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 torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
NeuralBending/StyleCLIP
StyleMod
false
14,096
[ "MIT" ]
91
190d3a0d48823ccdbdd15c7f8af6e08703a6dbd8
https://github.com/NeuralBending/StyleCLIP/tree/190d3a0d48823ccdbdd15c7f8af6e08703a6dbd8
MovingAverage
import torch import torch.utils.data import torch.nn as torch_nn import torch.nn.functional as torch_nn_func class Conv1dKeepLength(torch_nn.Conv1d): """ Wrapper for causal convolution Input tensor: (batchsize=1, length, dim_in) Output tensor: (batchsize=1, length, dim_out) https://github.com/pytorch...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 torch_nn import torch.nn.functional a...
Ninushkat/Impact-Synth-Hardware
MovingAverage
false
14,097
[ "MIT" ]
55
37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
https://github.com/Ninushkat/Impact-Synth-Hardware/tree/37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
FlowEntropy
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class FlowEntropy(nn.Module): """ Computes entropy from matching cost """ def __init__(self): super(FlowEntropy, self).__init__() def forward(self, x): """ Performs forward pass. ...
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 ...
NeelayS/ezflow
FlowEntropy
false
14,098
[ "MIT" ]
94
b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
https://github.com/NeelayS/ezflow/tree/b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
Depth_Pointwise_Conv1d
import torch from torch import nn class Depth_Pointwise_Conv1d(nn.Module): def __init__(self, in_ch, out_ch, k): super().__init__() if k == 1: self.depth_conv = nn.Identity() else: self.depth_conv = nn.Conv1d(in_channels=in_ch, out_channels= in_ch, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
Nitin-Mane/External-Attention-pytorch
Depth_Pointwise_Conv1d
false
14,099
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
FocalLossSigmoid
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class FocalLossSigmoid(nn.Module): """ sigmoid version focal loss """ def __init__(self, alpha=0.25, gamma=2, size_average=False): super(FocalLossSigmoid, self).__init__() self.al...
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 ...
No43problem/SSD_Pytorch
FocalLossSigmoid
false
14,100
[ "MIT" ]
163
ddc548824bffbc83b540a68b176ee0261b133ee0
https://github.com/No43problem/SSD_Pytorch/tree/ddc548824bffbc83b540a68b176ee0261b133ee0
FlowHead
import torch import torch.nn as nn class FlowHead(nn.Module): """ Applies two 2D convolutions over an input feature map to generate a flow tensor of shape N x 2 x H x W. Parameters ---------- input_dim : int, default: 128 Number of input dimensions. hidden_dim : int, default: 256 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
NeelayS/ezflow
FlowHead
false
14,101
[ "MIT" ]
94
b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
https://github.com/NeelayS/ezflow/tree/b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
DC_layer
import torch import torch.nn as nn def Maxout(x1, x2, x3, x4): mask_1 = torch.ge(x1, x2) mask_1 = mask_1.float() x = mask_1 * x1 + (1 - mask_1) * x2 mask_2 = torch.ge(x, x3) mask_2 = mask_2.float() x = mask_2 * x + (1 - mask_2) * x3 mask_3 = torch.ge(x, x4) mask_3 = mask_3.float() ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Min-Sheng/Local-Crowd-Counting
DC_layer
false
14,103
[ "MIT" ]
75
388343d3ec2d08747d537437e4c880fd0047df83
https://github.com/Min-Sheng/Local-Crowd-Counting/tree/388343d3ec2d08747d537437e4c880fd0047df83
ChannelAttentionModule
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nitin-Mane/External-Attention-pytorch
ChannelAttentionModule
false
14,104
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
ExternalAttention
import torch from torch import nn from torch.nn import init class ExternalAttention(nn.Module): def __init__(self, d_model, S=64): super().__init__() self.mk = nn.Linear(d_model, S, bias=False) self.mv = nn.Linear(S, d_model, bias=False) self.softmax = nn.Softmax(dim=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 from torch._inductor.runtime....
Nitin-Mane/External-Attention-pytorch
ExternalAttention
false
14,105
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
GAT
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(GraphAttentionLay...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EagleW/PaperRobot-Incremental-Draft-Generation-of-Scientific-Ideas
GAT
false
14,106
[ "MIT" ]
453
a338abf3974ba9ce916ae846835063a42b9e6689
https://github.com/EagleW/PaperRobot-Incremental-Draft-Generation-of-Scientific-Ideas/tree/a338abf3974ba9ce916ae846835063a42b9e6689
DoubleAttention
import torch from torch import nn from torch.nn import functional as F from torch.nn import init class DoubleAttention(nn.Module): def __init__(self, in_channels, c_m, c_n, reconstruct=True): super().__init__() self.in_channels = in_channels self.reconstruct = reconstruct self.c_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....
Nitin-Mane/External-Attention-pytorch
DoubleAttention
false
14,107
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
SineGen
import torch import numpy as np import torch.utils.data import torch.nn as torch_nn class SineGen(torch_nn.Module): """ Definition of sine generator SineGen(samp_rate, harmonic_num = 0, sine_amp = 0.1, noise_std = 0.003, voiced_threshold = 0, flag_for_pulse=False) ...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np import torch.utils...
Ninushkat/Impact-Synth-Hardware
SineGen
false
14,108
[ "MIT" ]
55
37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
https://github.com/Ninushkat/Impact-Synth-Hardware/tree/37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
SpatialGroupEnhance
import torch from torch import nn from torch.nn import init class SpatialGroupEnhance(nn.Module): def __init__(self, groups): super().__init__() self.groups = groups self.avg_pool = nn.AdaptiveAvgPool2d(1) self.weight = nn.Parameter(torch.zeros(1, groups, 1, 1)) self.bias ...
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 from torch.nn import init assert_size_stride = torch._C._d...
Nitin-Mane/External-Attention-pytorch
SpatialGroupEnhance
false
14,109
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
SimplifiedScaledDotProductAttention
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nitin-Mane/External-Attention-pytorch
SimplifiedScaledDotProductAttention
false
14,110
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
Conv1dKeepLength
import torch import torch.utils.data import torch.nn as torch_nn import torch.nn.functional as torch_nn_func class Conv1dKeepLength(torch_nn.Conv1d): """ Wrapper for causal convolution Input tensor: (batchsize=1, length, dim_in) Output tensor: (batchsize=1, length, dim_out) https://github.com/pytorch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
Ninushkat/Impact-Synth-Hardware
Conv1dKeepLength
false
14,111
[ "MIT" ]
55
37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
https://github.com/Ninushkat/Impact-Synth-Hardware/tree/37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
ECAAttention
import torch from torch import nn from torch.nn import init class ECAAttention(nn.Module): def __init__(self, kernel_size=3): super().__init__() self.gap = nn.AdaptiveAvgPool2d(1) self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=( kernel_size - 1) // 2) 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 import nn from torch.nn import init assert_size_stride = torch._C._dy...
Nitin-Mane/External-Attention-pytorch
ECAAttention
false
14,112
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
MlpBlock
import torch from torch import nn class MlpBlock(nn.Module): def __init__(self, input_dim, mlp_dim=512): super().__init__() self.fc1 = nn.Linear(input_dim, mlp_dim) self.gelu = nn.GELU() self.fc2 = nn.Linear(mlp_dim, input_dim) def forward(self, x): return self.fc2(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.triton_helpers import libdevice from torch import n...
Nitin-Mane/External-Attention-pytorch
MlpBlock
false
14,113
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
OutlookAttention
import math import torch from torch import nn from torch.nn import functional as F class OutlookAttention(nn.Module): def __init__(self, dim, num_heads=1, kernel_size=3, padding=1, stride=1, qkv_bias=False, attn_drop=0.1): super().__init__() self.dim = dim self.num_heads = num_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....
Nitin-Mane/External-Attention-pytorch
OutlookAttention
false
14,114
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
Encoder5
import torch import numpy as np import torch.nn as nn class Encoder5(nn.Module): def __init__(self, model=None, fixed=False): super(Encoder5, self).__init__() self.fixed = fixed self.conv0 = nn.Conv2d(3, 3, 1, 1, 0) self.conv0.weight = nn.Parameter(torch.from_numpy(np.array([[[[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....
MingSun-Tse/Collaborative-Distillation
Encoder5
false
14,115
[ "MIT" ]
172
915712674af82ff91d926d922c14988cce0430f3
https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3
SincFilter
import torch import numpy as np import torch.utils.data import torch.nn as torch_nn class SincFilter(torch_nn.Module): """ SincFilter Given the cut-off-frequency, produce the low-pass and high-pass windowed-sinc-filters. If input cut-off-frequency is (batchsize=1, signal_length, 1), ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np import torch.utils.data import torch.nn as torch_nn as...
Ninushkat/Impact-Synth-Hardware
SincFilter
false
14,116
[ "MIT" ]
55
37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
https://github.com/Ninushkat/Impact-Synth-Hardware/tree/37a2ecfec51b052b39d1ad0d4676f09d5f00e3c2
ScaledDotProductAttention
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nitin-Mane/External-Attention-pytorch
ScaledDotProductAttention
false
14,117
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
GetMask
import torch class GetMask(torch.nn.Module): """ inputs: x: any size outputs:mask: same size as input x """ def __init__(self, pad_idx=0): super(GetMask, self).__init__() self.pad_idx = pad_idx def forward(self, x): mask = torch.ne(x, self.pad_idx).floa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
NoteXYX/ACL2017
GetMask
false
14,118
[ "Apache-2.0" ]
119
436f59f2aa0044a9d57c95a2a58b2158cb99738d
https://github.com/NoteXYX/ACL2017/tree/436f59f2aa0044a9d57c95a2a58b2158cb99738d
SpatialAttention
import torch from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super().__init__() self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding= kernel_size // 2) self.sigmoid = nn.Sigmoid() def forward(self, x): max_result,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Nitin-Mane/External-Attention-pytorch
SpatialAttention
false
14,119
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
UFOAttention
import torch from torch import nn from torch.nn import init def XNorm(x, gamma): norm_tensor = torch.norm(x, 2, -1, True) return x * gamma / norm_tensor class UFOAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
Nitin-Mane/External-Attention-pytorch
UFOAttention
false
14,120
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
NoopLoss
from torch.nn import Module import functools import torch import torch.utils.data import torch.nn as nn from torchvision.models import * import torch.nn.init class NoopLoss(Module): """Just returns the mean of the `output`.""" def forward(self, output, *args): return output.mean() class PrePostInit...
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 import functools import torch.utils.data import torch.nn as n...
JiahuaWU/fastai
NoopLoss
false
14,121
[ "Apache-2.0" ]
59
13a2df812d875abf0558004283392ab40d9bdea1
https://github.com/JiahuaWU/fastai/tree/13a2df812d875abf0558004283392ab40d9bdea1
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...
P2333/Bag-of-Tricks-for-AT
ShuffleBlock
false
14,122
[ "Apache-2.0" ]
192
314683adcfe9ea7c7bfbff50007da510b21f56e1
https://github.com/P2333/Bag-of-Tricks-for-AT/tree/314683adcfe9ea7c7bfbff50007da510b21f56e1
Attention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.optim 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: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NouamaneTazi/conv-emotion
Attention
false
14,123
[ "MIT" ]
488
0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
https://github.com/NouamaneTazi/conv-emotion/tree/0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
SimpleAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class SimpleAttention(nn.Module): def __init__(self, input_dim): super(SimpleAttention, self).__init__() self.input_dim = input_dim self.scalar = nn.Linear(self.input_dim, 1, bias=False) def forward...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NouamaneTazi/conv-emotion
SimpleAttention
false
14,124
[ "MIT" ]
488
0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
https://github.com/NouamaneTazi/conv-emotion/tree/0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
MaskedMSELoss
import torch import torch.nn as nn import torch.optim class MaskedMSELoss(nn.Module): def __init__(self): super(MaskedMSELoss, self).__init__() self.loss = nn.MSELoss(reduction='sum') def forward(self, pred, target, mask): """ pred -> batch*seq_len target -> batch*seq...
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.optim assert_size_stride = torch._C._dynamo.guards.ass...
NouamaneTazi/conv-emotion
MaskedMSELoss
false
14,125
[ "MIT" ]
488
0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
https://github.com/NouamaneTazi/conv-emotion/tree/0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
GraphAttentionLayer
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nmegha2601/activitygraph_transformer
GraphAttentionLayer
false
14,126
[ "MIT" ]
63
4e21a4ea12527df470b7586d149fa4168a41307c
https://github.com/Nmegha2601/activitygraph_transformer/tree/4e21a4ea12527df470b7586d149fa4168a41307c
MaskedSoftmax
import torch from torch.nn import functional as F import torch.utils.data import torch.nn as nn class MaskedSoftmax(nn.Module): def __init__(self, dim): super(MaskedSoftmax, self).__init__() self.dim = dim def forward(self, logit, mask=None): if mask is None: dist = F.sof...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
Nullius-2020/TAKG-Paddle
MaskedSoftmax
false
14,127
[ "MIT" ]
130
7ebb5c4cdd1d2c68b1ca4a518b73c5e815fc5812
https://github.com/Nullius-2020/TAKG-Paddle/tree/7ebb5c4cdd1d2c68b1ca4a518b73c5e815fc5812
DAModule
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nitin-Mane/External-Attention-pytorch
DAModule
false
14,128
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
Attention
import torch import torch.nn as nn def masked_softmax(x, m=None, axis=-1): """ Softmax with mask (optional) """ x = torch.clamp(x, min=-15.0, max=15.0) if m is not None: m = m.float() x = x * m e_x = torch.exp(x - torch.max(x, dim=axis, keepdim=True)[0]) if m is not None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NoteXYX/ACL2017
Attention
false
14,129
[ "Apache-2.0" ]
119
436f59f2aa0044a9d57c95a2a58b2158cb99738d
https://github.com/NoteXYX/ACL2017/tree/436f59f2aa0044a9d57c95a2a58b2158cb99738d
FastRCNNPredictor
import torch import torch.nn.functional as F from torch import nn class FastRCNNPredictor(nn.Module): def __init__(self, in_channels, mid_channels, num_classes): super().__init__() self.fc1 = nn.Linear(in_channels, mid_channels) self.fc2 = nn.Linear(mid_channels, mid_channels) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Okery/PyTorch-Simple-MaskRCNN
FastRCNNPredictor
false
14,130
[ "MIT" ]
147
5e57a353f211c7130bfcf1d55cacd80057d81423
https://github.com/Okery/PyTorch-Simple-MaskRCNN/tree/5e57a353f211c7130bfcf1d55cacd80057d81423
StandardNLL
import torch class StandardNLL(torch.nn.modules.loss._Loss): """ Shape: log_prob: batch x time x class y_true: batch x time mask: batch x time output: batch """ def forward(self, log_prob, y_true, mask): mask = mask.float() log_P = 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
NoteXYX/ACL2017
StandardNLL
false
14,131
[ "Apache-2.0" ]
119
436f59f2aa0044a9d57c95a2a58b2158cb99738d
https://github.com/NoteXYX/ACL2017/tree/436f59f2aa0044a9d57c95a2a58b2158cb99738d
GraphEncoderDecoderAttentionLayer
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F class GraphEncoderDecoderAttentionLayer(nn.Module): """ Graph-to-Graph message passing, adapted from https://arxiv.org/abs/1710.10903 """ def __init__(self, in_src_features, in_tgt_features, out_fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nmegha2601/activitygraph_transformer
GraphEncoderDecoderAttentionLayer
false
14,132
[ "MIT" ]
63
4e21a4ea12527df470b7586d149fa4168a41307c
https://github.com/Nmegha2601/activitygraph_transformer/tree/4e21a4ea12527df470b7586d149fa4168a41307c
h_tanh
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class h_tanh(nn.Module): def __init__(self, inplace=True, h_max=1): super(h_tanh, self).__init__() self.relu = nn.ReLU6(inplace=inplace) self.h_max = ...
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.optim import torch.utils.data...
PINTO0309/micronet
h_tanh
false
14,133
[ "MIT" ]
221
97ff01d0ea9a42f0a3f0a93ac67660df26411f28
https://github.com/PINTO0309/micronet/tree/97ff01d0ea9a42f0a3f0a93ac67660df26411f28
AllReduceLinear
import torch from torch import Tensor import torch.distributed as dist import torch.nn as nn from torch.nn import Linear class ParallelModule(nn.Module): """Parents of all parallel layer classes""" def __init__(self): super().__init__() self.mp_group = None def allreduce(self, outputs): ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 as dist import torch.nn as nn from torch.nn import Line...
Oaklight/parallelformers
AllReduceLinear
false
14,134
[ "Apache-2.0" ]
454
57fc36f81734c29aaf814e092ce13681d3c28ede
https://github.com/Oaklight/parallelformers/tree/57fc36f81734c29aaf814e092ce13681d3c28ede
DenseSAGEConv
import math import torch import torch.nn.functional as F import torch.utils.data from torch.nn import Parameter def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class DenseSAGEConv(torch.nn.Module): def __init__(self, in_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 from torch._inductor.runtime....
NunoEdgarGFlowHub/pytorch_geometric
DenseSAGEConv
false
14,135
[ "MIT" ]
62
4a03a7e6484c38805a24a2e7362ef32b7e279036
https://github.com/NunoEdgarGFlowHub/pytorch_geometric/tree/4a03a7e6484c38805a24a2e7362ef32b7e279036
RPNHead
import torch import torch.nn.functional as F from torch import nn class RPNHead(nn.Module): def __init__(self, in_channels, num_anchors): super().__init__() self.conv = nn.Conv2d(in_channels, in_channels, 3, 1, 1) self.cls_logits = nn.Conv2d(in_channels, num_anchors, 1) self.bbox_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Okery/PyTorch-Simple-MaskRCNN
RPNHead
false
14,136
[ "MIT" ]
147
5e57a353f211c7130bfcf1d55cacd80057d81423
https://github.com/Okery/PyTorch-Simple-MaskRCNN/tree/5e57a353f211c7130bfcf1d55cacd80057d81423
UnfoldTemporalWindows
import torch import torch.nn as nn class UnfoldTemporalWindows(nn.Module): def __init__(self, window_size, window_stride, window_dilation=1): super().__init__() self.window_size = window_size self.window_stride = window_stride self.window_dilation = window_dilation self.pa...
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...
PINTO0309/MS-G3D
UnfoldTemporalWindows
false
14,137
[ "MIT" ]
343
5f0f7740ed8543bd0e288affca2a76541c83669e
https://github.com/PINTO0309/MS-G3D/tree/5f0f7740ed8543bd0e288affca2a76541c83669e
SSP
import torch import numpy as np from torch import nn import torch.nn.functional as F def ssp(*args, **kwargs): return F.softplus(*args, **kwargs) - np.log(2) class SSP(nn.Softplus): def forward(self, xs): return ssp(xs, self.beta, self.threshold) def get_inputs(): return [torch.rand([4, 4, 4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np from torch import nn import torch.nn.functi...
PKUfjh/deepqmc
SSP
false
14,138
[ "MIT" ]
224
2a948ce712dd4e40568aa35931527e6c874eba73
https://github.com/PKUfjh/deepqmc/tree/2a948ce712dd4e40568aa35931527e6c874eba73
SmallMotionEncoder
import torch import torch.nn as nn import torch.nn.functional as F class SmallMotionEncoder(nn.Module): """ Encodes motion features from the correlation levels of the pyramid and the input flow estimate using convolution layers. Parameters ---------- corr_radius : int Correlation rad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
NeelayS/ezflow
SmallMotionEncoder
false
14,139
[ "MIT" ]
94
b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
https://github.com/NeelayS/ezflow/tree/b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
ElectronicAsymptotic
import torch from torch import nn class ElectronicAsymptotic(nn.Module): """Jastrow factor with a correct electronic cusp. The Jastrow factor is calculated from distances between all pairs of electrons, :math:`d_{ij}`, .. math:: \\mathrm \\gamma :=\\sum_{ij}-\\frac{c}{\\alpha(1+\\alp...
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...
PKUfjh/deepqmc
ElectronicAsymptotic
false
14,140
[ "MIT" ]
224
2a948ce712dd4e40568aa35931527e6c874eba73
https://github.com/PKUfjh/deepqmc/tree/2a948ce712dd4e40568aa35931527e6c874eba73
LossEnergy
import torch from torch import nn class WaveFunctionLoss(nn.Module): """Base class for all wave function loss functions. Any such loss must be derived from the local energy and wave function values, :math:`L(\\{E_\\text{loc}[\\psi],\\ln|\\psi|,w\\})`, using also importance-sampling weights *w*. ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
PKUfjh/deepqmc
LossEnergy
false
14,141
[ "MIT" ]
224
2a948ce712dd4e40568aa35931527e6c874eba73
https://github.com/PKUfjh/deepqmc/tree/2a948ce712dd4e40568aa35931527e6c874eba73
MotionEncoder
import torch import torch.nn as nn import torch.nn.functional as F class MotionEncoder(nn.Module): """ Encodes motion features from the correlation levels of the pyramid and the input flow estimate using convolution layers. Parameters ---------- corr_radius : int Correlation radius o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
NeelayS/ezflow
MotionEncoder
false
14,142
[ "MIT" ]
94
b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
https://github.com/NeelayS/ezflow/tree/b93a48c4adf5021f7eacbfc43220c7efa5ae55cd
ResidualAttention
import torch from torch import nn class ResidualAttention(nn.Module): def __init__(self, channel=512, num_class=1000, la=0.2): super().__init__() self.la = la self.fc = nn.Conv2d(in_channels=channel, out_channels=num_class, kernel_size=1, stride=1, bias=False) def forward...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Nitin-Mane/External-Attention-pytorch
ResidualAttention
false
14,143
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
SLP
import torch import torch.nn.functional as F import torch.utils.data.distributed import torch import torch.nn as nn class SLP(nn.Module): def __init__(self, input_size, logits): super(SLP, self).__init__() self._input_size = input_size self.fc = nn.Linear(input_size, logits) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Pandinosaurus/KungFu
SLP
false
14,144
[ "Apache-2.0" ]
291
80dfa463450330e920b413f65cc49d8e013b84a9
https://github.com/Pandinosaurus/KungFu/tree/80dfa463450330e920b413f65cc49d8e013b84a9
Biaffine
import torch import torch.utils.data.dataloader import torch.nn class Biaffine(torch.nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True): """ :param n_in: size of input :param n_out: number of channels :param bias_x: set bias for x :param bias_x: set bi...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.dataloader import torch.nn assert_size_stride = torch._C...
ParikhKadam/flair
Biaffine
false
14,145
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
PairwiseBCELoss
import torch from abc import abstractmethod import torch.utils.data.dataloader import torch.nn.functional as F from torch import nn import torch.nn class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forward(self, inputs, targets): ...
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 abc im...
ParikhKadam/flair
PairwiseBCELoss
false
14,146
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
NegativeScaledDotProduct
import torch import torch.utils.data.dataloader import torch.nn def dot_product(a: 'torch.Tensor', b: 'torch.Tensor', normalize=False): """ Computes dot product for pairs of vectors. :param normalize: Vectors are normalized (leads to cosine similarity) :return: Matrix with res[i][j] = dot_product(a[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 import torch.utils.data.dataloader import torch.nn assert_size_stride = torch._C...
ParikhKadam/flair
NegativeScaledDotProduct
false
14,147
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
CAModel
import torch import torch.nn as nn import torch.nn.functional as F class CAModel(nn.Module): def __init__(self, env_d): super(CAModel, self).__init__() self.conv1 = nn.Conv2d(env_d * 3, 232, 1) self.conv2 = nn.Conv2d(232, env_d, 1) nn.init.zeros_(self.conv2.weight) nn.init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
PWhiddy/Growing-Neural-Cellular-Automata-Pytorch
CAModel
false
14,148
[ "Apache-2.0" ]
47
73a68e9a9cd0c3c14e590238f098937dc0f5c888
https://github.com/PWhiddy/Growing-Neural-Cellular-Automata-Pytorch/tree/73a68e9a9cd0c3c14e590238f098937dc0f5c888
ConvertPointsFromHomogeneous
import torch import torch.nn as nn def convert_points_from_homogeneous(points): """Function that converts points from homogeneous to Euclidean space. See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tg...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Paultool/frankmocap
ConvertPointsFromHomogeneous
false
14,149
[ "BSD-3-Clause" ]
1,612
b8bb7b587c0841b9292edb147729de581c66054c
https://github.com/Paultool/frankmocap/tree/b8bb7b587c0841b9292edb147729de581c66054c
ParallelPolarizedSelfAttention
import torch from torch import nn class ParallelPolarizedSelfAttention(nn.Module): def __init__(self, channel=512): super().__init__() self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1)) self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1)) self.softmax_channel = 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....
Nitin-Mane/External-Attention-pytorch
ParallelPolarizedSelfAttention
false
14,150
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
ConvertPointsToHomogeneous
import torch import torch.nn as nn def convert_points_to_homogeneous(points): """Function that converts points from Euclidean to homogeneous space. See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tgm.co...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Paultool/frankmocap
ConvertPointsToHomogeneous
false
14,151
[ "BSD-3-Clause" ]
1,612
b8bb7b587c0841b9292edb147729de581c66054c
https://github.com/Paultool/frankmocap/tree/b8bb7b587c0841b9292edb147729de581c66054c
Affine
import torch from torch import nn class Affine(nn.Module): def __init__(self, channel): super().__init__() self.g = nn.Parameter(torch.ones(1, 1, channel)) self.b = nn.Parameter(torch.zeros(1, 1, channel)) def forward(self, x): return x * self.g + self.b def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Nitin-Mane/External-Attention-pytorch
Affine
false
14,152
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
LogitCosineDistance
import torch import torch.utils.data.dataloader import torch.nn def dot_product(a: 'torch.Tensor', b: 'torch.Tensor', normalize=False): """ Computes dot product for pairs of vectors. :param normalize: Vectors are normalized (leads to cosine similarity) :return: Matrix with res[i][j] = dot_product(a[i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ParikhKadam/flair
LogitCosineDistance
false
14,153
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
CosineDistance
import torch import torch.utils.data.dataloader import torch.nn def dot_product(a: 'torch.Tensor', b: 'torch.Tensor', normalize=False): """ Computes dot product for pairs of vectors. :param normalize: Vectors are normalized (leads to cosine similarity) :return: Matrix with res[i][j] = dot_product(a[i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ParikhKadam/flair
CosineDistance
false
14,154
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
CRF
import torch import torch.utils.data.dataloader import torch.nn class CRF(torch.nn.Module): """ Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previ...
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.dataloader import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
ParikhKadam/flair
CRF
false
14,155
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
VectorCrossEntropy
import torch import torch.nn as nn class VectorCrossEntropy(nn.Module): def __init__(self): super().__init__() self._log_softmax = nn.LogSoftmax(dim=1) def forward(self, input, target): input = self._log_softmax(input) loss = -torch.sum(input * target) loss = loss / i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
PavelOstyakov/pipeline
VectorCrossEntropy
false
14,156
[ "MIT" ]
214
236c050af3be9dbb534e959589040e9433501e2b
https://github.com/PavelOstyakov/pipeline/tree/236c050af3be9dbb534e959589040e9433501e2b
PositionAttentionModule
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nitin-Mane/External-Attention-pytorch
PositionAttentionModule
false
14,157
[ "MIT" ]
4,466
1ceda306c41063af11c956334747763444a4d83f
https://github.com/Nitin-Mane/External-Attention-pytorch/tree/1ceda306c41063af11c956334747763444a4d83f
IrisClassifier
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class IrisClassifier(nn.Module): def __init__(self): super(IrisClassifier, self).__init__() self.fc1 = nn.Linear(4, 10) self.fc2 = nn.Linear(10, 10) self.fc3 = nn.Linear(10, 3) def forward(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 import ...
PeterSulcs/mlflow
IrisClassifier
false
14,158
[ "Apache-2.0" ]
10,351
14c48e7bb1ca6cd6a3c1b249a486cd98bd5e7051
https://github.com/PeterSulcs/mlflow/tree/14c48e7bb1ca6cd6a3c1b249a486cd98bd5e7051
SoftmaxCELoss
from torch.nn import Module import torch from torch.nn import functional as F from torch import nn class SoftmaxCELoss(Module): def __init__(self, num_classes, num_features, dropout=0.5): super(SoftmaxCELoss, self).__init__() self.num_classes = num_classes self.num_features = num_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....
Pandinosaurus/RandPerson
SoftmaxCELoss
false
14,159
[ "Apache-2.0" ]
83
7dd503cc1d063d95b8cf6b43d40bb93452192d6d
https://github.com/Pandinosaurus/RandPerson/tree/7dd503cc1d063d95b8cf6b43d40bb93452192d6d
CoordFC
import torch import numpy as np from torch import nn class SinActivation(nn.Module): def __init__(self): super(SinActivation, self).__init__() def forward(self, x): return torch.sin(x) class CoordFC(nn.Module): def __init__(self, input_dim, hidden_dim): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
PeterouZh/CIPS-3D
CoordFC
false
14,160
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
LinearScale
import torch from torch import nn class LinearScale(nn.Module): def __init__(self, scale, bias): super(LinearScale, self).__init__() self.scale_v = scale self.bias_v = bias pass def forward(self, x): out = x * self.scale_v + self.bias_v return out def __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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
PeterouZh/CIPS-3D
LinearScale
false
14,161
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
CoordConvSinAct
import torch from torch import nn class SinAct(nn.Module): def __init__(self): super(SinAct, self).__init__() def forward(self, x): return torch.sin(x) class CoordConvSinAct(nn.Module): """ Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py """ 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.triton_helpers import math as tl_math from torch im...
PeterouZh/CIPS-3D
CoordConvSinAct
false
14,162
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
GlobalAveragePooling
import torch from torch import nn class GlobalAveragePooling(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x.mean([2, 3]) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
PeterouZh/CIPS-3D
GlobalAveragePooling
false
14,163
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
EuclideanDistance
import torch from torch import Tensor import torch.utils.data.dataloader from torch import nn import torch.nn def arccosh(x): """Compute the arcosh, numerically stable.""" x = torch.clamp(x, min=1 + EPSILON) a = torch.log(x) b = torch.log1p(torch.sqrt(x * x - 1) / x) return a + b def mdot(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 import torch.utils.data.dataloader from torch import nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
ParikhKadam/flair
EuclideanDistance
false
14,164
[ "MIT" ]
7,539
a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
https://github.com/ParikhKadam/flair/tree/a1732bc5ab0b4aeb09d1ed3a630ae2fd8fa095ef
MultiHeadAttn
import torch from torch import 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_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
PeganovAnton/transformer-xl
MultiHeadAttn
false
14,165
[ "Apache-2.0" ]
133
f36428445cc903872fde54d90bc5e61886420a5a
https://github.com/PeganovAnton/transformer-xl/tree/f36428445cc903872fde54d90bc5e61886420a5a
UniformBoxWarp
import torch from torch import nn class UniformBoxWarp(nn.Module): def __init__(self, sidelength): super().__init__() self.scale_factor = 2 / sidelength def forward(self, coordinates): return coordinates * self.scale_factor def get_inputs(): return [torch.rand([4, 4, 4, 4])] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
PeterouZh/CIPS-3D
UniformBoxWarp
false
14,166
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
WideResNet
import math import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): m = 2 def __init__(self, in_planes, out_planes, stride, dropout, fixup_l, fixup_coeff): super(BasicBlock, self).__init__() self._dropout = dropout self.relu = nn.ReLU(in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
PavelOstyakov/pipeline
WideResNet
false
14,167
[ "MIT" ]
214
236c050af3be9dbb534e959589040e9433501e2b
https://github.com/PavelOstyakov/pipeline/tree/236c050af3be9dbb534e959589040e9433501e2b
SinActivation
import torch from torch import nn class SinActivation(nn.Module): def __init__(self): super(SinActivation, self).__init__() def forward(self, x): return torch.sin(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
PeterouZh/CIPS-3D
SinActivation
false
14,168
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
EqualConvTranspose2d
import math import torch import torch.nn.functional as F from torch import nn class EqualConvTranspose2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True): super().__init__() self.weight = nn.Parameter(torch.randn(in_channel, out_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 math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
PeterouZh/CIPS-3D
EqualConvTranspose2d
false
14,169
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
CLNLayer
import torch import torch.nn.functional as F from torch import nn class CLN(nn.Module): def __init__(self, in_dim, use_style_fc=False, style_dim=None, which_linear=nn.Linear, spectral_norm=False, eps=1e-05, **kwargs): super(CLN, self).__init__() self.in_dim = in_dim self.use_style...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
PeterouZh/CIPS-3D
CLNLayer
false
14,170
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
Smoother
from torch.nn import Module import torch from torch import Tensor from typing import Optional import torch.nn.functional as F from torch.nn import Dropout from torch.nn import LayerNorm from torch.nn import Conv1d from torch.nn import MultiheadAttention class Smoother(Module): """Convolutional Transformer 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
OlegJakushkin/FragmentVC
Smoother
false
14,171
[ "MIT" ]
136
8aa673157b855bf3b67f06fdb6eb4b2a12ed0005
https://github.com/OlegJakushkin/FragmentVC/tree/8aa673157b855bf3b67f06fdb6eb4b2a12ed0005
StridedStyle
import torch import torch.nn as nn class NamedTensor(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x class StridedStyle(nn.ModuleList): def __init__(self, n_latents): super().__init__([NamedTensor() for _ in range(n_latents)]) self.n_l...
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...
PeterouZh/GAN2Shape
StridedStyle
false
14,172
[ "MIT" ]
421
ea077e543a3fb824ce06385e8a837dcbae8e9aaa
https://github.com/PeterouZh/GAN2Shape/tree/ea077e543a3fb824ce06385e8a837dcbae8e9aaa
FiLMLayer
import torch from torch import nn class FiLMLayer(nn.Module): def __init__(self, input_dim, hidden_dim): super().__init__() self.layer = nn.Linear(input_dim, hidden_dim) def forward(self, x, freq, phase_shift): x = self.layer(x) freq = freq.unsqueeze(1).expand_as(x) 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.triton_helpers import math as tl_math from torch im...
PeterouZh/CIPS-3D
FiLMLayer
false
14,173
[ "MIT" ]
308
9b8bfa0fb23f642af042e150ccd70408f9d137c6
https://github.com/PeterouZh/CIPS-3D/tree/9b8bfa0fb23f642af042e150ccd70408f9d137c6
RKDAngleLoss
import torch import torch.nn as nn from torch.nn import functional as F class RKDAngleLoss(nn.Module): """ Module for calculating RKD Angle Loss """ def forward(self, teacher, student, normalize=True): """ Forward function :param teacher (torch.FloatTensor): Prediction made 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....
PiaCuk/KD_Lib
RKDAngleLoss
false
14,174
[ "MIT" ]
360
153299d484e4c6b33793749709dbb0f33419f190
https://github.com/PiaCuk/KD_Lib/tree/153299d484e4c6b33793749709dbb0f33419f190