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
SpatialAttention
import torch from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Vanova/argus-freesound
SpatialAttention
false
11,953
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
RBFExpansion
import torch import numpy as np import torch.nn as nn class RBFExpansion(nn.Module): """Expand distances between nodes by radial basis functions. .. math:: \\exp(- \\gamma * ||d - \\mu||^2) where :math:`d` is the distance between two nodes and :math:`\\mu` helps centralizes the distances. We...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np import torch.nn as nn assert_size_stride = torch._C._d...
VoVAllen/dgl-lifesci
RBFExpansion
false
11,954
[ "Apache-2.0" ]
0
96895f2bddf255ad326f0bc4e8064bc3ed5c3044
https://github.com/VoVAllen/dgl-lifesci/tree/96895f2bddf255ad326f0bc4e8064bc3ed5c3044
SqueezeEmbedding
import torch import torch.nn as nn class SqueezeEmbedding(nn.Module): """ Squeeze sequence embedding length to the longest one in the batch """ def __init__(self, batch_first=True): super(SqueezeEmbedding, self).__init__() self.batch_first = batch_first def forward(self, x, x_len...
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...
WeiLi9811/PyABSA
SqueezeEmbedding
false
11,955
[ "MIT" ]
0
e1595784b8c978c1e91c0d8139a0a4dc36ac5965
https://github.com/WeiLi9811/PyABSA/tree/e1595784b8c978c1e91c0d8139a0a4dc36ac5965
QuickGELU
import torch from torch import nn class QuickGELU(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Taekyoon/executors
QuickGELU
false
11,956
[ "Apache-2.0" ]
0
567f12c4193bb7be814f84540ea31585cd35b344
https://github.com/Taekyoon/executors/tree/567f12c4193bb7be814f84540ea31585cd35b344
Attention
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WeiLi9811/PyABSA
Attention
false
11,957
[ "MIT" ]
0
e1595784b8c978c1e91c0d8139a0a4dc36ac5965
https://github.com/WeiLi9811/PyABSA/tree/e1595784b8c978c1e91c0d8139a0a4dc36ac5965
FaceMask
import torch import torch.nn as nn import torch.nn.functional as F def accuracy(outputs, labels): _, preds = torch.max(outputs, dim=1) return torch.tensor(torch.sum(preds == labels).item() / len(preds)) class FaceMask(nn.Module): def __init__(self, input_size, out_size): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
VrajeshPatel20/FaceMask-Detection
FaceMask
false
11,958
[ "MIT" ]
0
1527f47a94a1b40b470eab633cf4a655c9a3e44e
https://github.com/VrajeshPatel20/FaceMask-Detection/tree/1527f47a94a1b40b470eab633cf4a655c9a3e44e
MultiHeadAttn
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_model = d_model self.d_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
UoMfzp/transformer-xl-Chinese-Pytorch
MultiHeadAttn
false
11,959
[ "Apache-2.0" ]
0
435641ed138e81f949c5b557b5a13c0a09fb6018
https://github.com/UoMfzp/transformer-xl-Chinese-Pytorch/tree/435641ed138e81f949c5b557b5a13c0a09fb6018
MultiHeadAttn
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.collect_env class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_mod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Vatican-X-Formers/xl
MultiHeadAttn
false
11,960
[ "Apache-2.0" ]
0
216b16cdf0af6a8244e9494a60f870972c2a2524
https://github.com/Vatican-X-Formers/xl/tree/216b16cdf0af6a8244e9494a60f870972c2a2524
ConvolModel
import torch import torch.nn as nn import torch.nn.functional as F class ConvolModel(nn.Module): def __init__(self): super(ConvolModel, self).__init__() self.conv1 = nn.Conv2d(1, 5, 2) self.conv2 = nn.Conv2d(5, 10, 2) self.conv3 = nn.Conv2d(10, 10, 2) def forward(self, 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 import torch.nn as nn assert_...
VVKot/mlinseconds-find-me
ConvolModel
false
11,961
[ "MIT" ]
0
f50ec09ef5cef23b694970a9a975f7a0f8c59b76
https://github.com/VVKot/mlinseconds-find-me/tree/f50ec09ef5cef23b694970a9a975f7a0f8c59b76
FeedForwardLayer
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import LayerNorm class FeedForwardLayer(nn.Module): def __init__(self, d_model, dim_feedforward=2048, dropout=0.1): super(FeedForwardLayer, self).__init__() self.linear1 = nn.Linear(d_model, 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....
WeightsandBiases/deeplearningposeestimation
FeedForwardLayer
false
11,962
[ "BSD-3-Clause" ]
0
406761ba3e0b66ed8640c99bcd28e2b232c92a4f
https://github.com/WeightsandBiases/deeplearningposeestimation/tree/406761ba3e0b66ed8640c99bcd28e2b232c92a4f
InterModalityUpdate
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class InterModalityUpdate(nn.Module): """ Inter-modality Attention Flow """ def __init__(self, v_size, q_size, output_size, num_head, drop=0.0): super(InterModalityUpdate, self).__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....
TranTony/DFAF-for-VQA.pytorch
InterModalityUpdate
false
11,963
[ "MIT" ]
0
eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
https://github.com/TranTony/DFAF-for-VQA.pytorch/tree/eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
DyIntraModalityUpdate
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class DyIntraModalityUpdate(nn.Module): """ Dynamic Intra-modality Attention Flow """ def __init__(self, v_size, q_size, output_size, num_head, drop=0.0): super(DyIntraModalityUpdate, 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....
TranTony/DFAF-for-VQA.pytorch
DyIntraModalityUpdate
false
11,964
[ "MIT" ]
0
eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
https://github.com/TranTony/DFAF-for-VQA.pytorch/tree/eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
GaussianKernel
import torch import torch.nn as nn class GaussianKernel(nn.Module): """ Gaussian kernel module. :param mu: Float, mean of the kernel. :param sigma: Float, sigma of the kernel. Examples: >>> import torch >>> kernel = GaussianKernel() >>> x = torch.randn(4, 5, 10) >...
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...
ThuYShao/MatchZoo-py
GaussianKernel
false
11,965
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
UpBlock
import torch import torch.nn as nn import torch.nn.functional as F class UpBlock(nn.Module): """Upsample block for DRRG and TextSnake.""" def __init__(self, in_channels, out_channels): super().__init__() assert isinstance(in_channels, int) assert isinstance(out_channels, int) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Whatsetsthisend/mmocr
UpBlock
false
11,966
[ "Apache-2.0" ]
0
6444b3226a10162378b5ed3109991cc618e89fa4
https://github.com/Whatsetsthisend/mmocr/tree/6444b3226a10162378b5ed3109991cc618e89fa4
ZeroConv2d
import torch from torch import nn from torch.nn import functional as F class ZeroConv2d(nn.Module): def __init__(self, in_channel, out_channel, padding=1): super(ZeroConv2d, self).__init__() self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0) self.conv.weight.data.zero_() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
XeniaLLL/glow-pytorch
ZeroConv2d
false
11,967
[ "MIT" ]
0
66d434e57853de1aaafaa5a5533d21705dc92e10
https://github.com/XeniaLLL/glow-pytorch/tree/66d434e57853de1aaafaa5a5533d21705dc92e10
layer_normalization
import torch import torch.nn as nn class layer_normalization(nn.Module): def __init__(self, features, epsilon=1e-08): """Applies layer normalization. Args: epsilon: A floating number. A very small number for preventing ZeroDivision Error. """ super(layer_normalization, ...
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_...
Woodytse/transformer
layer_normalization
false
11,968
[ "MIT" ]
0
56f7c3051765e8cb3c34d2e9a41d483cec162256
https://github.com/Woodytse/transformer/tree/56f7c3051765e8cb3c34d2e9a41d483cec162256
label_smoothing
import torch import torch.nn as nn class label_smoothing(nn.Module): def __init__(self, epsilon=0.1): """Applies label smoothing. See https://arxiv.org/abs/1512.00567. Args: epsilon: Smoothing rate. """ super(label_smoothing, self).__init__() self.epsilon = ep...
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...
Woodytse/transformer
label_smoothing
false
11,969
[ "MIT" ]
0
56f7c3051765e8cb3c34d2e9a41d483cec162256
https://github.com/Woodytse/transformer/tree/56f7c3051765e8cb3c34d2e9a41d483cec162256
LayerScale_Block_CA
import torch import torch.nn as nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WangFeng18/deit
LayerScale_Block_CA
false
11,970
[ "Apache-2.0" ]
0
62a2c54faf683af8316fbec2e99f666879949cb4
https://github.com/WangFeng18/deit/tree/62a2c54faf683af8316fbec2e99f666879949cb4
Dropout2d
import torch import torch.backends import torch.nn.functional as F from torch.nn.modules.dropout import _DropoutNd class Dropout2d(_DropoutNd): """Randomly zero out entire channels (a channel is a 2D feature map, e.g., the :math:`j`-th channel of the :math:`i`-th sample in the batched input is a 2D tensor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.backends from torch.nn.modules.dropout import _DropoutNd assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_...
ThierryJudge/baal
Dropout2d
false
11,971
[ "Apache-2.0" ]
0
8c1b1e2a47e5dd6c6b75d57b8c2152a00ba6b323
https://github.com/ThierryJudge/baal/tree/8c1b1e2a47e5dd6c6b75d57b8c2152a00ba6b323
Discrete
import torch import torch.nn as nn class Discrete(nn.Module): def __init__(self): super(Discrete, self).__init__() def forward(self, x): return nn.functional.softmax(x, dim=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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
WillDudley/client
Discrete
false
11,972
[ "MIT" ]
0
957f93c43eb8e5b0f51fabf3b47c362bce25389e
https://github.com/WillDudley/client/tree/957f93c43eb8e5b0f51fabf3b47c362bce25389e
RobustScannerFusionLayer
import torch import torch.nn as nn class RobustScannerFusionLayer(nn.Module): def __init__(self, dim_model, dim=-1): super().__init__() self.dim_model = dim_model self.dim = dim self.linear_layer = nn.Linear(dim_model * 2, dim_model * 2) self.glu_layer = nn.GLU(dim=dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Whatsetsthisend/mmocr
RobustScannerFusionLayer
false
11,973
[ "Apache-2.0" ]
0
6444b3226a10162378b5ed3109991cc618e89fa4
https://github.com/Whatsetsthisend/mmocr/tree/6444b3226a10162378b5ed3109991cc618e89fa4
InvConv2d
import torch from torch import nn from torch.nn import functional as F class InvConv2d(nn.Module): def __init__(self, in_channel): """ a flow contains the equivalent of a permutation that reverses the ordering of the channels replact the fixed permutation with a (learned) invertible 1x1 c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 functional as F assert_size_stride = t...
XeniaLLL/glow-pytorch
InvConv2d
false
11,974
[ "MIT" ]
0
66d434e57853de1aaafaa5a5533d21705dc92e10
https://github.com/XeniaLLL/glow-pytorch/tree/66d434e57853de1aaafaa5a5533d21705dc92e10
ResidualBlock_noBN
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
WenlongZhang0724/mmsr
ResidualBlock_noBN
false
11,975
[ "Apache-2.0" ]
0
375ce9207c2b8586101406577faea285885b8009
https://github.com/WenlongZhang0724/mmsr/tree/375ce9207c2b8586101406577faea285885b8009
MatchingTensor
import torch import torch.nn as nn import torch.nn.functional as F class MatchingTensor(nn.Module): """ Module that captures the basic interactions between two tensors. :param matching_dims: Word dimension of two interaction texts. :param channels: Number of word interaction tensor channels. :par...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ThuYShao/MatchZoo-py
MatchingTensor
false
11,976
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
RankCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class RankCrossEntropyLoss(nn.Module): """Creates a criterion that measures rank cross entropy loss.""" __constants__ = ['num_neg'] def __init__(self, num_neg: 'int'=1): """ :class:`RankCrossEntropyLoss` constructor. ...
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 ...
ThuYShao/MatchZoo-py
RankCrossEntropyLoss
false
11,977
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
rSoftMax
import torch import torch.nn as nn import torch.nn.functional as F class rSoftMax(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.size(0) if self.radix > 1: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
XuYongi/KiNet
rSoftMax
false
11,978
[ "MIT" ]
0
fab8865a09e3779baf0daf1db1bf59a9cfbde450
https://github.com/XuYongi/KiNet/tree/fab8865a09e3779baf0daf1db1bf59a9cfbde450
BasicModel
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, input): input = 1 - F.relu(1 - input) return input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
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...
YNNEKUW/captum
BasicModel
false
11,979
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
LayerScale_Block
import torch import torch.nn as nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WangFeng18/deit
LayerScale_Block
false
11,980
[ "Apache-2.0" ]
0
62a2c54faf683af8316fbec2e99f666879949cb4
https://github.com/WangFeng18/deit/tree/62a2c54faf683af8316fbec2e99f666879949cb4
ReLUDeepLiftModel
import torch import torch.nn as nn class ReLUDeepLiftModel(nn.Module): """ https://www.youtube.com/watch?v=f_iAM0NPwnM """ def __init__(self) ->None: super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
ReLUDeepLiftModel
false
11,981
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
MatchModule
import torch import torch.nn as nn import torch.nn.functional as F class MatchModule(nn.Module): """ Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> impo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ThuYShao/MatchZoo-py
MatchModule
false
11,982
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
BasicModel4_MultiArgs
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel4_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2) / x3) """ def __init__(self) ->None: super().__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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel4_MultiArgs
false
11,983
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
BasicModel5_MultiArgs
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel5_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) * x3[0] - ReLU(x2) * x3[1]) """ def __init__(self) ->None: s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel5_MultiArgs
false
11,984
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
ResidualBlockNoBN
import torch import torch.utils.data from torch.utils import data as data import torch.nn as nn from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm @torch.no_grad() def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs): """Initialize network weights. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
Xjg-0216/DCSNet
ResidualBlockNoBN
false
11,985
[ "MIT" ]
0
0ed27d01ef1d3dbff7613ab3b145f95a32c071eb
https://github.com/Xjg-0216/DCSNet/tree/0ed27d01ef1d3dbff7613ab3b145f95a32c071eb
SemanticComposite
import torch import torch.nn as nn class SemanticComposite(nn.Module): """ SemanticComposite module. Apply a self-attention layer and a semantic composite fuse gate to compute the encoding result of one tensor. :param in_features: Feature size of input. :param dropout_rate: The dropout rate....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ThuYShao/MatchZoo-py
SemanticComposite
false
11,986
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
BasicModel_MaxPool_ReLU
import torch import torch.nn as nn class BasicModel_MaxPool_ReLU(nn.Module): def __init__(self, inplace=False) ->None: super().__init__() self.maxpool = nn.MaxPool1d(3) self.relu = nn.ReLU(inplace=inplace) def forward(self, x): return self.relu(self.maxpool(x)).sum(dim=1) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel_MaxPool_ReLU
false
11,987
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
SkipLastTargetChannelWrapper
import torch from torch import nn from torch.nn import MSELoss class SkipLastTargetChannelWrapper(nn.Module): """ Loss wrapper which removes additional target channel """ def __init__(self, loss, squeeze_channel=False): super(SkipLastTargetChannelWrapper, self).__init__() self.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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
YinanZYN/pytorch-3dunet
SkipLastTargetChannelWrapper
false
11,988
[ "MIT" ]
0
d1494f421a836af54c3dde65c54e3e62d5c00800
https://github.com/YinanZYN/pytorch-3dunet/tree/d1494f421a836af54c3dde65c54e3e62d5c00800
GELU
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class GELU(nn.Module): def forward(self, x): cdf = 0.5 * (1.0 + torch.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
YNNEKUW/fairseq
GELU
false
11,989
[ "MIT" ]
0
ef145b330ef26e7fb76609524504ab7933b88172
https://github.com/YNNEKUW/fairseq/tree/ef145b330ef26e7fb76609524504ab7933b88172
BasicModel2
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel2(nn.Module): """ Example model one from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1) - 1 - ReLU(x2)) """ def __init__(self) ->None: super().__init__() def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel2
false
11,990
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
BasicModel6_MultiTensor
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel6_MultiTensor(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, input1, input2): input = input1 + input2 return 1 - F.relu(1 - input)[:, 1] 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.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel6_MultiTensor
false
11,991
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
adder2d
from torch.autograd import Function import math import torch import torch.nn as nn def adder2d_function(X, W, stride=1, padding=0): n_filters, _d_filter, h_filter, w_filter = W.size() n_x, _d_x, h_x, w_x = X.size() h_out = (h_x - h_filter + 2 * padding) / stride + 1 w_out = (w_x - w_filter + 2 * paddi...
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.autograd import Function import math import torch.nn as nn ass...
Xyfuture/AdderNet
adder2d
false
11,992
[ "BSD-3-Clause" ]
0
62f567164175558622748464fb2f47d37d579b29
https://github.com/Xyfuture/AdderNet/tree/62f567164175558622748464fb2f47d37d579b29
MultiRelu
import torch from torch import Tensor from typing import Tuple import torch.nn as nn from typing import no_type_check class MultiRelu(nn.Module): def __init__(self, inplace: 'bool'=False) ->None: super().__init__() self.relu1 = nn.ReLU(inplace=inplace) self.relu2 = nn.ReLU(inplace=inplace...
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...
YNNEKUW/captum
MultiRelu
false
11,993
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
TanhDeepLiftModel
import torch import torch.nn as nn class TanhDeepLiftModel(nn.Module): """ Same as the ReLUDeepLiftModel, but with activations that can have negative outputs """ def __init__(self) ->None: super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(se...
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_...
YNNEKUW/captum
TanhDeepLiftModel
false
11,994
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
SigmoidDeepLiftModel
import torch import torch.nn as nn class SigmoidDeepLiftModel(nn.Module): """ Model architecture from: https://medium.com/coinmonks/create-a-neural-network-in -pytorch-and-make-your-life-simpler-ec5367895199 """ def __init__(self, num_in, num_hidden, num_out) ->None: super().__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 import triton_helpers import torch.nn as nn assert_...
YNNEKUW/captum
SigmoidDeepLiftModel
false
11,995
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
LinearMaxPoolLinearModel
import torch import torch.nn as nn class LinearMaxPoolLinearModel(nn.Module): def __init__(self) ->None: super().__init__() self.lin1 = nn.Linear(4, 4, bias=False) self.lin1.weight = nn.Parameter(torch.eye(4, 4)) self.pool1 = nn.MaxPool1d(4) self.lin2 = nn.Linear(1, 1, bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
YNNEKUW/captum
LinearMaxPoolLinearModel
false
11,996
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
BCEDiceLoss
import torch from torch import nn def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) axis_order = (1, 0) + tuple(range(2, tensor.dim())) transposed = ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
YinanZYN/pytorch-3dunet
BCEDiceLoss
false
11,997
[ "MIT" ]
0
d1494f421a836af54c3dde65c54e3e62d5c00800
https://github.com/YinanZYN/pytorch-3dunet/tree/d1494f421a836af54c3dde65c54e3e62d5c00800
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
YangfeiLiu/mmclassification
FocalLoss
false
11,998
[ "Apache-2.0" ]
0
422c757e287a45aae5049b90238fbe038ee766aa
https://github.com/YangfeiLiu/mmclassification/tree/422c757e287a45aae5049b90238fbe038ee766aa
Dense
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler def get_einsum_string(ndims, einsum_symbols=None): if einsum_symbols is None: einsum_symbols = ['u', 'v', 'w', 'x', 'y', 'z'] assert ndims <= len...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.utils.data import torch.on...
YNNEKUW/fairseq
Dense
false
11,999
[ "MIT" ]
0
ef145b330ef26e7fb76609524504ab7933b88172
https://github.com/YNNEKUW/fairseq/tree/ef145b330ef26e7fb76609524504ab7933b88172
ClassificationNet
import torch import torch.nn.functional as F from torch import nn class ClassificationNet(nn.Module): def __init__(self, num_classes=10, num_digits=2): super(ClassificationNet, self).__init__() self.conv1 = nn.Conv2d(1, 64, 3, padding=1) self.conv2 = nn.Conv2d(64, 64, 3, padding=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
YIFEI-MA/MultiDigitRecognition
ClassificationNet
false
12,000
[ "MIT" ]
0
f1f9567c31102ccdc7464a35b8a7c533b5d46734
https://github.com/YIFEI-MA/MultiDigitRecognition/tree/f1f9567c31102ccdc7464a35b8a7c533b5d46734
BasicModel_ConvNet_One_Conv
import torch from torch import Tensor from typing import Optional import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet_One_Conv(nn.Module): def __init__(self, inplace: 'bool'=False) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.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 torch.nn as nn assert_...
YNNEKUW/captum
BasicModel_ConvNet_One_Conv
false
12,001
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
ToTensor
from torch.nn import Module import torch class ToTensor(Module): def __init__(self): super(ToTensor, self).__init__() def forward(self, x): x = x / 255 return 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.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._em...
Yu-Zhewen/finn
ToTensor
false
12,002
[ "BSD-3-Clause" ]
0
5c1be584d47edfe4b43976a32a5c537f4037b017
https://github.com/Yu-Zhewen/finn/tree/5c1be584d47edfe4b43976a32a5c537f4037b017
TinyCnn
import torch import torch.nn as nn class TinyCnn(nn.Module): def __init__(self, feature_extraction=False) ->None: super().__init__() self.feature_extraction = feature_extraction self.conv1 = nn.Conv2d(3, 3, 5) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
YNNEKUW/captum
TinyCnn
false
12,003
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
TSA_Fusion
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super(TSA_Fusion, 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 import torch.utils.data impor...
WenlongZhang0724/mmsr
TSA_Fusion
false
12,004
[ "Apache-2.0" ]
0
375ce9207c2b8586101406577faea285885b8009
https://github.com/WenlongZhang0724/mmsr/tree/375ce9207c2b8586101406577faea285885b8009
StdConv2d
import torch import torch.nn as nn import torch.nn.functional as F class StdConv2d(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-05) return F.conv2d(x, w, self.bias, self.stri...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Yifanfanfanfan/ViT-pytorch
StdConv2d
false
12,005
[ "MIT" ]
0
0f975aa7d3fd0aba6f74260c2b5a91786f1211ba
https://github.com/Yifanfanfanfan/ViT-pytorch/tree/0f975aa7d3fd0aba6f74260c2b5a91786f1211ba
DupCNN2
import torch from torch import nn class DupCNN2(nn.Module): def __init__(self, input_shape, output_size, conv_layers, fc_layers): super(DupCNN2, self).__init__() self.input_shape = input_shape self.output_size = output_size self.conv_layers = conv_layers self.fc_layers = 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 import nn assert_s...
WillieMaddox/Airbus_SDC_dup
DupCNN2
false
12,006
[ "MIT" ]
0
09be904cf3c8050086f07538f5e2954282de5d62
https://github.com/WillieMaddox/Airbus_SDC_dup/tree/09be904cf3c8050086f07538f5e2954282de5d62
DupCNN
import torch from torch import nn class DupCNN(nn.Module): def __init__(self, input_shape, output_size, conv_layers, fc_layers): super(DupCNN, self).__init__() self.input_shape = input_shape self.output_size = output_size self.conv_layers = conv_layers self.fc_layers = fc_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
WillieMaddox/Airbus_SDC_dup
DupCNN
false
12,007
[ "MIT" ]
0
09be904cf3c8050086f07538f5e2954282de5d62
https://github.com/WillieMaddox/Airbus_SDC_dup/tree/09be904cf3c8050086f07538f5e2954282de5d62
SigmoidFocalLoss
import torch from torch import nn class SigmoidFocalLoss(nn.Module): def __init__(self, gamma, alpha): super().__init__() self.gamma = gamma self.alpha = alpha def forward(self, out, target): n_class = out.shape[1] class_ids = torch.arange(1, n_class + 1, dtype=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 math as tl_math from torch import nn a...
YinlinHu/fcos-pytorch
SigmoidFocalLoss
false
12,008
[ "MIT" ]
0
a0f8b321a7330710e5e8ce5adb92364f381e9e85
https://github.com/YinlinHu/fcos-pytorch/tree/a0f8b321a7330710e5e8ce5adb92364f381e9e85
BasicModel_ConvNet
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet(nn.Module): def __init__(self) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
YNNEKUW/captum
BasicModel_ConvNet
false
12,009
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
Attention
import torch from torch import nn from torch.nn import functional as F from torch.nn import Parameter from torch import FloatTensor def new_parameter(*size): out = Parameter(FloatTensor(*size)) torch.nn.init.xavier_normal(out) return out class Attention(nn.Module): def __init__(self, attention_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....
Yucao42/DeepLearning2019
Attention
false
12,010
[ "MIT" ]
0
90421a85686655e969bc473c60dfafc3558b6f33
https://github.com/Yucao42/DeepLearning2019/tree/90421a85686655e969bc473c60dfafc3558b6f33
EncoderImagePrecomp
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class EncoderImagePrecomp(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgno...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Yoark/VG-NSL_ext
EncoderImagePrecomp
false
12,011
[ "MIT" ]
0
fea8155076020d294e840cf06ca5a8689c82a20e
https://github.com/Yoark/VG-NSL_ext/tree/fea8155076020d294e840cf06ca5a8689c82a20e
SmoothL1Loss
import torch import torch.nn as nn import torch.nn.functional as F class SmoothL1Loss(nn.Module): """SmoothL1Loss loss . Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the los...
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 ...
ZephyrII/mmpose_charger
SmoothL1Loss
false
12,012
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
MSELoss
import torch import torch.nn as nn import torch.nn.functional as F class MSELoss(nn.Module): """MSE loss for coordinate regression.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.mse_loss self.use_target_weight = use_target_weigh...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
ZephyrII/mmpose_charger
MSELoss
false
12,013
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
BasicModel_ConvNet_MaxPool3d
import torch import torch.nn as nn class BasicModel_ConvNet_MaxPool3d(nn.Module): """Same as above, but with the MaxPool1d replaced with a MaxPool3d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift Attributions """ def __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....
YNNEKUW/captum
BasicModel_ConvNet_MaxPool3d
false
12,014
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
BasicModel_ConvNet_MaxPool1d
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet_MaxPool1d(nn.Module): """Same as above, but with the MaxPool2d replaced with a MaxPool1d. This is useful because the MaxPool modules behave differently to other modules from the perspectiv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
YNNEKUW/captum
BasicModel_ConvNet_MaxPool1d
false
12,015
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
BasicModel3
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel3(nn.Module): """ Example model two from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2)) """ def __init__(self) ->None: super().__init__() def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel3
false
12,016
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
make_style
import torch import torch.nn as nn import torch.nn.functional as F class make_style(nn.Module): def __init__(self): super().__init__() self.flatten = nn.Flatten() def forward(self, x0): style = F.avg_pool2d(x0, kernel_size=(x0.shape[-2], x0.shape[-1])) style = self.flatten(st...
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_...
YinuoJin/cellpose
make_style
false
12,017
[ "BSD-3-Clause" ]
0
eb8df70f295ac8465633f468d487aee1dd13a181
https://github.com/YinuoJin/cellpose/tree/eb8df70f295ac8465633f468d487aee1dd13a181
PositionwiseFeedForward
import torch import torch.nn as nn class LayerNormalization(nn.Module): """ Layer normalization module """ def __init__(self, d_hid, eps=0.001): super(LayerNormalization, self).__init__() self.eps = eps self.a_2 = nn.Parameter(torch.ones(d_hid), requires_grad=True) self.b_2 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
YunjieJi/attention-is-all-you-need-pytorch
PositionwiseFeedForward
false
12,018
[ "MIT" ]
0
636117b438d584ccba0ae5d6998fc02f3888f46e
https://github.com/YunjieJi/attention-is-all-you-need-pytorch/tree/636117b438d584ccba0ae5d6998fc02f3888f46e
NormLayer
import torch import torch.nn as nn class NormLayer(nn.Module): def __init__(self, mean, std, n=None, eps=1e-08) ->None: super().__init__() self.mean = mean self.std = std self.eps = eps def forward(self, x): return (x - self.mean) / (self.std + self.eps) def get_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
YNNEKUW/captum
NormLayer
false
12,019
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
WingLoss
import math import torch import torch.nn as nn class WingLoss(nn.Module): """Wing Loss 'Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks' Feng et al. CVPR'2018. Args: omega (float), epsilon (float) are hyper-parameters. use_target_weight (bool): Option ...
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 math import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
ZephyrII/mmpose_charger
WingLoss
false
12,020
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
ExtResNetBlock
import torch from torch import nn def conv3d(in_channels, out_channels, kernel_size, bias, padding): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding): """ Create a list 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.triton_helpers import libdevice from torch import n...
YinanZYN/pytorch-3dunet
ExtResNetBlock
false
12,021
[ "MIT" ]
0
d1494f421a836af54c3dde65c54e3e62d5c00800
https://github.com/YinanZYN/pytorch-3dunet/tree/d1494f421a836af54c3dde65c54e3e62d5c00800
Conv2dBlock
import torch from torch import nn import torch.nn.functional as F def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
YueZHOU0926/MUNIT_3D
Conv2dBlock
false
12,022
[ "MIT" ]
0
5cb22b5f3cb127d5b2c4eea038254a7881bab372
https://github.com/YueZHOU0926/MUNIT_3D/tree/5cb22b5f3cb127d5b2c4eea038254a7881bab372
BCELoss
import torch import torch.nn as nn import torch.nn.functional as F class BCELoss(nn.Module): """Binary Cross Entropy loss.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.binary_cross_entropy self.use_target_weight = use_target_we...
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...
ZephyrII/mmpose_charger
BCELoss
false
12,023
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
CombinedTargetMSELoss
import torch import torch.nn as nn class CombinedTargetMSELoss(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into ...
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...
ZephyrII/mmpose_charger
CombinedTargetMSELoss
false
12,024
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
FCDiscriminator
import torch import torch.nn as nn class FCDiscriminator(nn.Module): def __init__(self, num_classes, ndf=64): super(FCDiscriminator, self).__init__() self.conv1 = nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1) self.conv2 = nn.Conv2d(ndf, ndf * 2, kernel_size=4...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
YoNyeoSeok/AsymTri
FCDiscriminator
false
12,025
[ "MIT" ]
0
a5a9a4b92074d770ed57802ff26b149a301cf4a4
https://github.com/YoNyeoSeok/AsymTri/tree/a5a9a4b92074d770ed57802ff26b149a301cf4a4
VertexDirectEmbedder
import torch import torch.utils.data from torch import nn def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06 ) ->torch.Tensor: """ Normalize N D-dimensional embedding vectors arranged in a tensor [N, D] Args: embeddings (tensor [N, D]): N D-dimensional embedding vecto...
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 from...
YutouTaro/detectron2
VertexDirectEmbedder
false
12,026
[ "Apache-2.0" ]
0
29f90062fa2978a35f1d599bb30768a2370378ca
https://github.com/YutouTaro/detectron2/tree/29f90062fa2978a35f1d599bb30768a2370378ca
Affine
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class Affine(nn.Module): def __init__(self, dim): super().__init__() self.alpha = nn.Parameter(torch.ones((1, 1, dim))) self.beta = nn.Parameter(torch.zeros((1, 1, dim))) def forward(self, 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 import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
Yuki-Tanaka-33937424/pytorch-image-models
Affine
false
12,027
[ "Apache-2.0" ]
0
6c1da622dcb2a0421aeb6cdcadd03cc366331f66
https://github.com/Yuki-Tanaka-33937424/pytorch-image-models/tree/6c1da622dcb2a0421aeb6cdcadd03cc366331f66
ResizeTransform
import torch import torch.nn as nn import torch.nn.functional as nnf class ResizeTransform(nn.Module): """ Resize a transform, which involves resizing the vector field *and* rescaling it. """ def __init__(self, vel_resize, ndims): super().__init__() self.factor = 1.0 / vel_resize ...
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...
Zer0-00/voxelmorph
ResizeTransform
false
12,028
[ "Apache-2.0" ]
0
ed2e0384cf22d19f7e57bea5887fc197d55f60bc
https://github.com/Zer0-00/voxelmorph/tree/ed2e0384cf22d19f7e57bea5887fc197d55f60bc
MPJPELoss
import torch import torch.nn as nn class MPJPELoss(nn.Module): """MPJPE (Mean Per Joint Position Error) loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss. Default:...
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_...
ZephyrII/mmpose_charger
MPJPELoss
false
12,029
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
FocalLossBinary
import torch import torch.jit import torch.nn.functional as F import torch.nn.functional from functools import partial from torch.nn.modules.loss import _Loss def reduced_focal_loss(outputs: 'torch.Tensor', targets: 'torch.Tensor', threshold: 'float'=0.5, gamma: 'float'=2.0, reduction='mean'): """ Compute...
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...
ZhongYingMatrix/nnUNet
FocalLossBinary
false
12,030
[ "Apache-2.0" ]
0
c3f028e79d4d5c3f2eb58396ffd0ae54048c132b
https://github.com/ZhongYingMatrix/nnUNet/tree/c3f028e79d4d5c3f2eb58396ffd0ae54048c132b
ArcMarginProduct
import math import torch import torchvision.transforms.functional as F from torch import nn from torch.nn import functional as F class ArcMarginProduct(nn.Module): def __init__(self, in_features, out_features): super().__init__() self.weight = nn.Parameter(torch.FloatTensor(out_features, in_featu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
aaron276h/kaggle-rcic-1st
ArcMarginProduct
false
12,031
[ "MIT" ]
0
d35e97847df3c29f548e60bc936d3fec7a0a4c08
https://github.com/aaron276h/kaggle-rcic-1st/tree/d35e97847df3c29f548e60bc936d3fec7a0a4c08
LinearNet
import torch import torch.nn as nn import torch.nn.functional as F class LinearNet(nn.Module): def __init__(self, board_width, board_height): super(LinearNet, self).__init__() self.board_width = board_width self.board_height = board_height self.model = nn.Linear(in_features=4 * se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ZiwenZhuang/AlphaZero_Gomoku
LinearNet
false
12,032
[ "MIT" ]
0
72db1c3eda1f6133da24c924da6032ea3569076e
https://github.com/ZiwenZhuang/AlphaZero_Gomoku/tree/72db1c3eda1f6133da24c924da6032ea3569076e
ScaleLayer
import torch import torch.nn as nn import torch._utils class ScaleLayer(nn.Module): def __init__(self, init_value=1.0, lr_mult=1): super().__init__() self.lr_mult = lr_mult self.scale = nn.Parameter(torch.full((1,), init_value / lr_mult, dtype=torch.float32)) def forward(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch._utils assert_size_stride = torch._C._...
aagaard/ritm_interactive_segmentation
ScaleLayer
false
12,033
[ "MIT" ]
0
c68b45a54e99eb5401f50e62f7e43a11e34964ee
https://github.com/aagaard/ritm_interactive_segmentation/tree/c68b45a54e99eb5401f50e62f7e43a11e34964ee
SoftIoU
import torch import torch.nn as nn import torch._utils class SoftIoU(nn.Module): def __init__(self, from_sigmoid=False, ignore_label=-1): super().__init__() self._from_sigmoid = from_sigmoid self._ignore_label = ignore_label def forward(self, pred, label): label = label.view(...
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 assert_size_stride = torch._C._dynamo.guards.as...
aagaard/ritm_interactive_segmentation
SoftIoU
false
12,034
[ "MIT" ]
0
c68b45a54e99eb5401f50e62f7e43a11e34964ee
https://github.com/aagaard/ritm_interactive_segmentation/tree/c68b45a54e99eb5401f50e62f7e43a11e34964ee
PatchMerging
import torch import torch.nn.functional as F import torch.nn as nn class PatchMerging(nn.Module): """ Patch Merging Layer Args: dim (int): Number of input channels. norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm """ def __init__(self, dim, norm_layer=nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
acewjh/Video-Swin-Transformer
PatchMerging
false
12,035
[ "Apache-2.0" ]
0
bfbc8dde12e991455b34b921ca45a978b4dbfdbc
https://github.com/acewjh/Video-Swin-Transformer/tree/bfbc8dde12e991455b34b921ca45a978b4dbfdbc
IrisClassifier
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class IrisClassifier(nn.Module): def __init__(self): super(IrisClassifier, self).__init__() self.fc1 = nn.Linear(4, 10) self.fc2 = nn.Linear(10, 10) self.fc3 = nn.Linear(10, 3) def forward(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
abhinavthomas/mlflow
IrisClassifier
false
12,036
[ "Apache-2.0" ]
0
1942d788e98e565229615373b4fd6c0899b4026b
https://github.com/abhinavthomas/mlflow/tree/1942d788e98e565229615373b4fd6c0899b4026b
MaskedLoss
import torch class MaskedLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, y, Y, mask): diff = (y - Y) / 5.0 return torch.mean(torch.square(diff[mask])) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.ones( ...
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...
acycliq/cellpose
MaskedLoss
false
12,037
[ "BSD-3-Clause" ]
0
6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
https://github.com/acycliq/cellpose/tree/6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
DenseCrossEntropy
import torch from torch import nn class DenseCrossEntropy(nn.Module): def forward(self, x, target): x = x.float() target = target.float() logprobs = torch.nn.functional.log_softmax(x, dim=-1) loss = -logprobs * target loss = loss.sum(-1) return loss.mean() 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
aaron276h/kaggle-rcic-1st
DenseCrossEntropy
false
12,038
[ "MIT" ]
0
d35e97847df3c29f548e60bc936d3fec7a0a4c08
https://github.com/aaron276h/kaggle-rcic-1st/tree/d35e97847df3c29f548e60bc936d3fec7a0a4c08
L1Loss
import torch import torch.nn as nn import torch.nn.functional as F class L1Loss(nn.Module): """L1Loss loss .""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.l1_loss self.use_target_weight = use_target_weight self.loss_weig...
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 ...
ZephyrII/mmpose_charger
L1Loss
false
12,039
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
ArcFaceLoss
import math import torch from torch import nn class DenseCrossEntropy(nn.Module): def forward(self, x, target): x = x.float() target = target.float() logprobs = torch.nn.functional.log_softmax(x, dim=-1) loss = -logprobs * target loss = loss.sum(-1) return loss.mea...
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 math...
aaron276h/kaggle-rcic-1st
ArcFaceLoss
false
12,040
[ "MIT" ]
0
d35e97847df3c29f548e60bc936d3fec7a0a4c08
https://github.com/aaron276h/kaggle-rcic-1st/tree/d35e97847df3c29f548e60bc936d3fec7a0a4c08
SplAtConv2d
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Conv2d from torch.nn import ReLU from torch.nn.modules.utils import _pair class DropBlock2D(object): def __init__(self, *args, **kwargs): raise NotImplementedError class rSoftMax(nn.Modul...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
XuYongi/KiNet
SplAtConv2d
false
12,041
[ "MIT" ]
0
fab8865a09e3779baf0daf1db1bf59a9cfbde450
https://github.com/XuYongi/KiNet/tree/fab8865a09e3779baf0daf1db1bf59a9cfbde450
Simplenet
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.onnx import torch.testing class Simplenet(nn.Module): def __init__(self): super(Simplenet, self).__init__() 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.optim.lr_scheduler...
aam12/distiller
Simplenet
false
12,042
[ "Apache-2.0" ]
0
fd06fcba028d023e430cd37d1531bc2ac5202ea6
https://github.com/aam12/distiller/tree/fd06fcba028d023e430cd37d1531bc2ac5202ea6
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): """policy-value network module""" def __init__(self, board_width, board_height): super(Net, self).__init__() self.board_width = board_width self.board_height = board_height self.conv1 = 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....
ZiwenZhuang/AlphaZero_Gomoku
Net
false
12,043
[ "MIT" ]
0
72db1c3eda1f6133da24c924da6032ea3569076e
https://github.com/ZiwenZhuang/AlphaZero_Gomoku/tree/72db1c3eda1f6133da24c924da6032ea3569076e
ResBlock
import torch import torch.nn as nn from torch.nn import functional as F class ResBlock(nn.Module): """Residual block with bilinear upsampling/downsampling. Args: in_channels (int): Channel number of the input. out_channels (int): Channel number of the output. mode (str): Upsampling/do...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
abhishekm47/GFPGAN
ResBlock
false
12,044
[ "BSD-3-Clause" ]
0
39d063749433b38d98c75740b052934ae8bc80f6
https://github.com/abhishekm47/GFPGAN/tree/39d063749433b38d98c75740b052934ae8bc80f6
NormLoss
import torch class NormLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, y, Y, w, mask): ny = torch.linalg.norm(y, dim=1, keepdim=False) / 5.0 nY = torch.linalg.norm(Y, dim=1, keepdim=False) / 5.0 diff = ny - nY return torch.mean(torch.sq...
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...
acycliq/cellpose
NormLoss
false
12,045
[ "BSD-3-Clause" ]
0
6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
https://github.com/acycliq/cellpose/tree/6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
ArcCosDotLoss
import torch class ArcCosDotLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y, w, mask): eps = 1e-12 denom = torch.multiply(torch.linalg.norm(x, dim=1), torch.linalg. norm(y, dim=1)) + eps dot = x[:, 0, :, :] * y[:, 0, :, :] + 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 from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
acycliq/cellpose
ArcCosDotLoss
false
12,046
[ "BSD-3-Clause" ]
0
6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
https://github.com/acycliq/cellpose/tree/6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
WeightedLoss
import torch class WeightedLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, y, Y, w): diff = (y - Y) / 5.0 return torch.mean(torch.square(diff) * w) 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 from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
acycliq/cellpose
WeightedLoss
false
12,047
[ "BSD-3-Clause" ]
0
6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
https://github.com/acycliq/cellpose/tree/6d7a3f692206bf791e3ea7bd9524ee6df628ed8a
MyLoss
import torch import torch.nn as nn class MyLoss(nn.Module): def __init__(self): super(MyLoss, self).__init__() None self.reduce_var = True pass """ weights has shape (n), multiply loss of point i with weights[i] """ def forward(self, outputs, y, weights, calculate_add...
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...
abrar-fahim/ann-benchmarks
MyLoss
false
12,048
[ "MIT" ]
0
e5493ddda333bf6a930415566d4f1c697b439aca
https://github.com/abrar-fahim/ann-benchmarks/tree/e5493ddda333bf6a930415566d4f1c697b439aca
LocalizationNet
import torch import torch.nn.functional as F from torch import nn class LocalizationNet(nn.Module): def __init__(self, num_bbox=2, num_digits=2): super(LocalizationNet, self).__init__() self.conv1 = nn.Conv2d(1, 64, 3, padding=1) self.conv2 = nn.Conv2d(64, 64, 3, padding=1) self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
YIFEI-MA/MultiDigitRecognition
LocalizationNet
false
12,049
[ "MIT" ]
0
f1f9567c31102ccdc7464a35b8a7c533b5d46734
https://github.com/YIFEI-MA/MultiDigitRecognition/tree/f1f9567c31102ccdc7464a35b8a7c533b5d46734
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 from torch._inductor.runtime import triton_helpers import numpy as np import tor...
adriaciurana/adriaciurana-udacity-project-2
Critic
false
12,050
[ "MIT" ]
0
a0af7086df586b537cd10a880f1d354240ff31a5
https://github.com/adriaciurana/adriaciurana-udacity-project-2/tree/a0af7086df586b537cd10a880f1d354240ff31a5
GraphConvolution
import torch import torch.nn as nn import torch.nn.init as init class GraphConvolution(nn.Module): def __init__(self, input_dim, output_dim, use_bias=True): """ 图卷积: L*X*theta :param input_dim: int 节点输入特征的维度 :param out_put_dim: int 输出特征维度 :param use_bias: boolean | opt...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.init as init assert_size_stride = torch._C...
acproject/knowledge-graph-learning
GraphConvolution
false
12,051
[ "MIT" ]
0
fa62db6720f6da8e35de01b68acf82f1a367671f
https://github.com/acproject/knowledge-graph-learning/tree/fa62db6720f6da8e35de01b68acf82f1a367671f
eSEModule
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3.0, inplace=self.inplace) / 6.0 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
XDong18/AdelaiDet
eSEModule
false
12,052
[ "BSD-2-Clause" ]
0
837cd1078923892fe6e84ac29fd0963f1b2c474f
https://github.com/XDong18/AdelaiDet/tree/837cd1078923892fe6e84ac29fd0963f1b2c474f