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
Conv1d
import torch import torch.nn as nn import torch.nn.functional as F class Conv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding='same'): """ inputs: [N, T, C_in] outputs: [N, T, C_out] """ super().__init__() if paddi...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Sala7efelninja/GST-Tacotron
Conv1d
false
11,853
[ "MIT" ]
0
e69a5663832a2c3639d4afbb85092a35be621380
https://github.com/Sala7efelninja/GST-Tacotron/tree/e69a5663832a2c3639d4afbb85092a35be621380
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_dim, num_units, num_heads): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Sala7efelninja/GST-Tacotron
MultiHeadAttention
false
11,854
[ "MIT" ]
0
e69a5663832a2c3639d4afbb85092a35be621380
https://github.com/Sala7efelninja/GST-Tacotron/tree/e69a5663832a2c3639d4afbb85092a35be621380
ATOCAttentionUnit
import torch from typing import Union from typing import Dict import torch.nn as nn 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__, forward .. note:: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
PaParaZz1/DI-engine
ATOCAttentionUnit
false
11,855
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
Head
import torch import torch.nn as nn 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=kernel_size // 2, bias=bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
PaParaZz1/DI-engine
Head
false
11,856
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
FeatureEmbedder
import torch import numpy as np import torch.nn as nn from torch.utils import tensorboard as tensorboard class FeatureEmbedder(nn.Module): def __init__(self, d_feat, d_model): super(FeatureEmbedder, self).__init__() self.d_model = d_model self.embedder = nn.Linear(d_feat, d_model) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
Harbar-Inbound/BMT
FeatureEmbedder
false
11,857
[ "MIT" ]
0
ec8826f0633db754c7ea8d206672aa0b6b6048fd
https://github.com/Harbar-Inbound/BMT/tree/ec8826f0633db754c7ea8d206672aa0b6b6048fd
BinaryCrossEntropyLoss
import torch import torch.nn as nn class BinaryCrossEntropyLoss(nn.Module): """Cross entropy loss with label smoothing regularizer. Reference: Szegedy et al. Rethinking the Inception Architecture for Computer Vision. CVPR 2016. With label smoothing, the label :math:`y` for a class is computed by...
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...
RndmVariableQ/deep-person-reid
BinaryCrossEntropyLoss
false
11,858
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
Skew
import torch import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Skew(nn.Module): def forward(self, X): A = X.triu(1) return A - A.transpose(-1, -2) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import to...
LeeSHa00/PyTorch-tutorials-kr
Skew
false
11,859
[ "BSD-3-Clause" ]
0
6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
MetaBilinear
import re import torch import warnings import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ---...
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 re import warnings import torch.nn as nn from collections import OrderedDict assert_size_stride = torch._C._dynamo.guards.assert_size...
SDivakarBhat/pytorch-meta
MetaBilinear
false
11,860
[ "MIT" ]
0
74cbc8ae625d85c6b954aad159ccb26b523b2240
https://github.com/SDivakarBhat/pytorch-meta/tree/74cbc8ae625d85c6b954aad159ccb26b523b2240
BridgeConnection
import torch import torch.nn as nn from torch.utils import tensorboard as tensorboard class BridgeConnection(nn.Module): def __init__(self, in_dim, out_dim, dout_p): super(BridgeConnection, self).__init__() self.norm = nn.LayerNorm(in_dim) self.linear = nn.Linear(in_dim, out_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....
Harbar-Inbound/BMT
BridgeConnection
false
11,861
[ "MIT" ]
0
ec8826f0633db754c7ea8d206672aa0b6b6048fd
https://github.com/Harbar-Inbound/BMT/tree/ec8826f0633db754c7ea8d206672aa0b6b6048fd
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...
SeanDeloddere/ModelsGenesis
OutputTransition
false
11,862
[ "MIT" ]
0
1c4d1439626b42906311a38aa5f8d4fbd7a2517a
https://github.com/SeanDeloddere/ModelsGenesis/tree/1c4d1439626b42906311a38aa5f8d4fbd7a2517a
MultiheadedAttention
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from torch.utils import tensorboard as tensorboard def attention(Q, K, V, mask, dropout=None): d_k = Q.size(-1) QKt = Q.matmul(K.transpose(-1, -2)) sm_input = QKt / np.sqrt(d_k) if mask is not None: sm_input ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Harbar-Inbound/BMT
MultiheadedAttention
false
11,863
[ "MIT" ]
0
ec8826f0633db754c7ea8d206672aa0b6b6048fd
https://github.com/Harbar-Inbound/BMT/tree/ec8826f0633db754c7ea8d206672aa0b6b6048fd
MultiHeadAttention
import torch import torch.nn.functional as F import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, in_dim, out_dim, out_heads, relation_dim=0, residual =False, projection=True, layer_norm=True): super().__init__() self.in_dim = in_dim self.out_dim = out_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....
PaParaZz1/DI-engine
MultiHeadAttention
false
11,864
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
RewardModelNetwork
import torch import torch.nn as nn 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 = nn.Linear(hidden_size, ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
PaParaZz1/DI-engine
RewardModelNetwork
false
11,865
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
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...
RndmVariableQ/deep-person-reid
AvgPoolPad
false
11,866
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
Log_Cosh_Loss
import torch class Log_Cosh_Loss(torch.nn.Module): def forward(self, logits, labels): return torch.mean(torch.log(torch.cosh(labels - logits))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
ShengboWang1/wave-u-net-DEMAND28
Log_Cosh_Loss
false
11,867
[ "MIT" ]
0
fe8b57220d885d5fdad33b303c0565f2286ba549
https://github.com/ShengboWang1/wave-u-net-DEMAND28/tree/fe8b57220d885d5fdad33b303c0565f2286ba549
Simplified_Pose_Model
import torch from collections import OrderedDict import torch.nn as nn def make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 collections import Order...
Schwartz-Zha/My_Pose_Estimation
Simplified_Pose_Model
false
11,868
[ "MIT" ]
0
0ccaccf58498b2200842c155b735e1103c28c5ba
https://github.com/Schwartz-Zha/My_Pose_Estimation/tree/0ccaccf58498b2200842c155b735e1103c28c5ba
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 ...
RndmVariableQ/deep-person-reid
HardAttn
false
11,869
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
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 ...
Shi-Yuyao/SSD_Pytorch
FocalLossSigmoid
false
11,870
[ "MIT" ]
0
870732682935a8523b5232fac3bdb080c5a59cf9
https://github.com/Shi-Yuyao/SSD_Pytorch/tree/870732682935a8523b5232fac3bdb080c5a59cf9
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...
RndmVariableQ/deep-person-reid
MaxPoolPad
false
11,871
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
VAE
import torch from torch import nn import torch.nn.functional as F class VAE(nn.Module): def __init__(self, n_features): super(VAE, self).__init__() self.fc1 = nn.Linear(n_features, 1000) self.fc2 = nn.Linear(1000, n_features) def encode(self, x): h1 = F.relu(self.fc1(x)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
ShengquanChen/stPlus
VAE
false
11,872
[ "MIT" ]
0
b2af43a4fe78230ddf95cab75c114e25527800e1
https://github.com/ShengquanChen/stPlus/tree/b2af43a4fe78230ddf95cab75c114e25527800e1
ContinousRotReprDecoder
import torch import torch.nn as nn import torch.nn.functional as F class ContinousRotReprDecoder(nn.Module): def __init__(self): super(ContinousRotReprDecoder, self).__init__() def forward(self, module_input): reshaped_input = module_input.view(-1, 3, 2) b1 = F.normalize(reshaped_inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
ShivamDuggal4/human_body_prior
ContinousRotReprDecoder
false
11,873
[ "Xnet", "X11" ]
0
e5544560e98ff3bb6d2492b2b32660dd3defed92
https://github.com/ShivamDuggal4/human_body_prior/tree/e5544560e98ff3bb6d2492b2b32660dd3defed92
ScaleNorm
import torch import torch.nn as nn class ScaleNorm(nn.Module): """ScaleNorm""" def __init__(self, scale, eps=1e-05): super(ScaleNorm, self).__init__() self.scale = scale self.eps = eps def forward(self, x): norm = self.scale / torch.norm(x, dim=1, keepdim=True).clamp(min=...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Siujohnjai/MS-G3D
ScaleNorm
false
11,874
[ "MIT" ]
0
615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
https://github.com/Siujohnjai/MS-G3D/tree/615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
Charbonnier
import torch import torch.nn as nn import torch.utils.model_zoo class Charbonnier(nn.Module): def __init__(self): super(Charbonnier, self).__init__() self.eps = 1e-06 def forward(self, X, Y): diff = torch.add(X, -Y) error = torch.sqrt(diff * diff + self.eps) loss = to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
SimoneDutto/EDSR
Charbonnier
false
11,875
[ "MIT" ]
0
a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
https://github.com/SimoneDutto/EDSR/tree/a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
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...
Siujohnjai/MS-G3D
UnfoldTemporalWindows
false
11,876
[ "MIT" ]
0
615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
https://github.com/Siujohnjai/MS-G3D/tree/615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
Policy
import torch import torch.nn.functional as F import torch.nn as nn class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False) self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4) self.size = 9 * 9...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ShirelJosef/deep-reinforcement-learning
Policy
false
11,877
[ "MIT" ]
0
63979b975c71e730c9d4c66e39efac210260dd18
https://github.com/ShirelJosef/deep-reinforcement-learning/tree/63979b975c71e730c9d4c66e39efac210260dd18
FeatureResizer
import torch import torch.utils.data import torch import torch.nn import torch.optim import torch.utils from torch import nn import torch.distributed class FeatureResizer(nn.Module): """ This class takes as input a set of embeddings of dimension C1 and outputs a set of embedding of dimension C2, after a l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ShoufaChen/mdetr-1
FeatureResizer
false
11,878
[ "Apache-2.0" ]
0
3d9e40891ffdd39d6a5bf56730d468ace142752f
https://github.com/ShoufaChen/mdetr-1/tree/3d9e40891ffdd39d6a5bf56730d468ace142752f
Cauchy
import torch import torch.nn as nn import torch.utils.model_zoo class Cauchy(nn.Module): def __init__(self): super(Cauchy, self).__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = 0.5 * self.c ** 2 * torch.log(1 + (ra / sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
SimoneDutto/EDSR
Cauchy
false
11,879
[ "MIT" ]
0
a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
https://github.com/SimoneDutto/EDSR/tree/a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
StableBCELoss
import torch class StableBCELoss(torch.nn.modules.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Song-Jingyu/Cylinder3D
StableBCELoss
false
11,880
[ "Apache-2.0" ]
0
36b59db5b45850b9657a9606e39c084dd650d750
https://github.com/Song-Jingyu/Cylinder3D/tree/36b59db5b45850b9657a9606e39c084dd650d750
BCEAfterSigmoidLoss
import torch from torch import nn from torch.nn import functional import torch.autograd class Loss(nn.Module): """A loss function.""" class PointwiseLoss(Loss): """Pointwise loss functions compute an independent loss term for each triple-label pair.""" class BCEAfterSigmoidLoss(PointwiseLoss): """A lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Sina-Baharlou/pykeen
BCEAfterSigmoidLoss
false
11,881
[ "MIT" ]
0
89984e0f7a490f3c0f0d936564b7744097130d15
https://github.com/Sina-Baharlou/pykeen/tree/89984e0f7a490f3c0f0d936564b7744097130d15
Fair
import torch import torch.nn as nn import torch.utils.model_zoo class Fair(nn.Module): def __init__(self): super(Fair, self).__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = self.c ** 2 * (ra / self.c - torch.log(1 + ra /...
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 ...
SimoneDutto/EDSR
Fair
false
11,882
[ "MIT" ]
0
a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
https://github.com/SimoneDutto/EDSR/tree/a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
OneLayerFCBodyWithAction
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class OneLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
RaviTej310/mrpvf
OneLayerFCBodyWithAction
false
11,883
[ "MIT" ]
0
f026b4704f26b85161de26ada5d6390ab549fbbd
https://github.com/RaviTej310/mrpvf/tree/f026b4704f26b85161de26ada5d6390ab549fbbd
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ShirelJosef/deep-reinforcement-learning
Actor
false
11,884
[ "MIT" ]
0
63979b975c71e730c9d4c66e39efac210260dd18
https://github.com/ShirelJosef/deep-reinforcement-learning/tree/63979b975c71e730c9d4c66e39efac210260dd18
Encoder
import torch from torch import nn from torch.nn import functional as F class Encoder(nn.Module): def __init__(self, channel=512, out_class=1, is_dis=True): super(Encoder, self).__init__() self.is_dis = is_dis self.channel = channel n_class = out_class self.conv1 = nn.Conv3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ShadowTwin41/alpha-WGAN-SigmaRat
Encoder
false
11,885
[ "MIT" ]
0
051bb8c5d7b8248e9c724d3de87c0fd771d7070f
https://github.com/ShadowTwin41/alpha-WGAN-SigmaRat/tree/051bb8c5d7b8248e9c724d3de87c0fd771d7070f
Critic
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
ShirelJosef/deep-reinforcement-learning
Critic
false
11,886
[ "MIT" ]
0
63979b975c71e730c9d4c66e39efac210260dd18
https://github.com/ShirelJosef/deep-reinforcement-learning/tree/63979b975c71e730c9d4c66e39efac210260dd18
RegressorNet
import torch import numpy as np from torch import nn from torch import optim from torch import relu def weighted_mse_loss(inputs, target, sample_weight): if sample_weight is not None: return (sample_weight * (inputs - target) ** 2).mean() else: return ((inputs - target) ** 2).mean() class Re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 numpy as np from torch...
SirPopiel/IWDA
RegressorNet
false
11,887
[ "MIT" ]
0
5693b0704f1abf9f69f92fba243599c5f4056a3c
https://github.com/SirPopiel/IWDA/tree/5693b0704f1abf9f69f92fba243599c5f4056a3c
MultiAttributeLoss
import torch import torch.nn.functional as F class MultiAttributeLoss(torch.nn.Module): def __init__(self): super(MultiAttributeLoss, self).__init__() def forward(self, input, target): product = 1 count = len(input) for i in range(count): attribute_loss = F.cross_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Spandan-Madan/generalization_biased_category_pose
MultiAttributeLoss
false
11,888
[ "MIT" ]
0
c7c289c9a75544782d5240af2286cfdd03c4b35e
https://github.com/Spandan-Madan/generalization_biased_category_pose/tree/c7c289c9a75544782d5240af2286cfdd03c4b35e
TorchJaccardLoss
import torch class TorchJaccardLoss(torch.nn.modules.Module): def __init__(self): super(TorchJaccardLoss, self).__init__() def forward(self, outputs, targets): eps = 1e-15 jaccard_target = (targets == 1).float() jaccard_output = torch.sigmoid(outputs) intersection = (...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Spiruel/solaris
TorchJaccardLoss
false
11,889
[ "Apache-2.0" ]
0
eb2ce05265a462d69b01ee2b621a85a3e9082402
https://github.com/Spiruel/solaris/tree/eb2ce05265a462d69b01ee2b621a85a3e9082402
h_swish
import torch from torch.nn import functional as F import torch.nn as nn class h_swish(nn.Module): def __init__(self, inplace=True): super(h_swish, self).__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3.0, self.inplace) / 6.0 return out * x def get...
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...
SpikeKing/MobileNetV3-Classification-PyTorch
h_swish
false
11,890
[ "MIT" ]
0
ab8d64c27ace7c70bfd1611bd8452947218d9b21
https://github.com/SpikeKing/MobileNetV3-Classification-PyTorch/tree/ab8d64c27ace7c70bfd1611bd8452947218d9b21
TFSamepaddingLayer
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TFSamepaddingLayer(nn.Module): """To align with tf `same` padding. Putting this before any conv layer that need padding Assuming kernel has Height == Width for simplicity """ def __init__(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Srijay-lab/hover_net
TFSamepaddingLayer
false
11,891
[ "MIT" ]
0
3f28f97bc1ed892bbe00b75a06be4334743d47d5
https://github.com/Srijay-lab/hover_net/tree/3f28f97bc1ed892bbe00b75a06be4334743d47d5
FreqEncoder
import torch import torch.nn as nn class FreqEncoder(nn.Module): def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True, include_input=True, periodic_fns=(torch.sin, torch.cos)): super().__init__() self.input_dim = input_dim self.include_input = include_input ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
StanfordMSL/torch-ngp
FreqEncoder
false
11,892
[ "MIT" ]
0
fc5c70bd5739ce39f7f9765e2ac73ecab86bc64a
https://github.com/StanfordMSL/torch-ngp/tree/fc5c70bd5739ce39f7f9765e2ac73ecab86bc64a
DepthL1Loss
import torch import torch.nn as nn class DepthL1Loss(nn.Module): def __init__(self, eps=1e-05): super(DepthL1Loss, self).__init__() self.eps = eps def forward(self, pred, gt): bs = pred.size()[0] img1 = torch.zeros_like(pred) img2 = torch.zeros_like(gt) img1 =...
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 ...
StannisZhou/FFB6D
DepthL1Loss
false
11,893
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
OFLoss
import torch from torch.nn.modules.loss import _Loss def of_l1_loss(pred_ofsts, kp_targ_ofst, labels, sigma=1.0, normalize=True, reduce=False): """ :param pred_ofsts: [bs, n_kpts, n_pts, c] :param kp_targ_ofst: [bs, n_pts, n_kpts, c] :param labels: [bs, n_pts, 1] """ 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.triton_helpers import math as tl_math from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dy...
StannisZhou/FFB6D
OFLoss
false
11,894
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
TorchFocalLoss
import torch import torch.nn.functional as F from torch import nn class TorchFocalLoss(nn.Module): """Implementation of Focal Loss[1]_ modified from Catalyst [2]_ . Arguments --------- gamma : :class:`int` or :class:`float` Focusing parameter. See [1]_ . alpha : :class:`int` or :class:`fl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Spiruel/solaris
TorchFocalLoss
false
11,895
[ "Apache-2.0" ]
0
eb2ce05265a462d69b01ee2b621a85a3e9082402
https://github.com/Spiruel/solaris/tree/eb2ce05265a462d69b01ee2b621a85a3e9082402
CosLoss
import torch from torch.nn.modules.loss import _Loss class CosLoss(_Loss): def __init__(self, eps=1e-05): super(CosLoss, self).__init__(True) self.eps = eps def forward(self, pred_ofsts, kp_targ_ofst, labels, normalize=True): """ :param pred_ofsts: [bs, n_kpts, n_pts, c]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.g...
StannisZhou/FFB6D
CosLoss
false
11,896
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
Critic
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, full_state_size, full_action_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.triton_helpers import libdevice import numpy as np ...
SriramPingali/P3_collaborate_complete
Critic
false
11,897
[ "MIT" ]
0
66df22c9eb7577b15adcaa7bbc1796dbd333af2e
https://github.com/SriramPingali/P3_collaborate_complete/tree/66df22c9eb7577b15adcaa7bbc1796dbd333af2e
OfstMapL1Loss
import torch import torch.nn as nn class OfstMapL1Loss(nn.Module): def __init__(self, eps=1e-05): super().__init__() self.eps = eps def forward(self, rgb_labels, pred, gt, normalize=True, reduce=True): wgt = (rgb_labels > 1e-08).float() bs, n_kpts, c, h, w = pred.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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
StannisZhou/FFB6D
OfstMapL1Loss
false
11,898
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
Envelope
import torch import torch.utils.data class Envelope(torch.nn.Module): def __init__(self, exponent): super(Envelope, self).__init__() self.p = exponent + 1 self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
THinnerichs/pytorch_geometric
Envelope
false
11,899
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
Actor
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, fc1_uni...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SriramPingali/P3_collaborate_complete
Actor
false
11,900
[ "MIT" ]
0
66df22c9eb7577b15adcaa7bbc1796dbd333af2e
https://github.com/SriramPingali/P3_collaborate_complete/tree/66df22c9eb7577b15adcaa7bbc1796dbd333af2e
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ outputs the limits for the values in the hidden layer for initialisation""" fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl
Actor
false
11,901
[ "MIT" ]
0
f3e811a3ae3eb603173c2475bbfe1de91074ecdc
https://github.com/SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl/tree/f3e811a3ae3eb603173c2475bbfe1de91074ecdc
Conv2d
import torch import torch.nn.functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pair def keep_variance_fn(x): return x + 0.001 class Conv2d(_ConvNd): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=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.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pa...
THAKAORI/SalsaNext
Conv2d
false
11,902
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
Symmetric
import torch import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Symmetric(nn.Module): def forward(self, X): return X.triu() + X.triu(1).transpose(-1, -2) def ge...
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.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import to...
LeeSHa00/PyTorch-tutorials-kr
Symmetric
false
11,903
[ "BSD-3-Clause" ]
0
6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
Softmax
import torch import torch.nn as nn def keep_variance_fn(x): return x + 0.001 class Softmax(nn.Module): def __init__(self, dim=1, keep_variance_fn=None): super(Softmax, self).__init__() self.dim = dim self._keep_variance_fn = keep_variance_fn def forward(self, features_mean, fea...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
THAKAORI/SalsaNext
Softmax
false
11,904
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
APL
import torch from torch import nn from torch.nn.parameter import Parameter class APL(nn.Module): """ Implementation of APL (ADAPTIVE PIECEWISE LINEAR UNITS) unit: .. math:: APL(x_i) = max(0,x) + \\sum_{s=1}^{S}{a_i^s * max(0, -x + b_i^s)} with trainable parameters a and b, parameter...
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 from torch.nn.parameter import Parameter assert_size_stride = torch....
THEFASHIONGEEK/Echo
APL
false
11,905
[ "MIT" ]
0
8dcf279ca528f2bfd255f79de07c1a221512c6a0
https://github.com/THEFASHIONGEEK/Echo/tree/8dcf279ca528f2bfd255f79de07c1a221512c6a0
SimpleNet
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class SimpleNet(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): """Defines layers of a neural network. :param input_dim: Number of input features :param hidden_dim: Size of ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Stas-Medvedev/ML-Case-Studies
SimpleNet
false
11,906
[ "MIT" ]
0
88aa33334245cd028cf3adfba4ba3eecaef32708
https://github.com/Stas-Medvedev/ML-Case-Studies/tree/88aa33334245cd028cf3adfba4ba3eecaef32708
BeitAttention
from _paritybench_helpers import _mock_config import math import torch from typing import List from typing import Tuple from torch import nn from typing import Set import torch.utils.checkpoint def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int', head_size: 'int', already_pruned_heads: 'Set[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 from torch._inductor.runtime....
Clemens123/transformers
BeitAttention
false
11,907
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
BertOutput
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(BertLayerNorm, self).__ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Stephen0808/WebQA
BertOutput
false
11,908
[ "Apache-2.0" ]
0
b9758932a9d0d75167ec837bb6ee8bc571c64681
https://github.com/Stephen0808/WebQA/tree/b9758932a9d0d75167ec837bb6ee8bc571c64681
MaxPool2d
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.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.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
THAKAORI/SalsaNext
MaxPool2d
false
11,909
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
ShiftedSoftplus
import torch import torch.nn.functional as F import torch.utils.data class ShiftedSoftplus(torch.nn.Module): def __init__(self): super(ShiftedSoftplus, self).__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.utils.data assert_size_stride = torch._C._dynamo....
THinnerichs/pytorch_geometric
ShiftedSoftplus
false
11,910
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
SReLU
import torch from torch import nn from torch.nn.parameter import Parameter class SReLU(nn.Module): """ SReLU (S-shaped Rectified Linear Activation Unit): a combination of three linear functions, which perform mapping R → R with the following formulation: .. math:: h(x_i) = \\left\\{\\begin{matri...
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 from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_...
THEFASHIONGEEK/Echo
SReLU
false
11,911
[ "MIT" ]
0
8dcf279ca528f2bfd255f79de07c1a221512c6a0
https://github.com/THEFASHIONGEEK/Echo/tree/8dcf279ca528f2bfd255f79de07c1a221512c6a0
RPN_Up
import torch import torch.nn as nn import torch.nn.functional as F class RPN_Up(nn.Module): """ For SiamRPN """ def __init__(self, anchor_nums=5, inchannels=256, outchannels=256, cls_type='thicker'): super(RPN_Up, self).__init__() self.anchor_nums = anchor_nums self.in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
Re3write/siamdw
RPN_Up
false
11,912
[ "MIT" ]
0
f5d7d4bda36cb8c14e93b460fbc77bb225aa8572
https://github.com/Re3write/siamdw/tree/f5d7d4bda36cb8c14e93b460fbc77bb225aa8572
IdentityMessage
import torch import torch.utils.data class IdentityMessage(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super(IdentityMessage, self).__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src, z_dst, raw_msg...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
THinnerichs/pytorch_geometric
IdentityMessage
false
11,913
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
InnerProductDecoder
import torch import torch.utils.data class InnerProductDecoder(torch.nn.Module): """The inner product decoder from the `"Variational Graph Auto-Encoders" <https://arxiv.org/abs/1611.07308>`_ paper .. math:: \\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top}) where :math:`\\mathbf{Z} \\in \\mathbb{R}^{N ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
THinnerichs/pytorch_geometric
InnerProductDecoder
false
11,914
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
Attention
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim: 'int'=-1, margin: 'float'=0.0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).e...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
THinnerichs/pytorch_geometric
Attention
false
11,915
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
Linear
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def keep_variance_fn(x): return x + 0.001 class Linear(nn.Module): def __init__(self, in_features, out_features, bias=True, keep_variance_fn=None): super(Linear, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.parameter import Parameter assert_size_strid...
THAKAORI/SalsaNext
Linear
false
11,916
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
LeakyReLU
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.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.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
THAKAORI/SalsaNext
LeakyReLU
false
11,917
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
ResizeModule
import torch class ResizeModule(torch.nn.Module): def __init__(self): super(ResizeModule, self).__init__() def forward(self, x): return torch.nn.functional.interpolate(x, size=(3, 4)) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
MichaelZhero/nncase
ResizeModule
false
11,918
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
ReLU
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.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.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
THAKAORI/SalsaNext
ReLU
false
11,919
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
AvgPool2d
import torch import torch.nn as nn import torch.nn.functional as F def keep_variance_fn(x): return x + 0.001 class AvgPool2d(nn.Module): def __init__(self, keep_variance_fn=None, kernel_size=2): super(AvgPool2d, self).__init__() self._keep_variance_fn = keep_variance_fn self.kernel_...
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...
THAKAORI/SalsaNext
AvgPool2d
false
11,920
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
Bias
import torch import torch.nn as nn class Bias(nn.Module): def __init__(self): super(Bias, self).__init__() self.bias = nn.Parameter(torch.zeros(1)) def forward(self, feat_img, feat_sound): B, C, H, W = feat_sound.size() feat_img = feat_img.view(B, 1, C) z = torch.bmm(...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
TaoStarlit/Sound-of-Pixels
Bias
false
11,921
[ "MIT" ]
0
06cd37a75836e22208f2e59bcc263b89938e065e
https://github.com/TaoStarlit/Sound-of-Pixels/tree/06cd37a75836e22208f2e59bcc263b89938e065e
CAModule
import torch from torch import nn class CAModule(nn.Module): """ Re-implementation of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* code reference: https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Tarandro/Chexpert
CAModule
false
11,922
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
InnerProd
import torch import torch.nn as nn class InnerProd(nn.Module): def __init__(self, fc_dim): super(InnerProd, self).__init__() self.scale = nn.Parameter(torch.ones(fc_dim)) self.bias = nn.Parameter(torch.zeros(1)) def forward(self, feat_img, feat_sound): sound_size = feat_sound...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
TaoStarlit/Sound-of-Pixels
InnerProd
false
11,923
[ "MIT" ]
0
06cd37a75836e22208f2e59bcc263b89938e065e
https://github.com/TaoStarlit/Sound-of-Pixels/tree/06cd37a75836e22208f2e59bcc263b89938e065e
LinearPool
import torch from torch import nn class LinearPool(nn.Module): def __init__(self): super(LinearPool, self).__init__() def forward(self, feat_map): """ Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) return(Tensor): tensor with shape (N, C, 1, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Tarandro/Chexpert
LinearPool
false
11,924
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
PcamPool
import torch from torch import nn class PcamPool(nn.Module): def __init__(self): super(PcamPool, self).__init__() def forward(self, feat_map, logit_map): assert logit_map is not None prob_map = torch.sigmoid(logit_map) weight_map = prob_map / prob_map.sum(dim=2, keepdim=True)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Tarandro/Chexpert
PcamPool
false
11,925
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
MaxMarginCriterion
import torch import torch.nn as nn class MaxMarginCriterion(nn.Module): def __init__(self, visual_rank_weight, lang_rank_weight, margin): super(MaxMarginCriterion, self).__init__() self.visual_rank = visual_rank_weight > 0 self.lang_rank = lang_rank_weight > 0 self.visual_rank_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
TheShadow29/MAttNet
MaxMarginCriterion
false
11,926
[ "MIT" ]
0
2fe44667bc9254daef8be77bb4c896f10c2f665b
https://github.com/TheShadow29/MAttNet/tree/2fe44667bc9254daef8be77bb4c896f10c2f665b
LogSumExpPool
import torch from torch import nn class LogSumExpPool(nn.Module): def __init__(self, gamma): super(LogSumExpPool, self).__init__() self.gamma = gamma def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Te...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
Tarandro/Chexpert
LogSumExpPool
false
11,927
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
LogModule
import torch class LogModule(torch.nn.Module): def __init__(self): super(LogModule, self).__init__() def forward(self, x): return torch.log(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
MichaelZhero/nncase
LogModule
false
11,928
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
AbsModule
import torch class AbsModule(torch.nn.Module): def __init__(self): super(AbsModule, self).__init__() def forward(self, x): return torch.abs(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
MichaelZhero/nncase
AbsModule
false
11,929
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
CeilModule
import torch class CeilModule(torch.nn.Module): def __init__(self): super(CeilModule, self).__init__() def forward(self, x): return torch.ceil(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 libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
MichaelZhero/nncase
CeilModule
false
11,930
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
ExpPool
import torch from torch import nn class ExpPool(nn.Module): def __init__(self): super(ExpPool, self).__init__() def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Tensor): tensor with shape (N, C, H, 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._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
Tarandro/Chexpert
ExpPool
false
11,931
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
ReduceMinModule
import torch class ReduceMinModule(torch.nn.Module): def __init__(self): super(ReduceMinModule, self).__init__() def forward(self, x): return torch.min(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 import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
MichaelZhero/nncase
ReduceMinModule
false
11,932
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
ReduceMaxModule
import torch class ReduceMaxModule(torch.nn.Module): def __init__(self): super(ReduceMaxModule, self).__init__() def forward(self, x): return torch.max(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 import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
MichaelZhero/nncase
ReduceMaxModule
false
11,933
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
FloorModule
import torch class FloorModule(torch.nn.Module): def __init__(self): super(FloorModule, self).__init__() def forward(self, x): return torch.floor(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 libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
MichaelZhero/nncase
FloorModule
false
11,934
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
ReduceSumModule
import torch class ReduceSumModule(torch.nn.Module): def __init__(self): super(ReduceSumModule, self).__init__() def forward(self, x): return torch.sum(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 import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
MichaelZhero/nncase
ReduceSumModule
false
11,935
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
GuidedBackpropReLUasModule
from torch.autograd import Function import torch import torch.cuda class GuidedBackpropReLU(Function): @staticmethod def forward(self, input_img): positive_mask = (input_img > 0).type_as(input_img) output = torch.addcmul(torch.zeros(input_img.size()).type_as( input_img), input_img...
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.autograd import Function import torch.cuda assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = t...
TigerKinger/pytorch-grad-cam
GuidedBackpropReLUasModule
false
11,936
[ "MIT" ]
0
adb3c56e274fde782bf84d2a77454046bd4c5be4
https://github.com/TigerKinger/pytorch-grad-cam/tree/adb3c56e274fde782bf84d2a77454046bd4c5be4
DivideMax
import torch from torch import nn class DivideMax(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): maxes = x.amax(dim=self.dim, keepdim=True).detach() return x / maxes def get_inputs(): return [torch.rand([4, 4, 4, 4, 4])] d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Tiamat-Tech/DALLE-pytorch
DivideMax
false
11,937
[ "MIT" ]
0
d7bd745b23424e5a47c0db7e7ab093542427b22d
https://github.com/Tiamat-Tech/DALLE-pytorch/tree/d7bd745b23424e5a47c0db7e7ab093542427b22d
UNet
import torch import torch.nn.functional as F import torch.nn as nn class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class to create a UNet like NN architecture. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.functional as...
Remosy/v2e
UNet
false
11,938
[ "MIT" ]
0
efc81cbcc113ca55d1631603323150be5ef8eb30
https://github.com/Remosy/v2e/tree/efc81cbcc113ca55d1631603323150be5ef8eb30
Fusion
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Fusion(nn.Module): """ Crazy multi-modal fusion: negative squared difference minus relu'd sum """ def __init__(self): super().__init__() def forward(self, x, y): return -(x - y) ** 2 + F....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
TranTony/DFAF-for-VQA.pytorch
Fusion
false
11,939
[ "MIT" ]
0
eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
https://github.com/TranTony/DFAF-for-VQA.pytorch/tree/eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self, inS, outS): super().__init__() self.input_size = inS self.fc1 = nn.Linear(in_features=inS, out_features=120) self.fc2 = nn.Linear(in_features=120, out_features=60) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Thytu/MLOPS
Network
false
11,940
[ "MIT" ]
0
08e07e8fbe7621da1407276f68dff2dbcc2d8097
https://github.com/Thytu/MLOPS/tree/08e07e8fbe7621da1407276f68dff2dbcc2d8097
BertAttention
from _paritybench_helpers import _mock_config import math import torch from torch import nn import torch.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(BertLayerNorm,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Stephen0808/WebQA
BertAttention
false
11,941
[ "Apache-2.0" ]
0
b9758932a9d0d75167ec837bb6ee8bc571c64681
https://github.com/Stephen0808/WebQA/tree/b9758932a9d0d75167ec837bb6ee8bc571c64681
RNN
import torch import torch.nn as nn class RNN(nn.Module): def __init__(self, intput_size, hidden_size, output_size): super().__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(intput_size + hidden_size, hidden_size) self.i2o = nn.Linear(intput_size + hidden_size, output...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Thytu/earthquakePrediction
RNN
false
11,942
[ "MIT" ]
0
95777022e492bd21aa2107c2b5af7a80b38abc2f
https://github.com/Thytu/earthquakePrediction/tree/95777022e492bd21aa2107c2b5af7a80b38abc2f
GAT
import torch import torch.nn.functional as F import torch.nn as nn 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(GraphAttentionLayer, self).__init__(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
StellaAthena/Graph-Universal-Attack
GAT
false
11,943
[ "MIT" ]
0
38c85d54df0aca22a06731a8dff8bcf2f5bc8004
https://github.com/StellaAthena/Graph-Universal-Attack/tree/38c85d54df0aca22a06731a8dff8bcf2f5bc8004
TorchDiceLoss
import torch from torch import nn def soft_dice_loss(outputs, targets, per_image=False): batch_size = outputs.size()[0] eps = 1e-05 if not per_image: batch_size = 1 dice_target = targets.contiguous().view(batch_size, -1).float() dice_output = outputs.contiguous().view(batch_size, -1) 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Spiruel/solaris
TorchDiceLoss
false
11,944
[ "Apache-2.0" ]
0
eb2ce05265a462d69b01ee2b621a85a3e9082402
https://github.com/Spiruel/solaris/tree/eb2ce05265a462d69b01ee2b621a85a3e9082402
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...
Taekyoon/executors
LinearFBSP
false
11,945
[ "Apache-2.0" ]
0
567f12c4193bb7be814f84540ea31585cd35b344
https://github.com/Taekyoon/executors/tree/567f12c4193bb7be814f84540ea31585cd35b344
LqLoss
import torch from torch import nn def lq_loss(y_pred, y_true, q): eps = 1e-07 loss = y_pred * y_true loss = (1 - (loss + eps) ** q) / q return loss.mean() class LqLoss(nn.Module): def __init__(self, q=0.5): super().__init__() self.q = q def forward(self, output, target): ...
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 import nn assert_...
Vanova/argus-freesound
LqLoss
false
11,946
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
NN
import torch import torch.nn as nn import torch.nn.functional as F class NN(nn.Module): def __init__(self, input_size, num_classes): super(NN, self).__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 64) self.fc3 = nn.Linear(64, 32) self.fc4 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Toygarr/magically-basic-modeling-with-pytorch
NN
false
11,947
[ "MIT" ]
0
e68b65abcbecbf3eaf4e0e2fb0cf82686811549e
https://github.com/Toygarr/magically-basic-modeling-with-pytorch/tree/e68b65abcbecbf3eaf4e0e2fb0cf82686811549e
LSoftLoss
import torch from torch import nn import torch.nn.functional as F def l_soft(y_pred, y_true, beta): eps = 1e-07 y_pred = torch.clamp(y_pred, eps, 1.0) with torch.no_grad(): y_true_update = beta * y_true + (1 - beta) * y_pred loss = F.binary_cross_entropy(y_pred, y_true_update) return loss ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Vanova/argus-freesound
LSoftLoss
false
11,948
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
SEScale
import torch from torch import nn import torch.nn.functional as F class SEScale(nn.Module): def __init__(self, in_channels, reduction=16): super().__init__() channel = in_channels self.fc1 = nn.Linear(channel, reduction) self.fc2 = nn.Linear(reduction, channel) 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 from torch import nn assert_s...
Vanova/argus-freesound
SEScale
false
11,949
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
CharbonnierLoss
import torch import torch.utils.data import torch.nn as nn class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=1e-06): super(CharbonnierLoss, self).__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torch.sum(torch.sqrt...
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.utils.data impo...
WenlongZhang0724/mmsr
CharbonnierLoss
false
11,950
[ "Apache-2.0" ]
0
375ce9207c2b8586101406577faea285885b8009
https://github.com/WenlongZhang0724/mmsr/tree/375ce9207c2b8586101406577faea285885b8009
LinearModel
import torch import torch.nn as nn class LinearModel(nn.Module): def __init__(self, input_size, output_size, hidden_size): super(LinearModel, self).__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self.linear3 = nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
VVKot/mlinseconds-find-me
LinearModel
false
11,951
[ "MIT" ]
0
f50ec09ef5cef23b694970a9a975f7a0f8c59b76
https://github.com/VVKot/mlinseconds-find-me/tree/f50ec09ef5cef23b694970a9a975f7a0f8c59b76
PatchEmbed
import torch import torch.nn as nn class PatchEmbed(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) self.img_size = img_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
WangFeng18/deit
PatchEmbed
false
11,952
[ "Apache-2.0" ]
0
62a2c54faf683af8316fbec2e99f666879949cb4
https://github.com/WangFeng18/deit/tree/62a2c54faf683af8316fbec2e99f666879949cb4