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
SE
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class SwishEfficient(torch.autograd.Function): """Swish activation function: x * sigmoid(x).""" @staticmethod def forward(ctx, x): result = x * torch.sigmoid(x) ctx.save_for_backward(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 itertools import chain a...
makarandtapaswi/SlowFast
SE
false
15,995
[ "Apache-2.0" ]
4,914
39ef35c9a086443209b458cceaec86a02e27b369
https://github.com/makarandtapaswi/SlowFast/tree/39ef35c9a086443209b458cceaec86a02e27b369
SEModule
import torch import torch.nn as nn import torch.nn.functional as F class Hswish(nn.Module): def __init__(self, inplace=True): super(Hswish, self).__init__() self.inplace = inplace def forward(self, x): return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.0 class Hsigmoid(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 import torch.nn as nn import ...
manjrekarom/PaddleOCR2Pytorch
SEModule
false
15,996
[ "Apache-2.0" ]
364
6d98508f4c85b9dd3bf022924b0ecc5354ec8281
https://github.com/manjrekarom/PaddleOCR2Pytorch/tree/6d98508f4c85b9dd3bf022924b0ecc5354ec8281
RGBBlock
import torch from torch import nn import torch.nn.functional as F class Conv2DMod(nn.Module): def __init__(self, in_chan, out_chan, kernel, demod=True, stride=1, dilation=1, **kwargs): super().__init__() self.filters = out_chan self.demod = demod self.kernel = kernel ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
mahmoudnafifi/HistoGAN
RGBBlock
false
15,997
[ "MIT" ]
169
50be1482638ace3ec85d733e849dec494ede155b
https://github.com/mahmoudnafifi/HistoGAN/tree/50be1482638ace3ec85d733e849dec494ede155b
_ChannelAttentionModule
import torch import torch.nn as nn from itertools import product as product class _ChannelAttentionModule(nn.Module): """Channel attention module""" def __init__(self, **kwargs): super(_ChannelAttentionModule, self).__init__() self.beta = nn.Parameter(torch.zeros(1)) self.softmax = 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....
maoweinuaa/FaceParsing
_ChannelAttentionModule
false
15,998
[ "MIT" ]
138
5e153b636e7e57b20d3079b2e0f15aa02dc4046d
https://github.com/maoweinuaa/FaceParsing/tree/5e153b636e7e57b20d3079b2e0f15aa02dc4046d
pdice_loss
import torch import torch.nn as nn import torch.utils.model_zoo class pdice_loss(nn.Module): def __init__(self, batch=True): super(pdice_loss, self).__init__() self.batch = batch def soft_dice_coeff(self, y_true, y_pred, p): smooth = 0.0 if self.batch: pmap = p.cl...
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.model_zoo assert_size_stride = torch._C._dynamo....
manuel-rdz/SGL-Retinal-Vessel-Segmentation
pdice_loss
false
15,999
[ "MIT" ]
45
7897d977e77aa0b5d3acb86e0aa74c6829d67415
https://github.com/manuel-rdz/SGL-Retinal-Vessel-Segmentation/tree/7897d977e77aa0b5d3acb86e0aa74c6829d67415
PatchEmbed
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class PatchEmbed(nn.Module): """ PatchEmbed. """ def __init__(self, dim_in=3, dim_out=768, kernel=(1, 16, 16), stride=(1, 4, 4), padding=(1, 7, 7), conv_2d=False): 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 itertools import chain as chain import torch.utils.data import torch.nn as ...
makarandtapaswi/SlowFast
PatchEmbed
false
16,000
[ "Apache-2.0" ]
4,914
39ef35c9a086443209b458cceaec86a02e27b369
https://github.com/makarandtapaswi/SlowFast/tree/39ef35c9a086443209b458cceaec86a02e27b369
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 32, 3, 1) self.conv2 = nn.Conv2d(32, 64, 3, 1) self.dropout1 = nn.Dropout2d(0.25) self.dropout2 = nn.Dropout2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
manjuransari/petastorm
Net
false
16,001
[ "Apache-2.0" ]
1,393
1af7212a1293b1edb78767a359aa2b60db24b71b
https://github.com/manjuransari/petastorm/tree/1af7212a1293b1edb78767a359aa2b60db24b71b
DoubleConvBlock
import torch import torch.nn as nn class ConvBlock(nn.Module): """ Conv layer block """ def __init__(self, kernel, in_depth, conv_depth, stride=1, padding=1, normalization=False, norm_type='BN', pooling=False, bias_initialization='zeros', activation=True, dilation=1, return_before_poo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
manipopopo/C5
DoubleConvBlock
false
16,002
[ "Apache-2.0" ]
51
154eb38c330e65476ddb77836948a28237f23c88
https://github.com/manipopopo/C5/tree/154eb38c330e65476ddb77836948a28237f23c88
iCaRL_loss
import torch import torch.nn as nn class iCaRL_loss(nn.Module): def __init__(self): super(iCaRL_loss, self).__init__() def forward(self, logist, target): eps = 1e-06 logist = logist.double() target = target.double() p0 = torch.mul(target, torch.log(logist + eps)) ...
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...
mao-example/End-to-End-Incremental-Learning
iCaRL_loss
false
16,003
[ "MIT" ]
53
39d6f4e594e805a713aa7a1deedbcb03d1f2c9cc
https://github.com/mao-example/End-to-End-Incremental-Learning/tree/39d6f4e594e805a713aa7a1deedbcb03d1f2c9cc
LeNetPP
import torch import torch.nn as nn import torch.nn.functional as F class LeNetPP(nn.Module): def __init__(self, dim_hidden=2, num_classes=10): super(LeNetPP, self).__init__() self.num_classes = num_classes self.conv1_1 = nn.Conv2d(1, 32, kernel_size=5, padding=2) self.prelu1_1 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
lyakaap/image-feature-learning-pytorch
LeNetPP
false
16,004
[ "MIT" ]
55
241ed10d4312fedfb23015f6a50cdca8f2b0ad9e
https://github.com/lyakaap/image-feature-learning-pytorch/tree/241ed10d4312fedfb23015f6a50cdca8f2b0ad9e
ScaledDotProductAttentionMemory
import torch import numpy as np from torch import nn class ScaledDotProductAttentionMemory(nn.Module): """ Scaled dot-product attention with memory """ def __init__(self, d_model, d_k, d_v, h, m): """ :param d_model: Output dimensionality of the model :param d_k: Dimensionalit...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mandaltanmoy1938/VisualGPT
ScaledDotProductAttentionMemory
false
16,005
[ "MIT" ]
86
9ba78948282fdca502d5030f4eccc3df562982c3
https://github.com/mandaltanmoy1938/VisualGPT/tree/9ba78948282fdca502d5030f4eccc3df562982c3
TransformerEncoder
import torch class TransformerEncoder(torch.nn.Module): def __init__(self, embed_dim, num_heads, dropout, feedforward_dim): super().__init__() self.attn = torch.nn.MultiheadAttention(embed_dim, num_heads, dropout=dropout) self.linear_1 = torch.nn.Linear(embed_dim, feedforward_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mamuncseru/Denoise-Transformer-AutoEncoder
TransformerEncoder
false
16,006
[ "MIT" ]
265
56b3ff8b252ad24a4ed769158e3f0648090e1ffd
https://github.com/mamuncseru/Denoise-Transformer-AutoEncoder/tree/56b3ff8b252ad24a4ed769158e3f0648090e1ffd
dice_bce_loss
import torch import torch.nn as nn import torch.utils.model_zoo class dice_bce_loss(nn.Module): def __init__(self, batch=True): super(dice_bce_loss, self).__init__() self.batch = batch self.bce_loss = nn.BCELoss() def soft_dice_coeff(self, y_true, y_pred): smooth = 0.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 import torch.nn as nn import torch.utils.model_zoo assert_size_stride = torch._C._dynamo....
manuel-rdz/SGL-Retinal-Vessel-Segmentation
dice_bce_loss
false
16,007
[ "MIT" ]
45
7897d977e77aa0b5d3acb86e0aa74c6829d67415
https://github.com/manuel-rdz/SGL-Retinal-Vessel-Segmentation/tree/7897d977e77aa0b5d3acb86e0aa74c6829d67415
TVLoss
import torch import torch.nn as nn import torch.utils.model_zoo class TVLoss(nn.Module): def __init__(self, TVLoss_weight=1): super(TVLoss, self).__init__() self.TVLoss_weight = TVLoss_weight def forward(self, x): batch_size = x.size()[0] h_x = x.size()[2] w_x = x.siz...
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 import torch.utils.model_zoo assert_size_stride = t...
manuel-rdz/SGL-Retinal-Vessel-Segmentation
TVLoss
false
16,008
[ "MIT" ]
45
7897d977e77aa0b5d3acb86e0aa74c6829d67415
https://github.com/manuel-rdz/SGL-Retinal-Vessel-Segmentation/tree/7897d977e77aa0b5d3acb86e0aa74c6829d67415
Attention
from _paritybench_helpers import _mock_config from torch.nn import Module import math import torch from torch import nn from torch.nn import Parameter from torch.nn.parameter import Parameter class Conv1D(nn.Module): def __init__(self, nf, nx): super(Conv1D, self).__init__() self.nf = nf ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mandaltanmoy1938/VisualGPT
Attention
false
16,009
[ "MIT" ]
86
9ba78948282fdca502d5030f4eccc3df562982c3
https://github.com/mandaltanmoy1938/VisualGPT/tree/9ba78948282fdca502d5030f4eccc3df562982c3
SoftmaxOutputLayer
import torch import torch.nn as nn import torch.nn.functional as F class OutputLayer(nn.Module): """ Abstract base class for output layer. Handles projection to output labels """ def __init__(self, hidden_size, output_size): super(OutputLayer, self).__init__() self.output_size = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
markiewagner/torchnlp
SoftmaxOutputLayer
false
16,010
[ "Apache-2.0" ]
262
92f0a98c7c2b407508810834cbfd544214481695
https://github.com/markiewagner/torchnlp/tree/92f0a98c7c2b407508810834cbfd544214481695
SelfAttention
import torch import torch.nn.functional as F import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, input_size, heads, embed_size): super().__init__() self.input_size = input_size self.heads = heads self.emb_size = embed_size self.tokeys = nn.Linear(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
mariuslindegaard/6.867_MARL_project
SelfAttention
false
16,011
[ "Apache-2.0" ]
401
572b88b4d491db8a1673535868f4bf9aff58f73d
https://github.com/mariuslindegaard/6.867_MARL_project/tree/572b88b4d491db8a1673535868f4bf9aff58f73d
ReDynamicWeightsCat33
import math import torch import torch.utils.data from torch import nn from torch.nn.modules.utils import _pair class DeformConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, deformable_groups=1, bias=False): assert not bias ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
lzrobots/dgmn
ReDynamicWeightsCat33
false
16,012
[ "MIT" ]
54
515476b5c6a07dcc3b7a4d2243c541377624bb33
https://github.com/lzrobots/dgmn/tree/515476b5c6a07dcc3b7a4d2243c541377624bb33
SoftConvNotLearnedMask
import math import torch import torch.nn as nn def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, 'weight'): if init_type == 'gaussian': ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 math i...
marcelsan/Deep-HdrReconstruction
SoftConvNotLearnedMask
false
16,013
[ "BSD-3-Clause" ]
80
7cb0d93938baa6fbe029116451a661c18dfba49e
https://github.com/marcelsan/Deep-HdrReconstruction/tree/7cb0d93938baa6fbe029116451a661c18dfba49e
penalty_bce_loss
import torch import torch.nn as nn import torch.utils.model_zoo class penalty_bce_loss(nn.Module): def __init__(self): super(penalty_bce_loss, self).__init__() def forward(self, y_pred, y_true, pmap): B, C, W, H = y_pred.size() bce = -y_true * torch.log(y_pred + 1e-14) - (1 - y_true)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
manuel-rdz/SGL-Retinal-Vessel-Segmentation
penalty_bce_loss
false
16,014
[ "MIT" ]
45
7897d977e77aa0b5d3acb86e0aa74c6829d67415
https://github.com/manuel-rdz/SGL-Retinal-Vessel-Segmentation/tree/7897d977e77aa0b5d3acb86e0aa74c6829d67415
PCBActiv
import math import torch import torch.nn as nn def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, 'weight'): if init_type == 'gaussian': ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
marcelsan/Deep-HdrReconstruction
PCBActiv
false
16,015
[ "BSD-3-Clause" ]
80
7cb0d93938baa6fbe029116451a661c18dfba49e
https://github.com/marcelsan/Deep-HdrReconstruction/tree/7cb0d93938baa6fbe029116451a661c18dfba49e
L0Loss
import torch class L0Loss(torch.nn.Module): def forward(self, suggested, target): errors = (suggested - target).abs() return torch.max(errors, dim=-1)[0].mean() 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 math as tl_math assert_size_stride = t...
martius-lab/CombOptNet
L0Loss
false
16,016
[ "MIT" ]
46
d563d31a95dce35a365d50b81f932c27531ae09b
https://github.com/martius-lab/CombOptNet/tree/d563d31a95dce35a365d50b81f932c27531ae09b
Attention
import torch import torch.nn as nn class Attention(nn.Module): """ Attention Network. """ def __init__(self, encoder_dim, decoder_dim, attention_dim): """ :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_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....
marcoleewow/LaTeX_OCR
Attention
false
16,017
[ "Apache-2.0" ]
290
0980ea719f8d3175a6bbf6af18873dd72d04b8c7
https://github.com/marcoleewow/LaTeX_OCR/tree/0980ea719f8d3175a6bbf6af18873dd72d04b8c7
Project3D
import torch import torch.nn as nn class Project3D(nn.Module): """Layer which projects 3D points into a camera with intrinsics K and at position T """ def __init__(self, batch_size, height, width, eps=1e-07): super(Project3D, self).__init__() self.batch_size = batch_size self.heig...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
mattpoggi/depthstillation
Project3D
false
16,018
[ "MIT" ]
122
b74ea4343d8d9f082c82e9f72d9294200aea8bb7
https://github.com/mattpoggi/depthstillation/tree/b74ea4343d8d9f082c82e9f72d9294200aea8bb7
AttentionSet
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, mode_dims, expand_dims, center_use_offset, att_type, bn, nat, name='Real'): super(Attention, self).__init__() self.center_use_offset = center_use_offset self.bn = bn ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
marcos0318/query2box
AttentionSet
false
16,019
[ "MIT" ]
140
cc8b47e21a5addf17ee5a3c68412b638ef3956f3
https://github.com/marcos0318/query2box/tree/cc8b47e21a5addf17ee5a3c68412b638ef3956f3
TransformerEncoderLayer
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from typing import Optional from torch.nn import TransformerEncoderLayer from torch.nn.modules.activation import MultiheadAttention from torch.nn.init import xavier_uniform_ from torch.nn.modules.dropout import Dropout from torc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
markovka17/efficient-dl-systems
TransformerEncoderLayer
false
16,020
[ "MIT" ]
85
310d1471e72ba70a0892cf5c9653ade17f091be5
https://github.com/markovka17/efficient-dl-systems/tree/310d1471e72ba70a0892cf5c9653ade17f091be5
PixelNorm
import torch import torch.nn as nn def pixel_norm(x, eps=1e-06): """Pixel Normalization. This normalization is proposed in: Progressive Growing of GANs for Improved Quality, Stability, and Variation Args: x (torch.Tensor): Tensor to be normalized. eps (float, optional): Epsilon to av...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
matrixgame2018/mmediting
PixelNorm
false
16,021
[ "Apache-2.0" ]
1,884
5170a64a586cc876a5cb459fbfa0cf9b55bfa5fd
https://github.com/matrixgame2018/mmediting/tree/5170a64a586cc876a5cb459fbfa0cf9b55bfa5fd
UnStackDelta
import torch import torch.nn as nn class UnStackDelta(nn.Module): """Reverse of StackDelta""" def __init__(self): super().__init__() def forward(self, x: 'torch.Tensor'): assert x.dim() == 4 if x.requires_grad: out = x.transpose(1, 2).contiguous() else: ...
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...
maxwellzh/CAT
UnStackDelta
false
16,022
[ "Apache-2.0" ]
237
b1a9c3f95e84d968593a05bf8b176b5f77b8055e
https://github.com/maxwellzh/CAT/tree/b1a9c3f95e84d968593a05bf8b176b5f77b8055e
HuberLoss
import torch class HuberLoss(torch.nn.Module): def __init__(self, beta=0.3): self.beta = beta super(HuberLoss, self).__init__() def forward(self, suggested, target): errors = torch.abs(suggested - target) mask = errors < self.beta l2_errors = 0.5 * errors ** 2 / self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
martius-lab/CombOptNet
HuberLoss
false
16,023
[ "MIT" ]
46
d563d31a95dce35a365d50b81f932c27531ae09b
https://github.com/martius-lab/CombOptNet/tree/d563d31a95dce35a365d50b81f932c27531ae09b
WeldonPooling
import torch import torch.nn as nn class WeldonPooling(nn.Module): def __init__(self, nMax=1, nMin=None): super(WeldonPooling, self).__init__() self.nMax = nMax if nMin is None: self.nMin = nMax else: self.nMin = nMin self.input = torch.Tensor() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
maxgreat/dsve-loc
WeldonPooling
false
16,024
[ "BSD-3-Clause-Clear" ]
56
dd6807d02c0d5fd3e215be8e5c7a88e73102e561
https://github.com/maxgreat/dsve-loc/tree/dd6807d02c0d5fd3e215be8e5c7a88e73102e561
ContrastiveLoss
import torch import torch.nn as nn class ContrastiveLoss(nn.Module): def __init__(self, margin=0.2): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, imgs, caps): scores = torch.mm(imgs, caps.t()) diag = scores.diag() cost_s = torch.clamp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
maxgreat/dsve-loc
ContrastiveLoss
false
16,025
[ "BSD-3-Clause-Clear" ]
56
dd6807d02c0d5fd3e215be8e5c7a88e73102e561
https://github.com/maxgreat/dsve-loc/tree/dd6807d02c0d5fd3e215be8e5c7a88e73102e561
SoftBinaryCrossEntropyLoss
import torch class SoftBinaryCrossEntropyLoss(torch.nn.Module): def __init__(self, tau=1.0): super().__init__() self.tau = tau self.bce_logit = torch.nn.BCEWithLogitsLoss() def forward(self, pred, true): logits = pred / self.tau l = self.bce_logit(logits, true) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
mfredriksz/semanticGAN_code
SoftBinaryCrossEntropyLoss
false
16,026
[ "BSD-2-Clause", "MIT" ]
107
c6e7b490086afd8a7593e2892452295555910494
https://github.com/mfredriksz/semanticGAN_code/tree/c6e7b490086afd8a7593e2892452295555910494
FeatureCorrelation
import torch import torch.nn as nn import torch.nn def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class FeatureCorrelation(torch.nn.Module): def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
mcimpoi/ncnet
FeatureCorrelation
false
16,027
[ "MIT" ]
159
d801df77154bce9e5653090273aacb0e588fa4ea
https://github.com/mcimpoi/ncnet/tree/d801df77154bce9e5653090273aacb0e588fa4ea
Policy
import torch import torch.nn as nn import torch.utils from copy import deepcopy import torch.nn.parallel import torch.optim class Policy(nn.Module): def __init__(self, max_nodes, search_space): super(Policy, self).__init__() self.max_nodes = max_nodes self.search_space = deepcopy(search_s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
megvii-model/AngleNAS
Policy
false
16,028
[ "MIT" ]
53
c4cb189f04450db43e2014e178aa8a20ef5b316e
https://github.com/megvii-model/AngleNAS/tree/c4cb189f04450db43e2014e178aa8a20ef5b316e
ResBlock
import torch import torch.nn as nn from typing import Tuple def conv3x3(in_channels: 'int', out_channels: 'int', stride: 'int'=1, padding: 'int'=1) ->nn.Module: conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, stride= stride, padding=padding, bias=True) nn.init.xavier_normal_(conv.weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
mdornseif/fastface
ResBlock
false
16,029
[ "MIT" ]
72
72772db1fae4af17e829cd5479c4848fe5eb8948
https://github.com/mdornseif/fastface/tree/72772db1fae4af17e829cd5479c4848fe5eb8948
AffineGridGen
from torch.nn import Module import torch import torch.nn.functional as F import torch.nn from torch.nn.modules.module import Module class AffineGridGen(Module): def __init__(self, out_h=240, out_w=240, out_ch=3, use_cuda=True): super(AffineGridGen, self).__init__() self.out_h = out_h self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import torch.nn from torch.nn.modules.module import Module assert_size_stride = torch._C._dynamo.guards.assert_s...
mcimpoi/ncnet
AffineGridGen
false
16,030
[ "MIT" ]
159
d801df77154bce9e5653090273aacb0e588fa4ea
https://github.com/mcimpoi/ncnet/tree/d801df77154bce9e5653090273aacb0e588fa4ea
L2ConstrainedLayer
import torch from torch import nn class L2ConstrainedLayer(nn.Module): def __init__(self, alpha=16): super().__init__() self.alpha = alpha def forward(self, x): l2 = torch.sqrt((x ** 2).sum()) x = self.alpha * (x / l2) return x def get_inputs(): return [torch.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 libdevice from torch import nn assert_...
mgoldchild/metric_learning
L2ConstrainedLayer
false
16,031
[ "MIT" ]
58
97731bd0922b42df470ec6be34e1138bbcca5fb7
https://github.com/mgoldchild/metric_learning/tree/97731bd0922b42df470ec6be34e1138bbcca5fb7
LogCoshLoss
import torch class LogCoshLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, true, pred): loss = true - pred return torch.mean(torch.log(torch.cosh(loss + 1e-12))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def g...
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...
mfredriksz/semanticGAN_code
LogCoshLoss
false
16,033
[ "BSD-2-Clause", "MIT" ]
107
c6e7b490086afd8a7593e2892452295555910494
https://github.com/mfredriksz/semanticGAN_code/tree/c6e7b490086afd8a7593e2892452295555910494
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, num_class=10): super(MLP, self).__init__() self.fc1 = nn.Linear(32 * 32 * 3, 512) self.fc2 = nn.Linear(512, 512) self.fc3 = nn.Linear(512, num_class) self.dropout = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
mattkelleher/Nasty-Teacher
MLP
false
16,034
[ "MIT" ]
59
7cca6e41aca10dcceeb215fa15107baae91e0140
https://github.com/mattkelleher/Nasty-Teacher/tree/7cca6e41aca10dcceeb215fa15107baae91e0140
SoftmaxLoss
import torch class SoftmaxLoss(torch.nn.Module): def __init__(self, tau=1.0): super().__init__() self.tau = tau self.ce_loss = torch.nn.CrossEntropyLoss() def forward(self, pred, true): logits = pred / self.tau l = self.ce_loss(logits, true) return l 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 from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
mfredriksz/semanticGAN_code
SoftmaxLoss
false
16,035
[ "BSD-2-Clause", "MIT" ]
107
c6e7b490086afd8a7593e2892452295555910494
https://github.com/mfredriksz/semanticGAN_code/tree/c6e7b490086afd8a7593e2892452295555910494
GCN
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class GCN(nn.Module): def __init__(self, cfg): super(GCN, self).__init__() self.num_layers = cfg.num_layers self.input_size = cfg.input_size self.hidden_size = cfg.hidd...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
mengtinglll/deepke
GCN
false
16,036
[ "Apache-2.0" ]
173
da1649865c496317b45f0b26e9ea599c9f509ed0
https://github.com/mengtinglll/deepke/tree/da1649865c496317b45f0b26e9ea599c9f509ed0
CDCM
import torch import torch.nn as nn class CDCM(nn.Module): """ Compact Dilation Convolution based Module """ def __init__(self, in_channels, out_channels): super(CDCM, self).__init__() self.relu1 = nn.ReLU() self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
mgpadalkar/pidinet
CDCM
false
16,037
[ "MIT" ]
137
781924fe30469cdc64f63ce6666a3e1f5b4e576f
https://github.com/mgpadalkar/pidinet/tree/781924fe30469cdc64f63ce6666a3e1f5b4e576f
PDCBlock_converted
import torch import torch.nn as nn class PDCBlock_converted(nn.Module): """ CPDC, APDC can be converted to vanilla 3x3 convolution RPDC can be converted to vanilla 5x5 convolution """ def __init__(self, pdc, inplane, ouplane, stride=1): super(PDCBlock_converted, self).__init__() s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
mgpadalkar/pidinet
PDCBlock_converted
false
16,038
[ "MIT" ]
137
781924fe30469cdc64f63ce6666a3e1f5b4e576f
https://github.com/mgpadalkar/pidinet/tree/781924fe30469cdc64f63ce6666a3e1f5b4e576f
SplitCosineLinear
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from torch.nn.modules.module import Module class CosineLinear(Module): def __i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
mhd-medfa/class-incremental-learning
SplitCosineLinear
false
16,039
[ "MIT" ]
241
c7c0a217d07b285f215672b3021beee52d4ef74f
https://github.com/mhd-medfa/class-incremental-learning/tree/c7c0a217d07b285f215672b3021beee52d4ef74f
TreeLSTM
import torch import torch.nn as nn class TreeLSTM(nn.Module): def __init__(self, num_units): super(TreeLSTM, self).__init__() self.num_units = num_units self.left = nn.Linear(num_units, 5 * num_units) self.right = nn.Linear(num_units, 5 * num_units) def forward(self, left_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.triton_helpers import libdevice import torch.nn as ...
mhoangvslev/torchfold
TreeLSTM
false
16,040
[ "Apache-2.0" ]
160
9285c7889f2e1966fb94c4b8a3e91bcd60e40ab2
https://github.com/mhoangvslev/torchfold/tree/9285c7889f2e1966fb94c4b8a3e91bcd60e40ab2
DotProductSimilarity
import math import torch import torch.nn as nn class SimilarityFunction(nn.Module): """ A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity function on the vectors in the last dimension. For example, the tensors might both have shape `(batch_size, sentence_...
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...
michiyasunaga/GreaseLM
DotProductSimilarity
false
16,041
[ "MIT" ]
76
596aa5047841e3e97730f621a2e4576772733df2
https://github.com/michiyasunaga/GreaseLM/tree/596aa5047841e3e97730f621a2e4576772733df2
CSAM
import torch import torch.nn as nn class CSAM(nn.Module): """ Compact Spatial Attention Module """ def __init__(self, channels): super(CSAM, self).__init__() mid_channels = 4 self.relu1 = nn.ReLU() self.conv1 = nn.Conv2d(channels, mid_channels, kernel_size=1, padding=0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
mgpadalkar/pidinet
CSAM
false
16,042
[ "MIT" ]
137
781924fe30469cdc64f63ce6666a3e1f5b4e576f
https://github.com/mgpadalkar/pidinet/tree/781924fe30469cdc64f63ce6666a3e1f5b4e576f
Conv2dMtl
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from torch.nn.modules.module import Module from torch.nn.modules.utils import _pair ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 import Module import math from torch.nn.parameter import Parameter...
mhd-medfa/class-incremental-learning
Conv2dMtl
false
16,043
[ "MIT" ]
241
c7c0a217d07b285f215672b3021beee52d4ef74f
https://github.com/mhd-medfa/class-incremental-learning/tree/c7c0a217d07b285f215672b3021beee52d4ef74f
OutputLayer
import torch import torch.nn as nn class OutputLayer(nn.Module): def __init__(self, voxel_size=1.0): super(OutputLayer, self).__init__() def forward(self, features_list, index_map_list): out = [] for feat, index_map in zip(features_list, index_map_list): out.append(feat[i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
mi-exwzd/Open3D-ML
OutputLayer
false
16,044
[ "MIT" ]
447
d58b24edd37de7889446360164cd5500e0bde060
https://github.com/mi-exwzd/Open3D-ML/tree/d58b24edd37de7889446360164cd5500e0bde060
MatrixAttention
import math import torch import torch.nn as nn class SimilarityFunction(nn.Module): """ A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity function on the vectors in the last dimension. For example, the tensors might both have shape `(batch_size, sentence_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guar...
michiyasunaga/GreaseLM
MatrixAttention
false
16,046
[ "MIT" ]
76
596aa5047841e3e97730f621a2e4576772733df2
https://github.com/michiyasunaga/GreaseLM/tree/596aa5047841e3e97730f621a2e4576772733df2
HardNegativeContrastiveLoss
import torch import torch.nn as nn class HardNegativeContrastiveLoss(nn.Module): def __init__(self, nmax=1, margin=0.2): super(HardNegativeContrastiveLoss, self).__init__() self.margin = margin self.nmax = nmax def forward(self, imgs, caps): scores = torch.mm(imgs, caps.t()) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
maxgreat/dsve-loc
HardNegativeContrastiveLoss
false
16,047
[ "BSD-3-Clause-Clear" ]
56
dd6807d02c0d5fd3e215be8e5c7a88e73102e561
https://github.com/maxgreat/dsve-loc/tree/dd6807d02c0d5fd3e215be8e5c7a88e73102e561
GraphLinear
import torch import torch._utils class GraphLinear(torch.nn.Module): """ Generalization of 1x1 convolutions on Graphs """ def __init__(self, in_channels, out_channels): super(GraphLinear, self).__init__() self.in_channels = in_channels self.out_channels = out_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch._utils assert_size_stride = torch._C._dynamo.guards.assert_size_str...
microsoft/MeshGraphormer
GraphLinear
false
16,048
[ "MIT" ]
135
1c489e35e6bd3848ce0702891e4c8365b584bb8e
https://github.com/microsoft/MeshGraphormer/tree/1c489e35e6bd3848ce0702891e4c8365b584bb8e
Decoder
import torch import torch.nn import torch.nn.functional as F import torch.utils.data.dataset class ResBlock(torch.nn.Module): def __init__(self, indim, outdim=None, stride=1): super(ResBlock, self).__init__() if outdim is None: outdim = indim if indim == outdim and 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 import torch....
hzxie/RMNet
Decoder
false
16,049
[ "MIT" ]
66
32a16f9c9473463a41dd6e95f72b06dd830fc1eb
https://github.com/hzxie/RMNet/tree/32a16f9c9473463a41dd6e95f72b06dd830fc1eb
SwaVLoss
import torch import torch.nn as nn import torch.nn.functional as F from typing import List @torch.no_grad() def sinkhorn(out: 'torch.Tensor', iterations: 'int'=3, epsilon: 'float'=0.05): """Distributed sinkhorn algorithm. As outlined in [0] and implemented in [1]. [0]: SwaV, 2020, https://arxiv.org/...
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 ...
lightly-ai/lightly
SwaVLoss
false
16,050
[ "MIT" ]
1,515
0b98bda640d13d842fd13f9354271d0cef116ba5
https://github.com/lightly-ai/lightly/tree/0b98bda640d13d842fd13f9354271d0cef116ba5
Lookahead
import torch import torch.nn as nn import torch.nn.functional as F class Lookahead(nn.Module): def __init__(self, n_features, context): super(Lookahead, self).__init__() assert context > 0 self.context = context self.n_features = n_features self.pad = 0, self.context - 1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
maxwellzh/CAT
Lookahead
false
16,051
[ "Apache-2.0" ]
237
b1a9c3f95e84d968593a05bf8b176b5f77b8055e
https://github.com/maxwellzh/CAT/tree/b1a9c3f95e84d968593a05bf8b176b5f77b8055e
FocalLoss
import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed def reduce_loss(loss, reduction='mean'): return loss.mean() if reduction == 'mean' else loss.sum( ) if reduction == 'sum' else loss class FocalLoss(nn.Module): """ Origianl 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
microsoft/vision-longformer
FocalLoss
false
16,052
[ "MIT" ]
169
c9ce386de3e633bb3c805368d118356fbd696487
https://github.com/microsoft/vision-longformer/tree/c9ce386de3e633bb3c805368d118356fbd696487
CRFOutputLayer
import torch import torch.nn as nn class CRF(nn.Module): """ Implements Conditional Random Fields that can be trained via backpropagation. """ def __init__(self, num_tags): super(CRF, self).__init__() self.num_tags = num_tags self.transitions = nn.Parameter(torch.Tensor(n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
markiewagner/torchnlp
CRFOutputLayer
false
16,053
[ "Apache-2.0" ]
262
92f0a98c7c2b407508810834cbfd544214481695
https://github.com/markiewagner/torchnlp/tree/92f0a98c7c2b407508810834cbfd544214481695
ToSEG
from torch.autograd import Function import math import torch import torch.nn as nn import torch.nn.functional as F def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5): if input.device.type == 'cpu': if bias is not None: rest_dim = [1] * (input.ndim - bias.ndim - 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.autograd import Function import math import torch.nn as nn import tor...
mfredriksz/semanticGAN_code
ToSEG
false
16,055
[ "BSD-2-Clause", "MIT" ]
107
c6e7b490086afd8a7593e2892452295555910494
https://github.com/mfredriksz/semanticGAN_code/tree/c6e7b490086afd8a7593e2892452295555910494
MatrixVectorScaledDotProductAttention
import torch import numpy as np import torch.nn as nn class MatrixVectorScaledDotProductAttention(nn.Module): def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) self.softmax = nn.Softmax(dim=...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
michiyasunaga/GreaseLM
MatrixVectorScaledDotProductAttention
false
16,056
[ "MIT" ]
76
596aa5047841e3e97730f621a2e4576772733df2
https://github.com/michiyasunaga/GreaseLM/tree/596aa5047841e3e97730f621a2e4576772733df2
FFModule
import torch import torch.nn as nn class FFModule(nn.Module): """Feed-forward module default output dimension = idim x0 -> LayerNorm -> FC -> Swish -> Dropout -> FC -> Dropout -> x1 x0 + res_factor * x1 -> output """ def __init__(self, idim: 'int', res_factor: 'float'=0.5, dropout: '...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
maxwellzh/CAT
FFModule
false
16,057
[ "Apache-2.0" ]
237
b1a9c3f95e84d968593a05bf8b176b5f77b8055e
https://github.com/maxwellzh/CAT/tree/b1a9c3f95e84d968593a05bf8b176b5f77b8055e
Acosh
import torch import torch.onnx import torch.nn as nn class Acosh(nn.Module): def forward(self, x): return torch.acosh(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Acosh
false
16,058
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Cos
import torch import torch.onnx import torch.nn as nn class Cos(nn.Module): def forward(self, x): return torch.cos(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dy...
mil-tokyo/webdnn
Cos
false
16,059
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Ceil
import torch import torch.onnx import torch.nn as nn class Ceil(nn.Module): 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Ceil
false
16,060
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Concat3
import torch import torch.onnx import torch.nn as nn class Concat3(nn.Module): def __init__(self): super().__init__() def forward(self, c0, c1, c2): return torch.cat([c0, c1, c2], dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), 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.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Concat3
false
16,061
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
MultiSoftmaxCrossEntropyLoss
import torch import numpy as np import torch as th import torch.nn as nn import torch.utils.data.distributed class MultiSoftmaxCrossEntropyLoss(nn.Module): def __init__(self, class_weight=None, label_smoothing_value=0): super(MultiSoftmaxCrossEntropyLoss, self).__init__() self.class_weight = clas...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np imp...
microsoft/vision-longformer
MultiSoftmaxCrossEntropyLoss
false
16,062
[ "MIT" ]
169
c9ce386de3e633bb3c805368d118356fbd696487
https://github.com/microsoft/vision-longformer/tree/c9ce386de3e633bb3c805368d118356fbd696487
Asin
import torch import torch.onnx import torch.nn as nn class Asin(nn.Module): def forward(self, x): return torch.asin(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Asin
false
16,063
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Atanh
import torch import torch.onnx import torch.nn as nn class Atanh(nn.Module): def forward(self, x): return torch.atanh(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Atanh
false
16,064
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
AveragePool
import torch import torch.onnx import torch.nn as nn class AveragePool(nn.Module): def __init__(self): super().__init__() self.pool = nn.AvgPool2d(kernel_size=3, stride=1, padding=0, ceil_mode=True, count_include_pad=False) def forward(self, x): return self.pool(x) 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.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
AveragePool
false
16,065
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, hidden_size): super(Attention, self).__init__() self.hidden_size = hidden_size self.linear_in = nn.Linear(hidden_size, hidden_size, bias=False) def score(self, hidden_sta...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
michiyasunaga/DrRepair
Attention
false
16,066
[ "MIT" ]
139
fb447594149ac4f80fef8ba091373184120019c7
https://github.com/michiyasunaga/DrRepair/tree/fb447594149ac4f80fef8ba091373184120019c7
Acos
import torch import torch.onnx import torch.nn as nn class Acos(nn.Module): def forward(self, x): return torch.acos(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Acos
false
16,067
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Concat4
import torch import torch.onnx import torch.nn as nn class Concat4(nn.Module): def __init__(self): super().__init__() def forward(self, c0, c1, c2, c3): return torch.cat([c0, c1, c2, c3], dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), 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.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Concat4
false
16,068
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Cast
import torch import torch.onnx import torch.nn as nn class Cast(nn.Module): def forward(self, x): return x.type(torch.int32) 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Cast
false
16,069
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Asinh
import torch import torch.onnx import torch.nn as nn class Asinh(nn.Module): def forward(self, x): return torch.asinh(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Asinh
false
16,070
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ResBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
microsoft/S2R-DepthNet
ResBlock
false
16,071
[ "MIT" ]
144
aebc931c7e8c7baad4dec2a0fd8643244741c52e
https://github.com/microsoft/S2R-DepthNet/tree/aebc931c7e8c7baad4dec2a0fd8643244741c52e
Sign
import torch import torch.onnx import torch.nn as nn class Sign(nn.Module): def forward(self, x): return torch.sign(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Sign
false
16,072
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Neg
import torch import torch.onnx import torch.nn as nn class Neg(nn.Module): def forward(self, x): return torch.neg(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Neg
false
16,073
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Reciprocal
import torch import torch.onnx import torch.nn as nn class Reciprocal(nn.Module): def forward(self, x): return torch.reciprocal(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Reciprocal
false
16,074
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReduceSum3
import torch import torch.onnx import torch.nn as nn class ReduceSum3(nn.Module): def forward(self, x): return torch.sum(x, (1, 3), keepdim=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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
ReduceSum3
false
16,075
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Gather1D
import torch import torch.onnx import torch.nn as nn class Gather1D(nn.Module): def forward(self, x): return x[[2, 4, 5]] def get_inputs(): return [torch.rand([6, 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Gather1D
false
16,076
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReduceMin
import torch import torch.onnx import torch.nn as nn class ReduceMin(nn.Module): def forward(self, x): return torch.min(x, -1, keepdim=True)[0] 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.asse...
mil-tokyo/webdnn
ReduceMin
false
16,077
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReduceMean
import torch import torch.onnx import torch.nn as nn class ReduceMean(nn.Module): def forward(self, x): return torch.mean(x, -1, keepdim=True) 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
ReduceMean
false
16,078
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReduceSum
import torch import torch.onnx import torch.nn as nn class ReduceSum(nn.Module): def forward(self, x): return torch.sum(x, -1, keepdim=True) 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
ReduceSum
false
16,079
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Cosh
import torch import torch.onnx import torch.nn as nn class Cosh(nn.Module): def forward(self, x): return torch.cosh(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Cosh
false
16,080
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Permute
import torch import torch.onnx import torch.nn as nn class Permute(nn.Module): def forward(self, x): x = x + 1.0 return x.permute(2, 0, 1) def get_inputs(): return [torch.rand([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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
Permute
false
16,081
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Softsign
import torch import torch.onnx import torch.nn as nn class Softsign(nn.Module): def forward(self, x): return torch.nn.Softsign()(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dy...
mil-tokyo/webdnn
Softsign
false
16,082
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReduceMax
import torch import torch.onnx import torch.nn as nn class ReduceMax(nn.Module): def forward(self, x): return torch.max(x, -1, keepdim=True)[0] 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.asse...
mil-tokyo/webdnn
ReduceMax
false
16,083
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReLUExp
import torch import torch.onnx import torch.nn as nn import torch.nn.functional as F class ReLUExp(nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.exp(F.relu(x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retur...
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.onnx impo...
mil-tokyo/webdnn
ReLUExp
false
16,084
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Cube
import torch from torch import nn class CubeFunctionBackward(torch.autograd.Function): @staticmethod def forward(ctx, X, M): ctx.save_for_backward(X, M) return M * 3 * X ** 2 @staticmethod def backward(ctx, V): X, M = ctx.saved_tensors return V * 6 * X * M, V * 3 * X ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
minhnhat93/didyprog
Cube
false
16,086
[ "MIT" ]
57
78886ed939d269b9b2bcb192bf849aa34082880c
https://github.com/minhnhat93/didyprog/tree/78886ed939d269b9b2bcb192bf849aa34082880c
ReduceSum2
import torch import torch.onnx import torch.nn as nn class ReduceSum2(nn.Module): def forward(self, x): return torch.sum(x, (1, 3), keepdim=True) 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
ReduceSum2
false
16,087
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
MaxPool
import torch import torch.onnx import torch.nn as nn class MaxPool(nn.Module): def __init__(self): super().__init__() self.pool = nn.MaxPool2d(kernel_size=3, stride=2, padding=0, ceil_mode=True) def forward(self, x): return self.pool(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 from torch._inductor.runtime import triton_helpers import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.asse...
mil-tokyo/webdnn
MaxPool
false
16,088
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
Tan
import torch import torch.onnx import torch.nn as nn class Tan(nn.Module): def forward(self, x): return torch.tan(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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
mil-tokyo/webdnn
Tan
false
16,089
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
ReduceProd
import torch import torch.onnx import torch.nn as nn class ReduceProd(nn.Module): def forward(self, x): return torch.prod(x, -1, keepdim=True) 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 import torch.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
mil-tokyo/webdnn
ReduceProd
false
16,090
[ "MIT" ]
1,967
38a60fd3e1a4e72bc01108189a3aa51e0752aecd
https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd
LinearPotential
import torch from torch import nn from torch.nn import Parameter class LinearPotential(torch.nn.Module): def __init__(self, n_features, n_states, init_idx=None, eos_idx=None): super(LinearPotential, self).__init__() self.transition = Parameter(torch.zeros((n_states, n_states))) 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 import nn from torch.nn import Parameter assert_size_stride = torch._...
minhnhat93/didyprog
LinearPotential
false
16,091
[ "MIT" ]
57
78886ed939d269b9b2bcb192bf849aa34082880c
https://github.com/minhnhat93/didyprog/tree/78886ed939d269b9b2bcb192bf849aa34082880c
MSELoss2d
import torch import torch.nn as nn class MSELoss2d(nn.Module): def __init__(self, size_average=None, reduce=None, reduction='mean', ignore_index=255): super(MSELoss2d, self).__init__() self.MSE = nn.MSELoss(size_average=size_average, reduce=reduce, reduction=reduction) de...
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 ...
mimiliaogo/DACS
MSELoss2d
false
16,092
[ "MIT" ]
59
9f13e32566c293de560df4848b23631d9e11cf32
https://github.com/mimiliaogo/DACS/tree/9f13e32566c293de560df4848b23631d9e11cf32
AugCNN
import torch import torch.nn as nn import torch.nn.functional as F def apply_init_(modules): """ Initialize NN modules """ for m in modules: if isinstance(m, nn.Conv2d): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bias, 0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
minqi/auto-drac
AugCNN
false
16,093
[ "MIT" ]
84
59a25bbabd51946d7a645db9c5d59071b73b006d
https://github.com/minqi/auto-drac/tree/59a25bbabd51946d7a645db9c5d59071b73b006d
ClassicalFC1
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.utils.prune import torch.backends.cudnn import torch.cuda import torch.nn import torch.utils.data class ClassicalFC1(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(784, 1024) self.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....
mit-han-lab/pytorch-quantum
ClassicalFC1
false
16,094
[ "MIT" ]
98
05cf000d689307f6b1fe02d12744ad455685935b
https://github.com/mit-han-lab/pytorch-quantum/tree/05cf000d689307f6b1fe02d12744ad455685935b
DiceLoss
import torch import torch.nn as nn import torch.nn.parallel class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() self.smooth = 1.0 def forward(self, y_pred, y_true): assert y_pred.size() == y_true.size() y_pred = y_pred[:, 0].contiguous().view(-1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
mkoivi-ms/unet-pytorch-azureml
DiceLoss
false
16,095
[ "MIT" ]
517
f0fa5b15cfad19f6b04bb309a965726c25c39e03
https://github.com/mkoivi-ms/unet-pytorch-azureml/tree/f0fa5b15cfad19f6b04bb309a965726c25c39e03
chroma_subsampling
import torch import torch.nn as nn class chroma_subsampling(nn.Module): """ Chroma subsampling on CbCv channels Input: image(tensor): batch x height x width x 3 Output: y(tensor): batch x height x width cb(tensor): batch x height/2 x width/2 cr(tensor): batch x height/2 x 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
mlomnitz/DifferentiableJPEG
chroma_subsampling
false
16,096
[ "MIT" ]
86
a5767feba955a1bcb78600135a09c36a806f6249
https://github.com/mlomnitz/DifferentiableJPEG/tree/a5767feba955a1bcb78600135a09c36a806f6249
LearnedPositionalEncoding
import torch from torch import nn class LayerNorm(nn.Module): """A layernorm module in the TF style (epsilon inside the square root).""" def __init__(self, d_model, variance_epsilon=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
minhnn-tiny/vietocr
LearnedPositionalEncoding
false
16,097
[ "Apache-2.0" ]
307
80ed99b5d29df3f04c54ae394c525117846b503a
https://github.com/minhnn-tiny/vietocr/tree/80ed99b5d29df3f04c54ae394c525117846b503a
ClassificationHead
import torch class ClassificationHead(torch.nn.Linear): def __init__(self, normalize, weights, biases=None): output_size, input_size = weights.shape super().__init__(input_size, output_size) self.normalize = normalize if weights is not None: self.weight = torch.nn.Para...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
mlfoundations/wise-ft
ClassificationHead
false
16,098
[ "MIT" ]
79
58b7a4b343b09dc06606aa929c2ef51accced8d1
https://github.com/mlfoundations/wise-ft/tree/58b7a4b343b09dc06606aa929c2ef51accced8d1