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
SuperPointNet
import torch import torch.optim import torch.utils.data class SuperPointNet(torch.nn.Module): """ Pytorch definition of SuperPoint Network. """ def __init__(self): super(SuperPointNet, self).__init__() self.relu = torch.nn.ReLU(inplace=True) self.pool = torch.nn.MaxPool2d(kernel_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....
Dai-z/pytorch-superpoint
SuperPointNet
false
13,572
[ "MIT" ]
390
90e71045238fdcce13f9f0d02bdd0e1126145a10
https://github.com/Dai-z/pytorch-superpoint/tree/90e71045238fdcce13f9f0d02bdd0e1126145a10
Block
import torch import torch.nn as nn import torch._C import torch.serialization class DropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). Args: drop_prob (float): Drop rate for paths of model. Dropout rate has to be between 0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
CuttlefishXuan/mmsegmentation-1
Block
false
13,573
[ "Apache-2.0" ]
789
13771312da1a66d5cd642df6aa370affd3f5ceac
https://github.com/CuttlefishXuan/mmsegmentation-1/tree/13771312da1a66d5cd642df6aa370affd3f5ceac
MeanPoolConv
import torch import torch.nn as nn class MeanPoolConv(nn.Module): def __init__(self, input_dim, output_dim, kernel_size=3, biases=True): super().__init__() self.conv = nn.Conv2d(input_dim, output_dim, kernel_size, stride=1, padding=kernel_size // 2, bias=biases) def forward(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DeepTitan/PNDM
MeanPoolConv
false
13,574
[ "Apache-2.0" ]
61
4037a4f40011c9a0d47b92303e64d47fcc7ed56a
https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a
_Gate
import torch import torch.nn as nn class _Gate(nn.Module): """Utility class to implement a standard sigmoid gate""" def __init__(self, in_features: 'int', out_features: 'int'): super(_Gate, self).__init__() self.fc = nn.Linear(in_features=in_features, out_features=out_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DavidChoi76/neuralhydrology
_Gate
false
13,575
[ "BSD-3-Clause" ]
144
a4c284b92934ee973c8b3fedf8a60df60c8feae1
https://github.com/DavidChoi76/neuralhydrology/tree/a4c284b92934ee973c8b3fedf8a60df60c8feae1
FSPool
import torch import torch.nn as nn import torch.utils.data def deterministic_sort(s, tau): """ "Stochastic Optimization of Sorting Networks via Continuous Relaxations" https://openreview.net/forum?id=H1eSS3CcKX Aditya Grover, Eric Wang, Aaron Zweig, Stefano Ermon s: input elements to be sorted. Shap...
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...
Cyanogenoid/dspn
FSPool
false
13,576
[ "MIT" ]
102
be3703b470ead46d76b70b4fed656c2e5343aff6
https://github.com/Cyanogenoid/dspn/tree/be3703b470ead46d76b70b4fed656c2e5343aff6
ResidualBlock
import torch import torch.nn as nn from functools import partial def normalization(channels): """ Make a standard normalization layer. :param channels: number of input channels. :return: an nn.Module for normalization. """ return GroupNorm32(32, channels) def ncsn_conv3x3(in_planes, out_pla...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
DeepTitan/PNDM
ResidualBlock
false
13,577
[ "Apache-2.0" ]
61
4037a4f40011c9a0d47b92303e64d47fcc7ed56a
https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a
h_sigmoid
import torch import torch.nn as nn from itertools import product as product import torch.nn.parallel import torch.utils.data class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): ret...
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 from itertools import product as product import torch.nn.parallel i...
DefTruth/PIPNet
h_sigmoid
false
13,578
[ "MIT" ]
162
a1fb1e229319dac0069e37eb8fb4278d454edbb0
https://github.com/DefTruth/PIPNet/tree/a1fb1e229319dac0069e37eb8fb4278d454edbb0
UpsampleConv
import torch import torch.nn as nn class UpsampleConv(nn.Module): def __init__(self, input_dim, output_dim, kernel_size=3, biases=True): super().__init__() self.conv = nn.Conv2d(input_dim, output_dim, kernel_size, stride=1, padding=kernel_size // 2, bias=biases) self.pixelshuf...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
DeepTitan/PNDM
UpsampleConv
false
13,579
[ "Apache-2.0" ]
61
4037a4f40011c9a0d47b92303e64d47fcc7ed56a
https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a
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.fc1 = nn.Linear(3 * 28 * 28, 512) self.fc2 = nn.Linear(512, 512) self.fc3 = nn.Linear(512, 1) def forward(self, x): x = x.view...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
DavyMorgan/invariant-risk-minimization
Net
false
13,580
[ "MIT" ]
77
d0fe48e75329561e6b2d47dbc97042aa740f77c2
https://github.com/DavyMorgan/invariant-risk-minimization/tree/d0fe48e75329561e6b2d47dbc97042aa740f77c2
CAModule
import torch from torch import nn class CAModule(nn.Module): """ Re-implementation of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* code reference: https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
DavidChenL/Chexpert
CAModule
false
13,581
[ "Apache-2.0" ]
202
0300057d3a51301cff35a65f79729436678b4a79
https://github.com/DavidChenL/Chexpert/tree/0300057d3a51301cff35a65f79729436678b4a79
h_swish
import torch import torch.nn as nn from itertools import product as product import torch.nn.parallel import torch.utils.data class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): ret...
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 from itertools import product as product import torch.nn.parallel i...
DefTruth/PIPNet
h_swish
false
13,582
[ "MIT" ]
162
a1fb1e229319dac0069e37eb8fb4278d454edbb0
https://github.com/DefTruth/PIPNet/tree/a1fb1e229319dac0069e37eb8fb4278d454edbb0
ConvMeanPool
import torch import torch.nn as nn class ConvMeanPool(nn.Module): def __init__(self, input_dim, output_dim, kernel_size=3, biases=True, adjust_padding=False): super().__init__() if not adjust_padding: conv = nn.Conv2d(input_dim, output_dim, kernel_size, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DeepTitan/PNDM
ConvMeanPool
false
13,583
[ "Apache-2.0" ]
61
4037a4f40011c9a0d47b92303e64d47fcc7ed56a
https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a
InstanceNorm2dPlus
import torch import torch.nn as nn class InstanceNorm2dPlus(nn.Module): def __init__(self, num_features, bias=True): super().__init__() self.num_features = num_features self.bias = bias self.instance_norm = nn.InstanceNorm2d(num_features, affine=False, track_running_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_...
DeepTitan/PNDM
InstanceNorm2dPlus
false
13,584
[ "Apache-2.0" ]
61
4037a4f40011c9a0d47b92303e64d47fcc7ed56a
https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(features)) self.beta = nn.Parameter(torch.zeros(features)) self.eps = eps 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Dodger23/SincNet
LayerNorm
false
13,585
[ "MIT" ]
951
bf848e88dc8d6cbeb4484e89486ec0a4ab237cb1
https://github.com/Dodger23/SincNet/tree/bf848e88dc8d6cbeb4484e89486ec0a4ab237cb1
ParamSum
import torch import torch.utils.data import torch from torch import nn def resize(x1, x2, largest=True): if largest: if x1.size()[2:] > x2.size()[2:]: x2 = nn.Upsample(size=x1.size()[2:], mode='bilinear')(x2) elif x1.size()[2:] < x2.size()[2:]: x1 = nn.Upsample(size=x2.size...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda...
DominickZhang/NAS-FCOS
ParamSum
false
13,586
[ "BSD-2-Clause" ]
187
1f7281478430eaed028e2cc2dfa8be226c63939b
https://github.com/DominickZhang/NAS-FCOS/tree/1f7281478430eaed028e2cc2dfa8be226c63939b
Loss
import torch import torch.nn as nn class Loss(nn.Module): def __init__(self, lambd): super(Loss, self).__init__() self.lambd = lambd self.lsm = nn.LogSoftmax(dim=1) def forward(self, O, Y, C): return (Y * (self.lambd * C - self.lsm(O))).mean(dim=0).sum() def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
DmZhukov/CrossTask
Loss
false
13,587
[ "BSD-3-Clause" ]
58
2d79941d687dc8bd100898acd9c71c476b99def1
https://github.com/DmZhukov/CrossTask/tree/2d79941d687dc8bd100898acd9c71c476b99def1
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F class PointwiseConv(nn.Module): """ Pointwise Convolution (1x1 Conv) Convolution 1 Dimension (Faster version) (cf. https://github.com/huggingface/pytorch-openai-transformer-lm/blob/ eafc28abdfadfa0732f03a0fc65805c5bfb2ffe7/mode...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
DongjunLee/claf
PositionwiseFeedForward
false
13,588
[ "MIT" ]
225
ef548dda27c9aac8ce4db09774c8a1459d25bde1
https://github.com/DongjunLee/claf/tree/ef548dda27c9aac8ce4db09774c8a1459d25bde1
GraphConvolution
import torch from torch import nn from torch.nn import init class GraphConvolution(nn.Module): def __init__(self, window_size, in_features, out_features): super(GraphConvolution, self).__init__() self.weights = nn.Parameter(torch.Tensor(window_size, in_features, out_features)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn import init assert_size_stride = torch._C._dy...
DavidHeSkr/GCN-GAN-pytorch
GraphConvolution
false
13,589
[ "MIT" ]
66
f8adf82596733464cb63dddf978c244b25aebe46
https://github.com/DavidHeSkr/GCN-GAN-pytorch/tree/f8adf82596733464cb63dddf978c244b25aebe46
InvHuberLoss
import torch import torch.nn as nn import torch.nn.functional as F class InvHuberLoss(nn.Module): """Inverse Huber Loss for depth estimation. The setup is taken from https://arxiv.org/abs/1606.00373 Args: ignore_index (float): value to ignore in the target when computin...
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 ...
DrSleep/DenseTorch
InvHuberLoss
false
13,590
[ "MIT" ]
69
f90bef075429d763fc08338dea8222d28b0a4516
https://github.com/DrSleep/DenseTorch/tree/f90bef075429d763fc08338dea8222d28b0a4516
VPReLU
import torch import torch.nn as nn import torch.nn.functional as F class VPReLU(nn.Module): __constants__ = ['inplace'] inplace: 'bool' def __init__(self, inplace: 'bool'=False): super(VPReLU, self).__init__() self.inplace = inplace def forward(self, input: 'torch.Tensor') ->torch.Te...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DucNguyen183/nfnet_f5
VPReLU
false
13,591
[ "Apache-2.0" ]
133
567a1126ff6ea09b33ffa5dacfac9c983fd48713
https://github.com/DucNguyen183/nfnet_f5/tree/567a1126ff6ea09b33ffa5dacfac9c983fd48713
VPGELU
import torch import torch.nn as nn import torch.nn.functional as F class VPGELU(nn.Module): def forward(self, input: 'torch.Tensor') ->torch.Tensor: return F.gelu(input) * 1.7015043497085571 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.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
DucNguyen183/nfnet_f5
VPGELU
false
13,592
[ "Apache-2.0" ]
133
567a1126ff6ea09b33ffa5dacfac9c983fd48713
https://github.com/DucNguyen183/nfnet_f5/tree/567a1126ff6ea09b33ffa5dacfac9c983fd48713
ACLoss
import torch import torch.utils.data class ACLoss(torch.nn.Module): """Active Contour loss http://openaccess.thecvf.com/content_CVPR_2019/papers/Chen_Learning_Active_Contour_Models_for_Medical_Image_Segmentation_CVPR_2019_paper.pdf Supports 2D and 3D data, as long as all spatial dimensions have the same ...
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...
ELEKTRONN/elektronn3
ACLoss
false
13,593
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
Argmax
import torch from torch import nn import torch.utils.data class Argmax(nn.Module): def __init__(self, dim=1, unsqueeze=True): super().__init__() self.dim = dim self.unsqueeze = unsqueeze def forward(self, x): argmax = torch.argmax(x, self.dim) if self.unsqueeze: ...
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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
ELEKTRONN/elektronn3
Argmax
false
13,594
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
LayerNorm
import torch import torch.utils.data import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06, gamma=1.0, beta=0.0, learnable= False): super(LayerNorm, self).__init__() if learnable: self.gamma = nn.Parameter(torch.ones(features)) 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.utils.data import torch.nn as nn assert_size_stride = torch._C._dy...
E18301194/DepthAwareCNN
LayerNorm
false
13,595
[ "MIT" ]
278
8ae98f7f18b69f79e7df03397dec2543d3d0c8eb
https://github.com/E18301194/DepthAwareCNN/tree/8ae98f7f18b69f79e7df03397dec2543d3d0c8eb
GAPTripletMarginLoss
import torch from torch import nn import torch.utils.data import torch.nn.functional as F from torch.functional import F def global_average_pooling(inp: 'torch.Tensor') ->torch.Tensor: if inp.ndim == 5: return F.adaptive_avg_pool3d(inp, 1) elif inp.ndim == 4: return F.adaptive_avg_pool2d(inp, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import ...
ELEKTRONN/elektronn3
GAPTripletMarginLoss
false
13,596
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
TransformerEncoderLayer
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class Linear(nn.Linear): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(Linear, self).__init__(in_dim, out_dim, bias) nn.init.xavier_uniform_(self.weight, gain=nn.init.calculate...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Deepest-Project/AlignTTS
TransformerEncoderLayer
false
13,597
[ "MIT" ]
70
ed9c29d845f65ceb44c87f293b2919b9bbc6a6de
https://github.com/Deepest-Project/AlignTTS/tree/ed9c29d845f65ceb44c87f293b2919b9bbc6a6de
TransformerDecoderLayer
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class Linear(nn.Linear): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(Linear, self).__init__(in_dim, out_dim, bias) nn.init.xavier_uniform_(self.weight, gain=nn.init.calculate...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Deepest-Project/AlignTTS
TransformerDecoderLayer
false
13,598
[ "MIT" ]
70
ed9c29d845f65ceb44c87f293b2919b9bbc6a6de
https://github.com/Deepest-Project/AlignTTS/tree/ed9c29d845f65ceb44c87f293b2919b9bbc6a6de
DQN
import torch import torch.nn as nn import torch.nn.functional as F class DQN(nn.Module): """ Deep neural network with represents an agent. """ def __init__(self, input_size, num_actions): super(DQN, self).__init__() self.linear1 = nn.Linear(input_size, 50) self.head = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Dookas/Robust-Multitask-RL
DQN
false
13,599
[ "MIT" ]
106
7970e20cbdf91703c88edcb84568d7354e2525bc
https://github.com/Dookas/Robust-Multitask-RL/tree/7970e20cbdf91703c88edcb84568d7354e2525bc
SeqAttnMatch
import torch import torch.nn as nn import torch.nn.functional as F class SeqAttnMatch(nn.Module): """ Given sequences X and Y, match sequence Y to each element in X. * o_i = sum(alpha_j * y_j) for i in X * alpha_j = softmax(y_j * x_i) """ def __init__(self, embed_dim, identity=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DongjunLee/claf
SeqAttnMatch
false
13,600
[ "MIT" ]
225
ef548dda27c9aac8ce4db09774c8a1459d25bde1
https://github.com/DongjunLee/claf/tree/ef548dda27c9aac8ce4db09774c8a1459d25bde1
Classifier
import torch from torch import nn class Classifier(nn.Module): def __init__(self, num_inputs1, num_inputs2): super().__init__() self.network = nn.Bilinear(num_inputs1, num_inputs2, 1) def forward(self, x1, x2): return self.network(x1, x2) def get_inputs(): return [torch.rand([4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride reinterpret_tensor = torch._C._dynamo.guards._reinterpr...
DuaneNielsen/atari-representation-learning
Classifier
false
13,601
[ "MIT" ]
175
fe34f389768416deaa6a6ff0bdebba3d05762a55
https://github.com/DuaneNielsen/atari-representation-learning/tree/fe34f389768416deaa6a6ff0bdebba3d05762a55
Foo
import torch import torch.nn.functional import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed class Foo(torch.nn.Module): def __init__(self, size): super(Foo, self).__init__() self.n = torch.nn.Parameter(torch.ones(size)) self.m = torch.nn...
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.functional import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed assert_si...
DonnieKim411/apex
Foo
false
13,602
[ "BSD-3-Clause" ]
6,523
fb00a5a1d569c7b118aa672b3dacac3663ca3911
https://github.com/DonnieKim411/apex/tree/fb00a5a1d569c7b118aa672b3dacac3663ca3911
StableBCELoss
import torch import torch.utils.data class StableBCELoss(torch.nn.modules.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
ELEKTRONN/elektronn3
StableBCELoss
false
13,603
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
DistanceWeightedMSELoss
import torch from torch import nn import torch.utils.data class DistanceWeightedMSELoss(nn.Module): """Weighted MSE loss for signed euclidean distance transform targets. By setting ``fg_weight`` to a high value, the errors in foreground regions are more strongly penalized. If ``fg_weight=1``, this lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards...
ELEKTRONN/elektronn3
DistanceWeightedMSELoss
false
13,604
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
CoAttention
import torch import torch.nn as nn import torch.nn.functional as F class CoAttention(nn.Module): """ CoAttention encoder in Dynamic Coattention Networks For Question Answering (https://arxiv.org/abs/1611.01604) check the Figure 2 in paper * Args: embed_dim: the number of input embedd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DongjunLee/claf
CoAttention
false
13,605
[ "MIT" ]
225
ef548dda27c9aac8ce4db09774c8a1459d25bde1
https://github.com/DongjunLee/claf/tree/ef548dda27c9aac8ce4db09774c8a1459d25bde1
SoftmaxBCELoss
import torch import torch.utils.data class SoftmaxBCELoss(torch.nn.Module): def __init__(self, *args, **kwargs): super().__init__() self.bce = torch.nn.BCELoss(*args, **kwargs) def forward(self, output, target): probs = torch.nn.functional.softmax(output, dim=1) return self.b...
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...
ELEKTRONN/elektronn3
SoftmaxBCELoss
false
13,606
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
LovaszHingeLoss
import torch import torch.nn as nn import torch.nn.functional as F class LovaszHingeLoss(nn.Module): """ This class implements the lovasz hinge loss which is the continuous of the IoU for binary segmentation. Source: https://github.com/bermanmaxim/LovaszSoftmax """ def __init__(self) ->None: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ChristophReich1996/Cell-DETR
LovaszHingeLoss
false
13,607
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
Skip
import torch from torch import nn class Skip(nn.Module): def __init__(self, C_in, C_out, stride): super(Skip, self).__init__() assert C_out % C_in == 0, 'C_out must be divisible by C_in' self.repeats = 1, C_out // C_in, 1, 1 def forward(self, x): return x.repeat(self.repeats)...
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...
DrSleep/nas-segm-pytorch
Skip
false
13,608
[ "BSD-2-Clause" ]
155
5de0c5c60cc05f94305ff59ae9f822656e3e7a96
https://github.com/DrSleep/nas-segm-pytorch/tree/5de0c5c60cc05f94305ff59ae9f822656e3e7a96
CaffeNormalize
import torch import torch.utils.data import torch.nn as nn class CaffeNormalize(nn.Module): def __init__(self, features, eps=1e-07): super(CaffeNormalize, self).__init__() self.scale = nn.Parameter(10.0 * torch.ones(features)) self.eps = eps def forward(self, x): x_size = x.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.triton_helpers import libdevice import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dy...
E18301194/DepthAwareCNN
CaffeNormalize
false
13,609
[ "MIT" ]
278
8ae98f7f18b69f79e7df03397dec2543d3d0c8eb
https://github.com/E18301194/DepthAwareCNN/tree/8ae98f7f18b69f79e7df03397dec2543d3d0c8eb
PolicyNetwork
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNetwork(nn.Module): """ Deep neural network which represents policy network. """ def __init__(self, input_size, num_actions): super(PolicyNetwork, self).__init__() self.linear1 = nn.Linear(input_size, 50) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Dookas/Robust-Multitask-RL
PolicyNetwork
false
13,610
[ "MIT" ]
106
7970e20cbdf91703c88edcb84568d7354e2525bc
https://github.com/Dookas/Robust-Multitask-RL/tree/7970e20cbdf91703c88edcb84568d7354e2525bc
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): """ Layer Normalization (https://arxiv.org/abs/1607.06450) """ def __init__(self, normalized_shape, eps=1e-05): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(normalized_shape)) self.bet...
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_...
DongjunLee/claf
LayerNorm
false
13,611
[ "MIT" ]
225
ef548dda27c9aac8ce4db09774c8a1459d25bde1
https://github.com/DongjunLee/claf/tree/ef548dda27c9aac8ce4db09774c8a1459d25bde1
ResnetBlockConv1D
import torch import torch.nn as nn class ResnetBlockConv1D(nn.Module): def __init__(self, size_in, size_out=None, size_h=None): super().__init__() if size_out is None: size_out = size_in if size_h is None: size_h = min(size_in, size_out) self.size_in = 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 import torch.nn as nn assert_...
DveloperY0115/texture_fields
ResnetBlockConv1D
false
13,612
[ "MIT" ]
78
28c277696e0a658ffff3496892810d5a0ef03f65
https://github.com/DveloperY0115/texture_fields/tree/28c277696e0a658ffff3496892810d5a0ef03f65
Net
import torch import torch.nn as nn import torch.nn.functional as F def set_init(layers): for layer in layers: nn.init.normal(layer.weight, mean=0.0, std=0.1) nn.init.constant(layer.bias, 0.1) class Net(nn.Module): def __init__(self, s_dim, a_dim): super(Net, 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 import torch.nn as nn import ...
Dookas/Robust-Multitask-RL
Net
false
13,613
[ "MIT" ]
106
7970e20cbdf91703c88edcb84568d7354e2525bc
https://github.com/Dookas/Robust-Multitask-RL/tree/7970e20cbdf91703c88edcb84568d7354e2525bc
SimpleCNN
import torch import torch.nn as nn from collections import OrderedDict class SimpleCNN(nn.Module): def __init__(self, input_dim=3, global_pool=False): super(SimpleCNN, self).__init__() self.features = nn.Sequential(OrderedDict([('conv1', nn.Conv2d( input_dim, 64, kernel_size=3, stride...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
D-X-Y/MSPLD-2018
SimpleCNN
false
13,614
[ "MIT" ]
63
71a6a75830ac84c7a861e63367ad3ace991fae77
https://github.com/D-X-Y/MSPLD-2018/tree/71a6a75830ac84c7a861e63367ad3ace991fae77
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): def __init__(self, input_size, num_actions): super(Policy, self).__init__() self.affines = nn.Linear(input_size, 100) self.action_head = nn.Linear(100, num_actions) self.saved_actions = [] ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Dookas/Robust-Multitask-RL
Policy
false
13,615
[ "MIT" ]
106
7970e20cbdf91703c88edcb84568d7354e2525bc
https://github.com/Dookas/Robust-Multitask-RL/tree/7970e20cbdf91703c88edcb84568d7354e2525bc
OnnxErf
import torch from torch import nn class OnnxToTorchModule: """ Marker class for onnx2torch modules. """ pass class OnnxErf(nn.Module, OnnxToTorchModule): def forward(self, input_tensor: 'torch.Tensor') ->torch.Tensor: return torch.erf(input_tensor) def get_inputs(): return [torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ENOT-AutoDL/onnx2torch
OnnxErf
false
13,616
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
OnnxHardSigmoid
import torch from torch import nn class OnnxToTorchModule: """ Marker class for onnx2torch modules. """ pass class OnnxHardSigmoid(nn.Module, OnnxToTorchModule): def __init__(self, alpha: 'float'=0.2, beta: 'float'=0.5): super().__init__() self.alpha = alpha self.beta = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
ENOT-AutoDL/onnx2torch
OnnxHardSigmoid
false
13,617
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
ResnetBlockFC
import torch import torch.nn as nn class ResnetBlockFC(nn.Module): def __init__(self, size_in, size_out=None, size_h=None): super().__init__() if size_out is None: size_out = size_in if size_h is None: size_h = min(size_in, size_out) self.size_in = size_in ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
DveloperY0115/texture_fields
ResnetBlockFC
false
13,618
[ "MIT" ]
78
28c277696e0a658ffff3496892810d5a0ef03f65
https://github.com/DveloperY0115/texture_fields/tree/28c277696e0a658ffff3496892810d5a0ef03f65
LinearPool
import torch from torch import nn class LinearPool(nn.Module): def __init__(self): super(LinearPool, self).__init__() def forward(self, feat_map): """ Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) return(Tensor): tensor with shape (N, C, 1, 1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
DavidChenL/Chexpert
LinearPool
false
13,619
[ "Apache-2.0" ]
202
0300057d3a51301cff35a65f79729436678b4a79
https://github.com/DavidChenL/Chexpert/tree/0300057d3a51301cff35a65f79729436678b4a79
hsigmoid
import torch import torch.nn as nn import torch.nn.functional as F class hsigmoid(nn.Module): def forward(self, x): out = F.relu6(x + 3, inplace=True) / 6 return out 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.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Ecalose/dddd_trainer
hsigmoid
false
13,620
[ "Apache-2.0" ]
80
ef0c6b271cc2898403375f53f813481ffbf6b02c
https://github.com/Ecalose/dddd_trainer/tree/ef0c6b271cc2898403375f53f813481ffbf6b02c
ResnetBlockConv2d
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def pixel_norm(x): sigma = x.norm(dim=1, keepdim=True) out = x / (sigma + 1e-05) return out class EqualizedLR(nn.Module): def __init__(self, module): super().__init__() self.module = 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 numpy as np import tor...
DveloperY0115/texture_fields
ResnetBlockConv2d
false
13,621
[ "MIT" ]
78
28c277696e0a658ffff3496892810d5a0ef03f65
https://github.com/DveloperY0115/texture_fields/tree/28c277696e0a658ffff3496892810d5a0ef03f65
OnnxGatherElements
import torch from torch import nn class OnnxToTorchModule: """ Marker class for onnx2torch modules. """ pass class OnnxGatherElements(nn.Module, OnnxToTorchModule): def __init__(self, axis: 'int'=0): super().__init__() self.axis = axis def forward(self, input_tensor: 'torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
ENOT-AutoDL/onnx2torch
OnnxGatherElements
false
13,622
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
hswish
import torch import torch.nn as nn import torch.nn.functional as F class hswish(nn.Module): def forward(self, x): out = x * F.relu6(x + 3, inplace=True) / 6 return out 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.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Ecalose/dddd_trainer
hswish
false
13,623
[ "Apache-2.0" ]
80
ef0c6b271cc2898403375f53f813481ffbf6b02c
https://github.com/Ecalose/dddd_trainer/tree/ef0c6b271cc2898403375f53f813481ffbf6b02c
ConvBlock
import copy import torch from torch import nn import torch.utils.data def get_activation(activation): if isinstance(activation, str): if activation == 'relu': return nn.ReLU() elif activation == 'leaky': return nn.LeakyReLU(negative_slope=0.1) elif activation == 'pr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 copy from torch import...
ELEKTRONN/elektronn3
ConvBlock
false
13,624
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
UpsampleConvLayer
import torch class UpsampleConvLayer(torch.nn.Module): """UpsampleConvLayer Upsamples the input and then does a convolution. This method gives better results compared to ConvTranspose2d. ref: http://distill.pub/2016/deconv-checkerboard/ """ def __init__(self, in_channels, out_channels, 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.triton_helpers import math as tl_math assert_size_s...
EdenBD/MultiModalStory-demo
UpsampleConvLayer
false
13,625
[ "Apache-2.0" ]
154
5e95e2aca766ca7c850e8db4973b8d51dfdba7f8
https://github.com/EdenBD/MultiModalStory-demo/tree/5e95e2aca766ca7c850e8db4973b8d51dfdba7f8
OnnxPow
import torch from torch import nn from typing import Optional def old_style_broadcast(first: 'torch.Tensor', second: 'torch.Tensor', axis: 'int') ->torch.Tensor: rank = len(first.shape) axis = axis + rank if axis < 0 else axis second_shape = [1] * axis + list(second.shape) second_shape = second_sh...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn from typing import Optional assert_size_stride = torch._C....
ENOT-AutoDL/onnx2torch
OnnxPow
false
13,626
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
DownConv
import copy import torch from torch import nn import torch.utils.data def get_activation(activation): if isinstance(activation, str): if activation == 'relu': return nn.ReLU() elif activation == 'leaky': return nn.LeakyReLU(negative_slope=0.1) elif activation == 'pr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 copy from torch import...
ELEKTRONN/elektronn3
DownConv
false
13,627
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
ResnetBlockPointwise
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class EqualizedLR(nn.Module): def __init__(self, module): super().__init__() self.module = module self._make_params() def _make_params(self): weight = self.module.weight height = wei...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
DveloperY0115/texture_fields
ResnetBlockPointwise
false
13,628
[ "MIT" ]
78
28c277696e0a658ffff3496892810d5a0ef03f65
https://github.com/DveloperY0115/texture_fields/tree/28c277696e0a658ffff3496892810d5a0ef03f65
ResizeConv
import torch from torch import nn import torch.utils.data def get_conv(dim=3): """Chooses an implementation for a convolution layer.""" if dim == 3: return nn.Conv3d elif dim == 2: return nn.Conv2d else: raise ValueError('dim has to be 2 or 3') def planar_kernel(x): """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 import nn import torch.utils.data assert_size_stride = torch._C._dyna...
ELEKTRONN/elektronn3
ResizeConv
false
13,629
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
GaussionConvF
import torch import torch.nn as nn import torch.nn.functional as F class GaussionConvF(nn.Module): """The first layer in `RobustGCN` that conver node features to distribution (mean, var)""" def __init__(self, in_features, out_features, bias=False, gamma=1.0): super().__init__() self.in_featur...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EdisonLeeeee/GraphGallery
GaussionConvF
false
13,630
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
OnnxSqrt
import torch from torch import nn class OnnxToTorchModule: """ Marker class for onnx2torch modules. """ pass class OnnxSqrt(nn.Module, OnnxToTorchModule): def forward(self, input_tensor: 'torch.Tensor') ->torch.Tensor: return torch.sqrt(input_tensor) def get_inputs(): return [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...
ENOT-AutoDL/onnx2torch
OnnxSqrt
false
13,631
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
OnnxGeneralLinear
import torch from torch import nn import torch.nn.functional as F class OnnxToTorchModule: """ Marker class for onnx2torch modules. """ pass class OnnxGeneralLinear(nn.Linear, OnnxToTorchModule): """General Linear layer with functionality of ONNX GEMM node. For additional info https://githu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
ENOT-AutoDL/onnx2torch
OnnxGeneralLinear
false
13,632
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
OnnxSoftmaxV1V11
import torch from torch import nn class OnnxToTorchModule: """ Marker class for onnx2torch modules. """ pass class OnnxSoftmaxV1V11(nn.Module, OnnxToTorchModule): def __init__(self, axis: 'int'=1, is_log: 'bool'=False): super().__init__() self.axis = axis self.is_log = i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
ENOT-AutoDL/onnx2torch
OnnxSoftmaxV1V11
false
13,633
[ "Apache-2.0" ]
144
2391987b3349bed1670ac3c1bc9062a37323abe3
https://github.com/ENOT-AutoDL/onnx2torch/tree/2391987b3349bed1670ac3c1bc9062a37323abe3
SAGEAggregator
import torch import torch.nn as nn class SAGEAggregator(nn.Module): def __init__(self, in_features, out_features, agg_method='mean', concat =False, bias=False): super().__init__() self.in_features = in_features self.out_features = out_features self.concat = concat ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EdisonLeeeee/GraphGallery
SAGEAggregator
false
13,634
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
HingeLoss
import torch import torch.nn as nn import torch.utils.data class HingeLoss(nn.Module): def __init__(self): super(HingeLoss, self).__init__() self.margin = 1.0 def hinge_loss(self, input, target): output = self.margin - input.mul(target) output[output.le(0)] = 0 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.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
Enderdead/BinaryConnect_PyTorch
HingeLoss
false
13,635
[ "MIT" ]
75
990e970b1fbd299ff88200db21a9cc3fe44706d3
https://github.com/Enderdead/BinaryConnect_PyTorch/tree/990e970b1fbd299ff88200db21a9cc3fe44706d3
GaussionConvD
import torch import torch.nn as nn import torch.nn.functional as F class GaussionConvD(nn.Module): """The subsequent layer in `RobustGCN` that takes node distribution (mean, var) as input""" def __init__(self, in_features, out_features, bias=False, gamma=1.0): super().__init__() self.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....
EdisonLeeeee/GraphGallery
GaussionConvD
false
13,636
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
APPNProp
import torch import torch.nn as nn import torch.nn.functional as F class SparseDropout(nn.Module): def __init__(self, p=0.5): super().__init__() self.p = p def forward(self, x): x_coal = x.coalesce() drop_val = F.dropout(x_coal._values(), self.p, self.training) return...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/GraphGallery
APPNProp
false
13,637
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
CumulativeLinkLoss
import torch import numpy as np from torch import nn from typing import Optional def _reduction(loss: 'torch.Tensor', reduction: 'str') ->torch.Tensor: """ Reduce loss Parameters ---------- loss : torch.Tensor, [batch_size, num_classes] Batch losses. reduction : str Method for...
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 fro...
EthanRosenthal/spacecutter
CumulativeLinkLoss
false
13,638
[ "MIT" ]
74
37a6f7367905b50e7886dc1ef2bfe1d63220347a
https://github.com/EthanRosenthal/spacecutter/tree/37a6f7367905b50e7886dc1ef2bfe1d63220347a
SinkhornKnopp
import torch class SinkhornKnopp(torch.nn.Module): def __init__(self, num_iters=3, epsilon=0.05): super().__init__() self.num_iters = num_iters self.epsilon = epsilon @torch.no_grad() def forward(self, logits): Q = torch.exp(logits / self.epsilon).t() B = Q.shape[...
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...
DonkeyShot21/UNO
SinkhornKnopp
false
13,639
[ "MIT" ]
87
7613d3f8c58e5f16ee0d68fdd803ef442d819af4
https://github.com/DonkeyShot21/UNO/tree/7613d3f8c58e5f16ee0d68fdd803ef442d819af4
DAGNNConv
import torch import torch.nn as nn class DAGNNConv(nn.Module): def __init__(self, in_features, out_features=1, K=10, bias=False): super().__init__() assert out_features == 1, "'out_features' must be 1" self.in_features = in_features self.out_features = out_features self.li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EdisonLeeeee/GraphGallery
DAGNNConv
false
13,640
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
TransitionUp
import torch from torch import nn import torch.utils.data def center_crop(layer, max_height, max_width): _, _, h, w = layer.size() xy1 = (w - max_width) // 2 xy2 = (h - max_height) // 2 return layer[:, :, xy2:xy2 + max_height, xy1:xy1 + max_width] class TransitionUp(nn.Module): def __init__(sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data assert_size_stride = torch._C._dyna...
ELEKTRONN/elektronn3
TransitionUp
false
13,641
[ "MIT" ]
124
19c751855dffc67b744cd43e757aa4a5bd577d9b
https://github.com/ELEKTRONN/elektronn3/tree/19c751855dffc67b744cd43e757aa4a5bd577d9b
SSGConv
from torch.nn import Module import torch class SSGConv(Module): def __init__(self, K=16, alpha=0.1, **kwargs): super().__init__() assert K > 0 self.K = K self.alpha = alpha def forward(self, x, adj): x_in = x x_out = torch.zeros_like(x) for _ in range(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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_...
EdisonLeeeee/GraphGallery
SSGConv
false
13,642
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
WaveletConv
import torch import torch.nn as nn class WaveletConv(nn.Module): def __init__(self, in_features, out_features, num_nodes, bias=False): super().__init__() self.in_features = in_features self.out_features = out_features self.w = nn.Linear(in_features, out_features, bias=bias) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EdisonLeeeee/GraphGallery
WaveletConv
false
13,643
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
ResidualBlock
import torch class ConvLayer(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = kernel_size // 2 self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding) self.conv2d = torch.nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EdenBD/MultiModalStory-demo
ResidualBlock
false
13,644
[ "Apache-2.0" ]
154
5e95e2aca766ca7c850e8db4973b8d51dfdba7f8
https://github.com/EdenBD/MultiModalStory-demo/tree/5e95e2aca766ca7c850e8db4973b8d51dfdba7f8
FocalFrequencyLoss
import torch import torch.nn as nn import torch.utils.data class FocalFrequencyLoss(nn.Module): """The torch.nn.Module class that implements focal frequency loss - a frequency domain loss function for optimizing generative models. Ref: Focal Frequency Loss for Image Reconstruction and Synthesis. In 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
EndlessSora/focal-frequency-loss
FocalFrequencyLoss
false
13,645
[ "MIT" ]
364
dcaa01ecbfbbd9d8f83f7e5993474e1aa087227c
https://github.com/EndlessSora/focal-frequency-loss/tree/dcaa01ecbfbbd9d8f83f7e5993474e1aa087227c
TAGConv
import torch import torch.nn as nn class TAGConv(nn.Module): def __init__(self, in_features, out_features, K=3, bias=True): super().__init__() self.in_features = in_features self.out_features = out_features self.K = K self.w = nn.Linear(in_features * (self.K + 1), out_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
EdisonLeeeee/GraphGallery
TAGConv
false
13,646
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
GlobalAvgPool2d
import torch import torch.nn as nn class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): return nn.functional.adaptive_avg_pool2d(inputs, 1).view(inputs...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Exdenta/torchsat
GlobalAvgPool2d
false
13,647
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
DiceBCELoss
import torch import torch.nn as nn import torch.nn.functional as F class DiceBCELoss(nn.Module): """ This loss combines Dice loss with the standard binary cross-entropy (BCE) loss that is generally the default for segmentation models. Combining the two methods allows for some diversity in the loss, while...
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...
Exdenta/torchsat
DiceBCELoss
false
13,648
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
CharbonnierLoss
import torch import torch.utils.data import torch.nn as nn class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=1e-06): super(CharbonnierLoss, self).__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torch.sum(torch.sqrt...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data impo...
EvgeneyZ/TMNet
CharbonnierLoss
false
13,649
[ "Apache-2.0" ]
90
8a42754747c2fa575e9108c13b5018a884f46099
https://github.com/EvgeneyZ/TMNet/tree/8a42754747c2fa575e9108c13b5018a884f46099
SpectralEigenConv
import torch import torch.nn as nn class SpectralEigenConv(nn.Module): def __init__(self, in_features, out_features, bias=False, K=10, alpha= 0.1, **kwargs): super().__init__() assert K > 0 self.K = K self.alpha = alpha self.in_features = in_features self.o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EdisonLeeeee/GraphGallery
SpectralEigenConv
false
13,650
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
MaskedMultiTaskCrossEntropy
import torch from torch import nn class MaskedMultiTaskCrossEntropy(nn.Module): def forward(self, input, target): scores = torch.sigmoid(input) target_active = (target == 1).float() loss_terms = -(target_active * torch.log(scores) + (1 - target_active) * torch.log(1 - scores))...
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...
EricBoittier/graph-neural-networks-for-drug-discovery
MaskedMultiTaskCrossEntropy
false
13,651
[ "MIT" ]
69
12fed5c6e7bbd716d9f713d34067ed83dd539b50
https://github.com/EricBoittier/graph-neural-networks-for-drug-discovery/tree/12fed5c6e7bbd716d9f713d34067ed83dd539b50
IoULoss
import torch import torch.nn as nn import torch.nn.functional as F class IoULoss(nn.Module): """ The IoU metric, or Jaccard Index, is similar to the Dice metric and is calculated as the ratio between the overlap of the positive instances between two sets, and their mutual combined values """ 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 from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Exdenta/torchsat
IoULoss
false
13,652
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): """ Focal Loss was introduced by Lin et al of Facebook AI Research in 2017 as a means of combatting extremely imbalanced datasets where positive cases were relatively rare. Their paper "Focal Loss for Dense Obj...
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...
Exdenta/torchsat
FocalLoss
false
13,653
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
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 ...
Exdenta/torchsat
rSoftMax
false
13,654
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
DiceLoss
import torch import torch.nn as nn import torch.nn.functional as F class DiceLoss(nn.Module): """ The Dice coefficient, or Dice-Sørensen coefficient, is a common metric for pixel segmentation """ def __init__(self, weight=None, size_average=True): super(DiceLoss, self).__init__() def for...
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...
Exdenta/torchsat
DiceLoss
false
13,655
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
FocalTverskyLoss
import torch import torch.nn as nn import torch.nn.functional as F class FocalTverskyLoss(nn.Module): """ A variant on the Tversky loss that also includes the gamma modifier from Focal Loss. """ def __init__(self, weight=None, size_average=True): super(FocalTverskyLoss, self).__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...
Exdenta/torchsat
FocalTverskyLoss
false
13,656
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
ConvInRelu
import torch import numpy as np import torch.nn as nn class ConvInRelu(nn.Module): def __init__(self, channels_in, channels_out, kernel_size, stride=1): super(ConvInRelu, self).__init__() self.n_params = 0 self.channels = channels_out self.reflection_pad = nn.ReflectionPad2d(int(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....
ElistratovSemyon/style-augmentation
ConvInRelu
false
13,657
[ "MIT" ]
69
ac88dcc92d43615e9a63d90ba58cdd8178c5b02c
https://github.com/ElistratovSemyon/style-augmentation/tree/ac88dcc92d43615e9a63d90ba58cdd8178c5b02c
LabelPropagation
import torch import torch.nn as nn import torch.nn.functional as F class LabelPropagation(nn.Module): """label propagation model adapted from https://github.com/CUAI/CorrectAndSmooth `"Learning from Labeled and Unlabeled Datawith Label Propagation" <http://mlg.eng.cam.ac.uk/zoubin/papers/CMU-CALD-02-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_...
EdisonLeeeee/GraphGallery
LabelPropagation
false
13,658
[ "MIT" ]
300
4eec9c5136bda14809bd22584b26cc346cdb633b
https://github.com/EdisonLeeeee/GraphGallery/tree/4eec9c5136bda14809bd22584b26cc346cdb633b
MaxPool2dDynamicSamePadding
import math import torch import torch.nn as nn import torch.nn.functional as F class MaxPool2dDynamicSamePadding(nn.MaxPool2d): """2D MaxPooling like TensorFlow's 'SAME' mode, with a dynamic image size. The padding is operated in forward function by calculating dynamically. """ def __init__(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Exdenta/torchsat
MaxPool2dDynamicSamePadding
false
13,659
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
Conv2dDynamicSamePadding
import math import torch import torch.nn as nn import torch.nn.functional as F class Conv2dDynamicSamePadding(nn.Conv2d): """2D Convolutions like TensorFlow, for a dynamic image size. The padding is operated in forward function by calculating dynamically. """ def __init__(self, in_channels, out_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Exdenta/torchsat
Conv2dDynamicSamePadding
false
13,660
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
outconv
import torch import torch.nn as nn class outconv(nn.Module): def __init__(self, in_ch, out_ch): super(outconv, self).__init__() self.conv = nn.Conv2d(in_ch, out_ch, 1, padding_mode='reflect') def forward(self, x): x = self.conv(x) return x def get_inputs(): return [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.triton_helpers import math as tl_math import torch....
ExplorativeEngineering/LFMNet2
outconv
false
13,661
[ "Apache-2.0" ]
46
3f190be0f047b9e05c69b0a11f99218fd4fc510c
https://github.com/ExplorativeEngineering/LFMNet2/tree/3f190be0f047b9e05c69b0a11f99218fd4fc510c
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....
Exdenta/torchsat
SplAtConv2d
false
13,662
[ "MIT" ]
316
70ea3db758757104fb3ba618ddf7997f0f3a75b4
https://github.com/Exdenta/torchsat/tree/70ea3db758757104fb3ba618ddf7997f0f3a75b4
VitMlpHead
import torch def get_args(): parser = argparse.ArgumentParser() group = parser.add_argument_group(title='input data') group.add_argument('--input', type=str, required=True, help= 'Path to input JSON') group.add_argument('--json-keys', nargs='+', default=['text'], help= 'space separate ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ExaSearch/Megatron-DeepSpeed
VitMlpHead
false
13,663
[ "MIT" ]
71
215dcf9fd4d18d9efa1d15d06c3eb85572957bf3
https://github.com/ExaSearch/Megatron-DeepSpeed/tree/215dcf9fd4d18d9efa1d15d06c3eb85572957bf3
CapOnlyContrastiveLoss
import torch import torch.nn as nn import torch.nn.init def cosine_sim(im, s): """Cosine similarity between all the image and sentence pairs """ return im.mm(s.t()) def order_sim(im, s): """Order embeddings similarity measure $max(0, s-im)$ """ YmX = s.unsqueeze(1).expand(s.size(0), im.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 import torch.nn as nn import ...
ExplorerFreda/VSE-C
CapOnlyContrastiveLoss
false
13,664
[ "MIT" ]
61
52d7742adfe017eacd74f36a5953ea2ace9f5fce
https://github.com/ExplorerFreda/VSE-C/tree/52d7742adfe017eacd74f36a5953ea2ace9f5fce
NormedLinear
import torch import torch.nn.functional as F import torch.nn as nn class NormedLinear(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
FMsunyh/mmdetection
NormedLinear
false
13,665
[ "Apache-2.0" ]
240
d3683eb06d1041aa3d55f35ad81d8c37718a4c2d
https://github.com/FMsunyh/mmdetection/tree/d3683eb06d1041aa3d55f35ad81d8c37718a4c2d
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.affine1 = nn.Linear(4, 128) self.affine2 = nn.Linear(128, 2) self.saved_log_probs = [] self.rewards = [] def forward(sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Eunjnnn/ignite
Policy
false
13,666
[ "BSD-3-Clause" ]
4,119
743089705b2b252aa5e2a0f310da3a8724d6711e
https://github.com/Eunjnnn/ignite/tree/743089705b2b252aa5e2a0f310da3a8724d6711e
Return
import torch import numpy as np class Return(torch.nn.Module): def __init__(self, discount_factor): super().__init__() assert 0 <= discount_factor < 1 self.coefficient = 1 / (1 - discount_factor) self.min_reward = np.float32(-1) self.max_reward = np.float32(1) self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strid...
Eyalcohenx/tonic
Return
false
13,667
[ "MIT" ]
350
afc15c6fa23fed4f696f68f0acf961964b0172dc
https://github.com/Eyalcohenx/tonic/tree/afc15c6fa23fed4f696f68f0acf961964b0172dc
SegmentationLoss
import torch import torch.nn as nn import torch.nn.functional as F class LovaszHingeLoss(nn.Module): """ This class implements the lovasz hinge loss which is the continuous of the IoU for binary segmentation. Source: https://github.com/bermanmaxim/LovaszSoftmax """ def __init__(self) ->None: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ChristophReich1996/Cell-DETR
SegmentationLoss
false
13,668
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
SobLoss
import torch class SobLoss(torch.nn.Module): """ Sobolev norm penalty on function (sum |x_{i} - x{i+1}|^p)^{1/p} parameters: p - dimension of norm """ def __init__(self, p): super(SobLoss, self).__init__() self.p = p def forward(self, beta): hdiff = beta[...
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...
Filco306/TopologyLayer
SobLoss
false
13,669
[ "MIT" ]
250
1d6261017a80cff0ee06bb896ded40777b0989b4
https://github.com/Filco306/TopologyLayer/tree/1d6261017a80cff0ee06bb896ded40777b0989b4
ShiftedConv
import math import torch import torch.nn as nn from numpy import prod def getLayerNormalizationFactor(x): """ Get He's constant for the given layer https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf """ size = x.weight.size() fan_in = pro...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from numpy import prod assert_size_stride = to...
EyalSel/CPC_audio
ShiftedConv
false
13,670
[ "MIT" ]
260
b98a1bdf1fe9ea219816db7a6c28115d404a3510
https://github.com/EyalSel/CPC_audio/tree/b98a1bdf1fe9ea219816db7a6c28115d404a3510
LogisticCumulativeLink
import torch from torch import nn class LogisticCumulativeLink(nn.Module): """ Converts a single number to the proportional odds of belonging to a class. Parameters ---------- num_classes : int Number of ordered classes to partition the odds into. init_cutpoints : str (default='ordere...
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...
EthanRosenthal/medallion
LogisticCumulativeLink
false
13,671
[ "MIT" ]
74
063fe875f5122063e6f616512cffd9ffa4df1974
https://github.com/EthanRosenthal/medallion/tree/063fe875f5122063e6f616512cffd9ffa4df1974