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
Dice_Loss
import torch from torch import nn from torch import sigmoid class Dice_Loss(nn.Module): """ Taken from https://www.kaggle.com/bigironsphere/loss-function-library-keras-pytorch """ def __init__(self, weight=None, size_average=True): super(Dice_Loss, self).__init__() def forward(self, out,...
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...
JoaoCarv/holistic_seg
Dice_Loss
false
656
[ "MIT" ]
0
ea4787e7e9a36dc5caf198d2be1bd1e71c06d440
https://github.com/JoaoCarv/holistic_seg/tree/ea4787e7e9a36dc5caf198d2be1bd1e71c06d440
StyledConv
import math import torch from torch import nn from torch.nn import functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): rest_dim = [1] * (input.ndim - bias.ndim - 1) input = input if input.ndim == 3: return F.leaky_relu(input + bias.view(1, *rest_dim, bias.shape[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.triton_helpers import libdevice import math from to...
Jerry2001/StyleCLIP
StyledConv
false
657
[ "MIT" ]
0
806216b4ce7b4c001ff05d7bd707b28d20ea6191
https://github.com/Jerry2001/StyleCLIP/tree/806216b4ce7b4c001ff05d7bd707b28d20ea6191
DiceLossWithLogits
import torch import torch.nn as nn import torch.utils.data def flatten_samples(input_): """ Flattens a tensor or a variable such that the channel axis is first and the sample axis is second. The shapes are transformed as follows: (N, C, H, W) --> (C, N * H * W) (N, C, D, H, W) --> (C, N * ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
JoOkuma/torch-em
DiceLossWithLogits
false
658
[ "MIT" ]
0
68b723683f9013723a0e4fc8cfef1d6a2a9c9dff
https://github.com/JoOkuma/torch-em/tree/68b723683f9013723a0e4fc8cfef1d6a2a9c9dff
LinearBottleneckLayer
import torch import torch.nn as nn class LinearBottleneckLayer(nn.Module): """ Bottleneck Layer """ def __init__(self, d_features, d_hid, d_out=None, dropout=0.1): super().__init__() if d_out is None: d_out = d_features self.encode = nn.Linear(d_features, d_hid) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Jincheng-Sun/Kylearn-pytorch
LinearBottleneckLayer
false
660
[ "MIT" ]
0
e72f2ab45a3f4724e843a27bec37664d3612fdca
https://github.com/Jincheng-Sun/Kylearn-pytorch/tree/e72f2ab45a3f4724e843a27bec37664d3612fdca
PositionwiseFeedForward
import torch import torch.nn as nn class PositionwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.1): super().__init__() self.w_1 = nn.Linear(d_in, d_hid) self.w_2 = nn.Linear(d_hid, d_in) self.layer_norm = nn.LayerN...
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....
Jincheng-Sun/Kylearn-pytorch
PositionwiseFeedForward
false
661
[ "MIT" ]
0
e72f2ab45a3f4724e843a27bec37664d3612fdca
https://github.com/Jincheng-Sun/Kylearn-pytorch/tree/e72f2ab45a3f4724e843a27bec37664d3612fdca
ToRGB
import math import torch from torch import nn from torch.nn import functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): rest_dim = [1] * (input.ndim - bias.ndim - 1) input = input if input.ndim == 3: return F.leaky_relu(input + bias.view(1, *rest_dim, bias.shape[0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn from torch.nn import functional as F assert_siz...
Jerry2001/StyleCLIP
ToRGB
false
662
[ "MIT" ]
0
806216b4ce7b4c001ff05d7bd707b28d20ea6191
https://github.com/Jerry2001/StyleCLIP/tree/806216b4ce7b4c001ff05d7bd707b28d20ea6191
LinearClassifier
import torch import torch.nn as nn class LinearClassifier(nn.Module): def __init__(self, d_features, seq_length, d_hid, d_out): super(LinearClassifier, self).__init__() self.d_features = d_features self.maxpool = torch.nn.MaxPool1d(seq_length, stride=1, padding=0) self.fc1 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Jincheng-Sun/Kylearn-pytorch
LinearClassifier
false
663
[ "MIT" ]
0
e72f2ab45a3f4724e843a27bec37664d3612fdca
https://github.com/Jincheng-Sun/Kylearn-pytorch/tree/e72f2ab45a3f4724e843a27bec37664d3612fdca
DiceLoss
import torch import torch.nn as nn import torch.utils.data def flatten_samples(input_): """ Flattens a tensor or a variable such that the channel axis is first and the sample axis is second. The shapes are transformed as follows: (N, C, H, W) --> (C, N * H * W) (N, C, D, H, W) --> (C, N * ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
JoOkuma/torch-em
DiceLoss
false
664
[ "MIT" ]
0
68b723683f9013723a0e4fc8cfef1d6a2a9c9dff
https://github.com/JoOkuma/torch-em/tree/68b723683f9013723a0e4fc8cfef1d6a2a9c9dff
FocalLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class FocalLoss(nn.Module): def __init__(self, gamma=2): super(FocalLoss, self).__init__() self.gamma = gamma 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
JoohyungLee0106/rectal_MR_volume_classification
FocalLoss
false
665
[ "MIT" ]
0
d2a7d13dae9fe7255b983cbc210567dd452a936f
https://github.com/JoohyungLee0106/rectal_MR_volume_classification/tree/d2a7d13dae9fe7255b983cbc210567dd452a936f
ChannelSpatialSELayer3D
import torch import torch.nn as nn import torch.nn.functional as F class ChannelSELayer3D(nn.Module): """ 3D extension of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* *Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238* """ ...
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 ...
Jianrong-Lu/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival
ChannelSpatialSELayer3D
false
666
[ "MIT" ]
0
257cf17ce6d405166dd8449f3b34e305cb5103b2
https://github.com/Jianrong-Lu/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival/tree/257cf17ce6d405166dd8449f3b34e305cb5103b2
BCEDiceLossWithLogits
import torch import torch.nn as nn import torch.utils.data def flatten_samples(input_): """ Flattens a tensor or a variable such that the channel axis is first and the sample axis is second. The shapes are transformed as follows: (N, C, H, W) --> (C, N * H * W) (N, C, D, H, W) --> (C, N * ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
JoOkuma/torch-em
BCEDiceLossWithLogits
false
667
[ "MIT" ]
0
68b723683f9013723a0e4fc8cfef1d6a2a9c9dff
https://github.com/JoOkuma/torch-em/tree/68b723683f9013723a0e4fc8cfef1d6a2a9c9dff
AgentConvBlock
import torch import torch.nn as nn class AgentConvBlock(nn.Module): def __init__(self, nin, nout, ksize=3): super(AgentConvBlock, self).__init__() self.conv1 = nn.Conv2d(nin, nout, ksize, padding=1) self.lrelu1 = nn.LeakyReLU(0.2) self.conv2 = nn.Conv2d(nout, nout, ksize, padding=...
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...
JoOkuma/DifferentiableSketching
AgentConvBlock
false
668
[ "BSD-3-Clause" ]
0
6672508bd362d90e9bfc07966cb7907879d01385
https://github.com/JoOkuma/DifferentiableSketching/tree/6672508bd362d90e9bfc07966cb7907879d01385
SimpleModel
import torch import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class SimpleModel(nn.Module): def __init__(self): super(SimpleModel, self).__init__() def forward(self, x): return x * 2 def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data...
Jovonni/jukebox
SimpleModel
false
669
[ "MIT" ]
0
965a6f78aae67506a6e4fcdb205e2c39132e12e0
https://github.com/Jovonni/jukebox/tree/965a6f78aae67506a6e4fcdb205e2c39132e12e0
InfoLoss
import math import torch from torch import nn import torch.utils.data class InfoLoss(nn.Module): def __init__(self): super().__init__() def forward(self, x, eps=1e-08): x = torch.mean(x, 0) logN = math.log(float(x.shape[0])) x = x * (x + eps).log() / logN neg_entropy ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data assert_size_stride = torch._...
Joshua-Schroijen/deepproblog
InfoLoss
false
670
[ "Apache-2.0" ]
0
4ae56f1e860010b7857b29d5bd76fb1555d5e19d
https://github.com/Joshua-Schroijen/deepproblog/tree/4ae56f1e860010b7857b29d5bd76fb1555d5e19d
LinearFeedforward
import torch import torch.nn as nn import torch.utils.data class Linear(nn.Linear): def forward(self, x): size = x.size() return super().forward(x.contiguous().view(-1, size[-1])).view(* size[:-1], -1) class Feedforward(nn.Module): def __init__(self, d_in, d_out, activation=Non...
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 ...
Jonathan-Chin328/genienlp
LinearFeedforward
false
671
[ "BSD-3-Clause" ]
0
6449140bfea2651523abc3500b212c37955aa39e
https://github.com/Jonathan-Chin328/genienlp/tree/6449140bfea2651523abc3500b212c37955aa39e
EntropyLoss
import math import torch from torch import nn import torch.utils.data class EntropyLoss(nn.Module): def __init__(self): super().__init__() def forward(self, x, eps=1e-08): logN = math.log(float(x.shape[0])) x = x * (x + eps).log() / logN neg_entropy = x.sum(1) return ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data assert_size_stride = torch._...
Joshua-Schroijen/deepproblog
EntropyLoss
false
672
[ "Apache-2.0" ]
0
4ae56f1e860010b7857b29d5bd76fb1555d5e19d
https://github.com/Joshua-Schroijen/deepproblog/tree/4ae56f1e860010b7857b29d5bd76fb1555d5e19d
BinaryNLLEntropy
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss class BinaryNLLEntropy(_Loss): def __init__(self, size_average=True): super(BinaryNLLEntropy, self).__init__() self.size_average = size_average def forward(self, net_output, label_output): """ ...
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....
Jupaoqq/Jupaoqq_LaRL
BinaryNLLEntropy
false
673
[ "Apache-2.0" ]
0
ae64adda5627987d71f2948f499daa11e9f309ad
https://github.com/Jupaoqq/Jupaoqq_LaRL/tree/ae64adda5627987d71f2948f499daa11e9f309ad
Flatten
import torch import torch.nn as nn from itertools import product as product class Flatten(nn.Module): def __init__(self): super(Flatten, self).__init__() def forward(self, x): """ Arguments: x: a float tensor with shape [batch_size, c, h, w]. Returns: ...
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 from itertools import product as product assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
Juggernaut93/InsightFace-v2
Flatten
false
674
[ "Apache-2.0" ]
0
65e9b8d1f285a87472ffb913bec136d4e046798f
https://github.com/Juggernaut93/InsightFace-v2/tree/65e9b8d1f285a87472ffb913bec136d4e046798f
JSD
import math import torch from torch import nn import torch.utils.data class JSD(nn.Module): def __init__(self): super().__init__() def forward(self, x, eps=1e-08): logN = math.log(float(x.shape[0])) y = torch.mean(x, 0) y = y * (y + eps).log() / logN y = y.sum() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data assert_size_stride = torch._...
Joshua-Schroijen/deepproblog
JSD
false
675
[ "Apache-2.0" ]
0
4ae56f1e860010b7857b29d5bd76fb1555d5e19d
https://github.com/Joshua-Schroijen/deepproblog/tree/4ae56f1e860010b7857b29d5bd76fb1555d5e19d
ContrastiveLoss
import torch import torch.nn as nn import torch.nn.modules import torch.nn import torch.nn.init import torch.optim.lr_scheduler class ContrastiveLoss(nn.Module): """ Contrastive loss function. References: https://github.com/delijati/pytorch-siamese/blob/master/contrastive.py LaTeX: L...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.modules import torch.nn import torch.nn.init import...
JoshuaBeard/netharn
ContrastiveLoss
false
676
[ "Apache-2.0" ]
0
90773542c47363e663ee58f20fd151eb89bc313b
https://github.com/JoshuaBeard/netharn/tree/90773542c47363e663ee58f20fd151eb89bc313b
DiceCE_Loss
import torch from torch import nn from torch.nn import functional as F from torch import sigmoid class DiceCE_Loss(nn.Module): """ Taken from https://www.kaggle.com/bigironsphere/loss-function-library-keras-pytorch """ def __init__(self, weight=None, size_average=True): super(DiceCE_Loss, sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
JoaoCarv/holistic_seg
DiceCE_Loss
false
677
[ "MIT" ]
0
ea4787e7e9a36dc5caf198d2be1bd1e71c06d440
https://github.com/JoaoCarv/holistic_seg/tree/ea4787e7e9a36dc5caf198d2be1bd1e71c06d440
ScaledDotProductAttention
import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout: 'float'=None, scale: 'bool'=True): super(ScaledDotProductAttention, self).__init__() if dropout is not None: self.dropout = nn.Dropout(p=dropout) else: self.d...
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....
JustinNeumann/pytorch-forecasting
ScaledDotProductAttention
false
678
[ "MIT" ]
0
4f6e449cb3788b856e66c4283398a5db201aa6ff
https://github.com/JustinNeumann/pytorch-forecasting/tree/4f6e449cb3788b856e66c4283398a5db201aa6ff
FocalLoss
import torch import torch.nn as nn from itertools import product as product class FocalLoss(nn.Module): def __init__(self, gamma=0): super(FocalLoss, self).__init__() self.gamma = gamma self.ce = torch.nn.CrossEntropyLoss() def forward(self, input, target): logp = self.ce(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 math as tl_math import torch.nn as nn ...
Juggernaut93/InsightFace-v2
FocalLoss
false
679
[ "Apache-2.0" ]
0
65e9b8d1f285a87472ffb913bec136d4e046798f
https://github.com/Juggernaut93/InsightFace-v2/tree/65e9b8d1f285a87472ffb913bec136d4e046798f
NormKLLoss
import torch import torch as th from torch.nn.modules.loss import _Loss class NormKLLoss(_Loss): def __init__(self, unit_average=False): super(NormKLLoss, self).__init__() self.unit_average = unit_average def forward(self, recog_mu, recog_logvar, prior_mu, prior_logvar): loss = 1.0 +...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dy...
Jupaoqq/Jupaoqq_LaRL
NormKLLoss
false
680
[ "Apache-2.0" ]
0
ae64adda5627987d71f2948f499daa11e9f309ad
https://github.com/Jupaoqq/Jupaoqq_LaRL/tree/ae64adda5627987d71f2948f499daa11e9f309ad
BlendLinear
import torch import torch.nn as nn import torch.utils.data class BlendLinear(nn.Module): def __init__(self, dim_in, dim_out, layer_type=nn.Linear, **unused_kwargs): super(BlendLinear, self).__init__() self._layer0 = layer_type(dim_in, dim_out) self._layer1 = layer_type(dim_in, dim_out) ...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
BlendLinear
false
681
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
HidingRes
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.nn.functional as F class ResidualBlock(nn.Module): def __init__(self, channel_num, dilation=1, group=1): super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(channel_num, channel_num, 3, 1, pa...
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....
Hwihuni/Deep-Model-Watermarking
HidingRes
false
682
[ "MIT" ]
0
73ea2286ace0aac3d55f6056da38ea2bc38ed00d
https://github.com/Hwihuni/Deep-Model-Watermarking/tree/73ea2286ace0aac3d55f6056da38ea2bc38ed00d
ResampleNorm
import torch import torch.nn.functional as F import torch.nn as nn class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_size self.batch_first = batch_...
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.functional as F import torch.nn as nn assert_size_stride = torc...
JustinNeumann/pytorch-forecasting
ResampleNorm
false
683
[ "MIT" ]
0
4f6e449cb3788b856e66c4283398a5db201aa6ff
https://github.com/JustinNeumann/pytorch-forecasting/tree/4f6e449cb3788b856e66c4283398a5db201aa6ff
Hidden2Discrete
import torch import torch.nn as nn import torch.nn.functional as F class Hidden2Discrete(nn.Module): def __init__(self, input_size, y_size, k_size, is_lstm=False, has_bias=True ): super(Hidden2Discrete, self).__init__() self.y_size = y_size self.k_size = k_size latent_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....
Jupaoqq/Jupaoqq_LaRL
Hidden2Discrete
false
684
[ "Apache-2.0" ]
0
ae64adda5627987d71f2948f499daa11e9f309ad
https://github.com/Jupaoqq/Jupaoqq_LaRL/tree/ae64adda5627987d71f2948f499daa11e9f309ad
VGG19
import torch import torch.nn as nn import torch.nn.functional as F class VGG19(nn.Module): def __init__(self): super(VGG19, self).__init__() self.conv0_0 = nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, stride=1, padding=1) self.conv0_1 = nn.Conv2d(in_channels=64, ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Hwa-Jong/VGG_in_Torch
VGG19
false
685
[ "MIT" ]
0
99a922070367ee9b9485c4df397f9413d11841b8
https://github.com/Hwa-Jong/VGG_in_Torch/tree/99a922070367ee9b9485c4df397f9413d11841b8
Upsample
import torch import torch.nn as nn import torch.nn.functional as F from torchvision.transforms.functional import * class Upsample(nn.Module): def __init__(self, scale_factor=1, mode='nearest'): super(Upsample, self).__init__() self.scale_factor = scale_factor self.mode = mode 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 import torch.nn as nn from torchvision.transforms.functional import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_...
BiggerBinBin/e3d_handpose_x-master
Upsample
false
686
[ "Apache-2.0" ]
0
20d091a8a019d85de26c81d02985868f79d5de84
https://github.com/BiggerBinBin/e3d_handpose_x-master/tree/20d091a8a019d85de26c81d02985868f79d5de84
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. .. math:: \\begin{array}{ll} x = context*output \\\\ attn = exp(x_i) / sum_j exp(x_j) \\\\ ...
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....
JunhoKim94/speech_hackathon_2019
Attention
false
687
[ "Apache-2.0" ]
0
1cb8de873d48e94f58bd1103c32b977a27d34951
https://github.com/JunhoKim94/speech_hackathon_2019/tree/1cb8de873d48e94f58bd1103c32b977a27d34951
LunaBlock
import torch import torch.nn as nn class LunaBlock(nn.Module): def __init__(self, in_channels, conv_channels): super().__init__() self.conv1 = nn.Conv3d(in_channels, conv_channels, kernel_size=3, padding=1, bias=True) self.relu1 = nn.ReLU(inplace=True) self.conv2 = 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 import torch.nn as nn assert_...
JulianKlug/scop
LunaBlock
false
688
[ "MIT" ]
0
b0d6a805a11ee8b4d0f53a4d6a5ec402988298e4
https://github.com/JulianKlug/scop/tree/b0d6a805a11ee8b4d0f53a4d6a5ec402988298e4
Sine
import torch import torch.nn as nn class Sine(nn.Module): def __init(self): super().__init__() def forward(self, input): return torch.sin(30 * input) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
KIMGEONUNG/multi-memory-siren
Sine
false
689
[ "MIT" ]
0
b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
https://github.com/KIMGEONUNG/multi-memory-siren/tree/b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
My_SmoothL1Loss
import torch class My_SmoothL1Loss(torch.nn.Module): def __init__(self): super(My_SmoothL1Loss, self).__init__() def forward(self, x, y): total_loss = 0 assert x.shape == y.shape z = (x - y).float() mse_mask = (torch.abs(z) < 0.01).float() l1_mask = (torch.abs...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Jvictor97/AWR-Adaptive-Weighting-Regression
My_SmoothL1Loss
false
690
[ "MIT" ]
0
2c29f8ac3d824edfff07465232ffed8e4d837ebf
https://github.com/Jvictor97/AWR-Adaptive-Weighting-Regression/tree/2c29f8ac3d824edfff07465232ffed8e4d837ebf
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=32, fc2_units=16): """Initialize parameters and build model. Params ====== state_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 import torch.nn as nn assert_...
JamesMcGuigan/udacity-deep-reinforcement-learning
QNetwork
false
691
[ "MIT" ]
0
e093db535fb12dbfb8bc2b5764133e1f52bbbccd
https://github.com/JamesMcGuigan/udacity-deep-reinforcement-learning/tree/e093db535fb12dbfb8bc2b5764133e1f52bbbccd
SelfAttn
import torch import torch as th import torch.nn as nn import torch.nn.functional as F class SelfAttn(nn.Module): def __init__(self, hidden_size): super(SelfAttn, self).__init__() self.query = nn.Linear(hidden_size, 1) def forward(self, keys, values, attn_mask=None): """ :para...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Jupaoqq/Jupaoqq_LaRL
SelfAttn
false
692
[ "Apache-2.0" ]
0
ae64adda5627987d71f2948f499daa11e9f309ad
https://github.com/Jupaoqq/Jupaoqq_LaRL/tree/ae64adda5627987d71f2948f499daa11e9f309ad
GatedConv2d
import torch import torch.nn as nn import torch.utils.data class GatedConv2d(nn.Module): def __init__(self, input_channels, output_channels, kernel_size, stride, padding, dilation=1, activation=None): super(GatedConv2d, self).__init__() self.activation = activation self.sigmoid = ...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
GatedConv2d
false
693
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
SpatialGate
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Conv3DSimple(nn.Conv3d): def __init__(self, in_planes, out_planes, stride=1, kernel_size=3): padding = (kernel_size - 1) // 2 super(Conv3DSimple, 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.nn as nn import ...
JoohyungLee0106/rectal_MR_volume_classification
SpatialGate
false
694
[ "MIT" ]
0
d2a7d13dae9fe7255b983cbc210567dd452a936f
https://github.com/JoohyungLee0106/rectal_MR_volume_classification/tree/d2a7d13dae9fe7255b983cbc210567dd452a936f
ConcatSquashLinear
import torch import torch.nn as nn import torch.utils.data class ConcatSquashLinear(nn.Module): def __init__(self, dim_in, dim_out): super(ConcatSquashLinear, self).__init__() self._layer = nn.Linear(dim_in, dim_out) self._hyper_bias = nn.Linear(1, dim_out, bias=False) self._hyper...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
ConcatSquashLinear
false
695
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
GateAddNorm
import torch import torch.nn.functional as F import torch.nn as nn class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_size self.batch_first = batch_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.fun...
JustinNeumann/pytorch-forecasting
GateAddNorm
false
696
[ "MIT" ]
0
4f6e449cb3788b856e66c4283398a5db201aa6ff
https://github.com/JustinNeumann/pytorch-forecasting/tree/4f6e449cb3788b856e66c4283398a5db201aa6ff
BlendConv2d
import torch import torch.nn as nn import torch.utils.data class BlendConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False, **unused_kwargs): super(BlendConv2d, self).__init__() module = nn.ConvTranspose2d if...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
BlendConv2d
false
697
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
HyperConv2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def get_activation_name(activation): """Given a string or a `torch.nn.modules.activation` return the name of the activation.""" if isinstance(activation, str): return activation mapper = {nn.LeakyReLU: 'leak...
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 import torch.utils.data as...
Justin-Tan/ffjord
HyperConv2d
false
698
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
GatedLinear
import torch import torch.nn as nn import torch.utils.data class GatedLinear(nn.Module): def __init__(self, in_features, out_features): super(GatedLinear, self).__init__() self.layer_f = nn.Linear(in_features, out_features) self.layer_g = nn.Linear(in_features, out_features) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
GatedLinear
false
699
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
ConcatConv2d
import torch import torch.nn as nn import torch.utils.data class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() module = nn.ConvTranspose2d if transpose else...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
ConcatConv2d
false
700
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
NeuralNet1
import torch import torch.nn as nn class NeuralNet1(nn.Module): def __init__(self, input_size, hidden_size): super(NeuralNet1, self).__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.relu = nn.ReLU() self.linear2 = nn.Linear(hidden_size, 1) 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_...
KOPFYF/pytorchTutorial
NeuralNet1
false
701
[ "MIT" ]
0
4ed7642049a0fba46edd505a23ffcea9d8e03679
https://github.com/KOPFYF/pytorchTutorial/tree/4ed7642049a0fba46edd505a23ffcea9d8e03679
DiceLoss
import torch import torch.nn as nn import torch.utils.data class DiceLoss(nn.Module): """DICE loss. """ def __init__(self, size_average=True, reduce=True, smooth=100.0, power=1): super(DiceLoss, self).__init__() self.smooth = smooth self.reduce = reduce self.power = power ...
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....
KeeratKG/pytorch_connectomics
DiceLoss
false
702
[ "MIT" ]
0
ba168da6f077ccfbeffcd8936df90ba413895086
https://github.com/KeeratKG/pytorch_connectomics/tree/ba168da6f077ccfbeffcd8936df90ba413895086
BasicBlock
import torch import torch.nn as nn import torch.utils.data class BasicBlock(nn.Module): expansion = 1 def __init__(self, dim): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1, bias=False) self.bn1 = nn.GroupNorm(2, dim, eps=0.0001) ...
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....
Justin-Tan/ffjord
BasicBlock
false
703
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
FactorizedReduce
import torch import torch.nn as nn import torch.utils.data import torch.utils from matplotlib import cm as cm from torch.nn.parallel import * from torchvision.models import * from torchvision.datasets import * def get_norm_layer(norm, C): if norm in [None, '', 'none']: norm_layer = nn.Identity() elif ...
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....
CrispyHarder/ppuda
FactorizedReduce
false
704
[ "MIT" ]
0
15950ba297188163eaadd8ab69268ee7f6ffcf2a
https://github.com/CrispyHarder/ppuda/tree/15950ba297188163eaadd8ab69268ee7f6ffcf2a
AddNorm
import torch import torch.nn.functional as F import torch.nn as nn class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_size self.batch_first = batch_...
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.functional as F import torch.nn as nn assert_size_stride = torc...
JustinNeumann/pytorch-forecasting
AddNorm
false
705
[ "MIT" ]
0
4f6e449cb3788b856e66c4283398a5db201aa6ff
https://github.com/JustinNeumann/pytorch-forecasting/tree/4f6e449cb3788b856e66c4283398a5db201aa6ff
VOC_VGG16_DeepLabV2
import torch from torch import nn class FCReLUDrop(nn.Sequential): def __init__(self, in_ch, out_ch, kernel_size, dilation, padding, layer_idx, branch_idx): super(FCReLUDrop, self).__init__() self.add_module(f'fc{layer_idx}_{branch_idx}', nn.Conv2d(in_ch, out_ch, 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 import nn assert_s...
HAL-42/DeepLabV2YQ
VOC_VGG16_DeepLabV2
false
706
[ "Apache-2.0" ]
0
96bfcf1055da7adeb4a7c1ed841f6ec29957be59
https://github.com/HAL-42/DeepLabV2YQ/tree/96bfcf1055da7adeb4a7c1ed841f6ec29957be59
BatchLinear
import torch import torch.nn as nn from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ----- Objects inherited from `MetaModule` are fully compa...
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...
KIMGEONUNG/multi-memory-siren
BatchLinear
false
707
[ "MIT" ]
0
b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
https://github.com/KIMGEONUNG/multi-memory-siren/tree/b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
BinaryReg
import torch import torch.nn as nn import torch.utils.data class BinaryReg(nn.Module): """Regularization for encouraging the outputs to be binary. """ def __init__(self, alpha=1.0): super().__init__() self.alpha = alpha def forward(self, pred): diff = pred - 0.5 diff ...
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 ...
KeeratKG/pytorch_connectomics
BinaryReg
false
708
[ "MIT" ]
0
ba168da6f077ccfbeffcd8936df90ba413895086
https://github.com/KeeratKG/pytorch_connectomics/tree/ba168da6f077ccfbeffcd8936df90ba413895086
JaccardLoss
import torch import torch.nn as nn import torch.utils.data class JaccardLoss(nn.Module): """Jaccard loss. """ def __init__(self, size_average=True, reduce=True, smooth=1.0): super(JaccardLoss, self).__init__() self.smooth = smooth self.reduce = reduce def jaccard_loss(self, p...
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....
KeeratKG/pytorch_connectomics
JaccardLoss
false
709
[ "MIT" ]
0
ba168da6f077ccfbeffcd8936df90ba413895086
https://github.com/KeeratKG/pytorch_connectomics/tree/ba168da6f077ccfbeffcd8936df90ba413895086
L2Norm
import torch import torch.nn as nn import torch.nn.parallel import torch.optim from torch.nn import functional as F class L2Norm(nn.Module): def __init__(self): super().__init__() def forward(self, x): assert x.dim( ) == 2, 'the input tensor of L2Norm must be the shape of [B, C]'...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Khanhnn00/image-retrieval
L2Norm
false
710
[ "MIT" ]
0
7c6c5fe9ec5fd6cb0f0906027fd80787e2ad1cf8
https://github.com/Khanhnn00/image-retrieval/tree/7c6c5fe9ec5fd6cb0f0906027fd80787e2ad1cf8
MetaBilinear
import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ----- Objects inherited f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride reinterpret_tensor = torch._C._dynamo.guards._reinterp...
KIMGEONUNG/multi-memory-siren
MetaBilinear
false
711
[ "MIT" ]
0
b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
https://github.com/KIMGEONUNG/multi-memory-siren/tree/b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
SimpleGCN
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.nn import Parameter import torch.nn import torch.autograd class SimpleGCN(nn.Module): """A simple graph convolution layer, similar to the one defined in Kipf et al. https://arxiv.org/abs/1609.02907 """ ...
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 torch.nn.parameter import Parameter from ...
Kh4L/kaolin
SimpleGCN
false
712
[ "ECL-2.0", "Apache-2.0" ]
0
83002fedc67e1c9112a8f834ffb4f8a890e6042a
https://github.com/Kh4L/kaolin/tree/83002fedc67e1c9112a8f834ffb4f8a890e6042a
GatedResidualNetwork
import torch import torch.nn.functional as F import torch.nn as nn class TimeDistributedInterpolation(nn.Module): def __init__(self, output_size: 'int', batch_first: 'bool'=False, trainable: 'bool'=False): super().__init__() self.output_size = output_size self.batch_first = batch_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.fun...
JustinNeumann/pytorch-forecasting
GatedResidualNetwork
false
713
[ "MIT" ]
0
4f6e449cb3788b856e66c4283398a5db201aa6ff
https://github.com/JustinNeumann/pytorch-forecasting/tree/4f6e449cb3788b856e66c4283398a5db201aa6ff
L1_log
import torch import torch.nn.functional as F import torch.nn as nn class L1_log(nn.Module): def __init__(self): super(L1_log, self).__init__() def forward(self, fake, real): if not fake.shape == real.shape: _, _, H, W = real.shape fake = F.upsample(fake, size=(H, W), ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Khoronus/MonoDepth-FPN-PyTorch
L1_log
false
714
[ "MIT" ]
0
6e41e297723d1490c537e04afff905c61d6f0ff8
https://github.com/Khoronus/MonoDepth-FPN-PyTorch/tree/6e41e297723d1490c537e04afff905c61d6f0ff8
Conv
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False, relu=True): super(Conv, self).__init__() self.inp_dim = inp_dim self.conv = nn.Conv2d(inp_dim, out_dim, kernel_size, stride, padding=(kerne...
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_...
Jvictor97/AWR-Adaptive-Weighting-Regression
Conv
false
715
[ "MIT" ]
0
2c29f8ac3d824edfff07465232ffed8e4d837ebf
https://github.com/Jvictor97/AWR-Adaptive-Weighting-Regression/tree/2c29f8ac3d824edfff07465232ffed8e4d837ebf
MetaLayerNorm
import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ----- Objects inherited f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
KIMGEONUNG/multi-memory-siren
MetaLayerNorm
false
716
[ "MIT" ]
0
b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
https://github.com/KIMGEONUNG/multi-memory-siren/tree/b372e1b9abe2b3fb502d808eb3a47c2ad287ca3b
RMSE_log
import torch import torch.nn.functional as F import torch.nn as nn class RMSE_log(nn.Module): def __init__(self): super(RMSE_log, self).__init__() def forward(self, fake, real): if not fake.shape == real.shape: _, _, H, W = real.shape fake = F.upsample(fake, size=(H, ...
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...
Khoronus/MonoDepth-FPN-PyTorch
RMSE_log
false
717
[ "MIT" ]
0
6e41e297723d1490c537e04afff905c61d6f0ff8
https://github.com/Khoronus/MonoDepth-FPN-PyTorch/tree/6e41e297723d1490c537e04afff905c61d6f0ff8
NormalLoss
import torch import torch.nn as nn class NormalLoss(nn.Module): def __init__(self): super(NormalLoss, self).__init__() def forward(self, grad_fake, grad_real): prod = (grad_fake[:, :, None, :] @ grad_real[:, :, :, None]).squeeze(-1 ).squeeze(-1) fake_norm = torch.sqrt(tor...
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 ...
Khoronus/MonoDepth-FPN-PyTorch
NormalLoss
false
719
[ "MIT" ]
0
6e41e297723d1490c537e04afff905c61d6f0ff8
https://github.com/Khoronus/MonoDepth-FPN-PyTorch/tree/6e41e297723d1490c537e04afff905c61d6f0ff8
GCN
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
KagRes/pygcn
GCN
false
720
[ "MIT" ]
0
cdad4adadf8a63561ee530e632b439a2398c3c5f
https://github.com/KagRes/pygcn/tree/cdad4adadf8a63561ee530e632b439a2398c3c5f
GradLoss
import torch import torch.nn as nn class GradLoss(nn.Module): def __init__(self): super(GradLoss, self).__init__() def forward(self, grad_fake, grad_real): return torch.sum(torch.mean(torch.abs(grad_real - grad_fake))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Khoronus/MonoDepth-FPN-PyTorch
GradLoss
false
721
[ "MIT" ]
0
6e41e297723d1490c537e04afff905c61d6f0ff8
https://github.com/Khoronus/MonoDepth-FPN-PyTorch/tree/6e41e297723d1490c537e04afff905c61d6f0ff8
SeparableBlock
from torch.nn import Module import torch from torch.nn import Linear class SeparableBlock(Module): def __init__(self, input_size, kernel_channels_in, kernel_channels_out, kernel_size): super(SeparableBlock, self).__init__() self.input_size = input_size self.kernel_size = 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.nn import Module from torch.nn import Linear assert_size_stride = tor...
Kiberchaika/StyleGAN-nada
SeparableBlock
false
722
[ "MIT" ]
0
b25a6061933d3d56fbc0af493a7765f316bdd513
https://github.com/Kiberchaika/StyleGAN-nada/tree/b25a6061933d3d56fbc0af493a7765f316bdd513
RMSE
import torch import torch.nn.functional as F import torch.nn as nn class RMSE(nn.Module): def __init__(self): super(RMSE, self).__init__() def forward(self, fake, real): if not fake.shape == real.shape: _, _, H, W = real.shape fake = F.upsample(fake, size=(H, W), mode...
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...
Khoronus/MonoDepth-FPN-PyTorch
RMSE
false
723
[ "MIT" ]
0
6e41e297723d1490c537e04afff905c61d6f0ff8
https://github.com/Khoronus/MonoDepth-FPN-PyTorch/tree/6e41e297723d1490c537e04afff905c61d6f0ff8
GatedLinearUnit
import torch import torch.nn.functional as F import torch.nn as nn class GatedLinearUnit(nn.Module): """Gated Linear Unit""" def __init__(self, input_size: 'int', hidden_size: 'int'=None, dropout: 'float'=None): super().__init__() if dropout is not None: self.dropout = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
JustinNeumann/pytorch-forecasting
GatedLinearUnit
false
725
[ "MIT" ]
0
4f6e449cb3788b856e66c4283398a5db201aa6ff
https://github.com/JustinNeumann/pytorch-forecasting/tree/4f6e449cb3788b856e66c4283398a5db201aa6ff
ConcatSquashConv2d
import torch import torch.nn as nn import torch.utils.data class ConcatSquashConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatSquashConv2d, self).__init__() module = nn.ConvTranspose2d if tr...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
ConcatSquashConv2d
false
727
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
IntegIndepenPathLoss
import torch import numpy as np import torch.utils.data import torch import torch.nn as nn class IntegralGrad: grad_norm_scale = 20 def __init__(self): return @staticmethod def grad_merge(grad_x_mtx, grad_y_mtx, dim=-3): grad_mtx = torch.cat((grad_x_mtx, grad_y_mtx), dim=dim) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np import torch.utils.data import torch import torch.nn a...
KingOnTheStar/pytorch-CycleGAN-and-pix2pix
IntegIndepenPathLoss
false
728
[ "BSD-3-Clause" ]
0
9016b98d09902975b49a07c394bb0d5066e2aa55
https://github.com/KingOnTheStar/pytorch-CycleGAN-and-pix2pix/tree/9016b98d09902975b49a07c394bb0d5066e2aa55
BatchHardTripletLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim from torch.nn import functional as F class BatchHardTripletLoss(nn.Module): def __init__(self, margin=1.0): super().__init__() self.margin = margin @staticmethod def get_anchor_positive_triplet_mask(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 import torch.nn as nn import torch.nn.parallel import torch.optim assert_size_stride = to...
Khanhnn00/image-retrieval
BatchHardTripletLoss
false
729
[ "MIT" ]
0
7c6c5fe9ec5fd6cb0f0906027fd80787e2ad1cf8
https://github.com/Khanhnn00/image-retrieval/tree/7c6c5fe9ec5fd6cb0f0906027fd80787e2ad1cf8
L1
import torch import torch.nn.functional as F import torch.nn as nn class L1(nn.Module): def __init__(self): super(L1, self).__init__() def forward(self, fake, real): if not fake.shape == real.shape: _, _, H, W = real.shape fake = F.upsample(fake, size=(H, W), mode='bi...
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 ...
Khoronus/MonoDepth-FPN-PyTorch
L1
false
730
[ "MIT" ]
0
6e41e297723d1490c537e04afff905c61d6f0ff8
https://github.com/Khoronus/MonoDepth-FPN-PyTorch/tree/6e41e297723d1490c537e04afff905c61d6f0ff8
Downsample
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
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...
Khanhnn00/kernel-prior-diffusion
Downsample
false
731
[ "MIT" ]
0
6f38d3a645c5f6a2b33b8ab60b6f15a12bf245dd
https://github.com/Khanhnn00/kernel-prior-diffusion/tree/6f38d3a645c5f6a2b33b8ab60b6f15a12bf245dd
GatedConv
import torch import torch.nn as nn import torch.utils.data class GatedConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1): super(GatedConv, self).__init__() self.layer_f = nn.Conv2d(in_channels, out_channels, 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
GatedConv
false
734
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
FactoredAttention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch as t def checkpoint(func, inputs, params, flag): if flag: args = inputs + tuple(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....
Jovonni/jukebox
FactoredAttention
false
735
[ "MIT" ]
0
965a6f78aae67506a6e4fcdb205e2c39132e12e0
https://github.com/Jovonni/jukebox/tree/965a6f78aae67506a6e4fcdb205e2c39132e12e0
GatedConvTranspose
import torch import torch.nn as nn import torch.utils.data class GatedConvTranspose(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, groups=1): super(GatedConvTranspose, self).__init__() self.layer_f = nn.ConvTranspose2d(in_chan...
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.utils.data assert_size_stride = torch._C._dyn...
Justin-Tan/ffjord
GatedConvTranspose
false
736
[ "MIT" ]
0
2caf8a4ff84933672fe0d94255d665b3dd7a6791
https://github.com/Justin-Tan/ffjord/tree/2caf8a4ff84933672fe0d94255d665b3dd7a6791
ClassHead
import torch import torch.nn as nn from itertools import product as product class ClassHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(ClassHead, self).__init__() self.num_anchors = num_anchors self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 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 import torch.nn as nn from itertools import product as product assert_size_strid...
Juggernaut93/InsightFace-v2
ClassHead
false
738
[ "Apache-2.0" ]
0
65e9b8d1f285a87472ffb913bec136d4e046798f
https://github.com/Juggernaut93/InsightFace-v2/tree/65e9b8d1f285a87472ffb913bec136d4e046798f
IOUloss
import torch import torch.nn as nn class IOUloss(nn.Module): def __init__(self, reduction='none', loss_type='iou'): super(IOUloss, self).__init__() self.reduction = reduction self.loss_type = loss_type def forward(self, pred, target): assert pred.shape[0] == target.shape[0] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
LSH9832/MyPythonModules
IOUloss
false
741
[ "MIT" ]
0
442566a0fbd6ebe2bc20b6914686a1e2663d10c0
https://github.com/LSH9832/MyPythonModules/tree/442566a0fbd6ebe2bc20b6914686a1e2663d10c0
LandmarkHead
import torch import torch.nn as nn from itertools import product as product class LandmarkHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(LandmarkHead, self).__init__() self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size= (1, 1), stride=1, padd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from itertools import product as product assert_size_strid...
Juggernaut93/InsightFace-v2
LandmarkHead
false
743
[ "Apache-2.0" ]
0
65e9b8d1f285a87472ffb913bec136d4e046798f
https://github.com/Juggernaut93/InsightFace-v2/tree/65e9b8d1f285a87472ffb913bec136d4e046798f
ScaledDotProductAttention
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-product Attention Args: dim (int): dimention of attention Inputs: query, value - **query** (batch_size, q_len, hidden_dim): tensor containi...
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....
Kormap/Side-Projects
ScaledDotProductAttention
false
745
[ "MIT" ]
0
9e61d5b062cc6823cfebc18370f7caae622ea571
https://github.com/Kormap/Side-Projects/tree/9e61d5b062cc6823cfebc18370f7caae622ea571
EntropyLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class EntropyLoss(nn.Module): def __init__(self): super(EntropyLoss, self).__init__() def forward(self, input): prob = F.softmax(input, dim=...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
LakeAndCat/CluOReg
EntropyLoss
false
746
[ "MIT" ]
0
ba50cb056061b3833050d32e532e08152bdc8de2
https://github.com/LakeAndCat/CluOReg/tree/ba50cb056061b3833050d32e532e08152bdc8de2
CSDN_Tem
import torch import torch.nn as nn class CSDN_Tem(nn.Module): def __init__(self, in_ch, out_ch, kernel_size=3, stride=1, padding=1, dilation=1): super(CSDN_Tem, self).__init__() self.depth_conv = nn.Conv2d(in_channels=in_ch, out_channels=in_ch, kernel_size=kernel_size, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
LOUEY233/CPS3320_python
CSDN_Tem
false
747
[ "MIT" ]
0
3cc1733d91c3a8f680eeb984348e2a52ae3285ec
https://github.com/LOUEY233/CPS3320_python/tree/3cc1733d91c3a8f680eeb984348e2a52ae3285ec
Softmax_T
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class Softmax_T(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self, T): super(Softmax_T, self).__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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
LakeAndCat/CluOReg
Softmax_T
false
748
[ "MIT" ]
0
ba50cb056061b3833050d32e532e08152bdc8de2
https://github.com/LakeAndCat/CluOReg/tree/ba50cb056061b3833050d32e532e08152bdc8de2
AconC
import torch import torch.nn as nn class AconC(nn.Module): """ ACON activation (activate or not) AconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is a learnable parameter according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. """ def __in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
LTTBasic/lecttue-diagonosis
AconC
false
749
[ "MIT" ]
0
a9573f79da1fa8dcdd649bfd819ffad67ecad309
https://github.com/LTTBasic/lecttue-diagonosis/tree/a9573f79da1fa8dcdd649bfd819ffad67ecad309
MultiHeadAttention
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-product Attention Args: dim (int): dimention of attention Inputs: query, value - **query** (batch_size, q_len, hidden_dim): tensor containi...
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....
Kormap/Side-Projects
MultiHeadAttention
false
750
[ "MIT" ]
0
9e61d5b062cc6823cfebc18370f7caae622ea571
https://github.com/Kormap/Side-Projects/tree/9e61d5b062cc6823cfebc18370f7caae622ea571
KL
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class KL(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self, T): super(KL, self).__init__() self.T = T 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
LakeAndCat/CluOReg
KL
false
751
[ "MIT" ]
0
ba50cb056061b3833050d32e532e08152bdc8de2
https://github.com/LakeAndCat/CluOReg/tree/ba50cb056061b3833050d32e532e08152bdc8de2
AttentionModule
import torch import torch.nn as nn class AttentionModule(nn.Module): def __init__(self, dim): super().__init__() self.conv0 = nn.Conv2d(dim, dim, 5, padding=2, groups=dim) self.conv_spatial = nn.Conv2d(dim, dim, 7, stride=1, padding=9, groups=dim, dilation=3) self.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
LSH9832/MyPythonModules
AttentionModule
false
752
[ "MIT" ]
0
442566a0fbd6ebe2bc20b6914686a1e2663d10c0
https://github.com/LSH9832/MyPythonModules/tree/442566a0fbd6ebe2bc20b6914686a1e2663d10c0
SigmaL1SmoothLoss
import torch import torch.nn as nn from typing import * class SigmaL1SmoothLoss(nn.Module): def forward(self, output, target): reg_diff = torch.abs(target - output) reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow( reg_diff, 2), reg_diff - 1 / 18) return reg_l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
LaurenSpiegel/fastai_docs
SigmaL1SmoothLoss
false
753
[ "Apache-2.0" ]
0
4fe6b62116d88dea9610548133e6cadb6b260a73
https://github.com/LaurenSpiegel/fastai_docs/tree/4fe6b62116d88dea9610548133e6cadb6b260a73
Mlp
import math import torch import torch.nn as nn class DWConv(nn.Module): def __init__(self, dim=768): super(DWConv, self).__init__() self.dwconv = nn.Conv2d(dim, dim, 3, 1, 1, bias=True, groups=dim) def forward(self, x): x = self.dwconv(x) return x class Mlp(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
LSH9832/MyPythonModules
Mlp
false
755
[ "MIT" ]
0
442566a0fbd6ebe2bc20b6914686a1e2663d10c0
https://github.com/LSH9832/MyPythonModules/tree/442566a0fbd6ebe2bc20b6914686a1e2663d10c0
GeneralRelu
import torch import torch.nn as nn import torch.nn.functional as F from typing import * class GeneralRelu(nn.Module): def __init__(self, leak=None, sub=None, maxv=None): super().__init__() self.leak, self.sub, self.maxv = leak, sub, maxv def forward(self, x): x = F.leaky_relu(x, 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 from typing import * assert_size_stride = torch._C._dynamo.guards.a...
LaurenSpiegel/fastai_docs
GeneralRelu
false
756
[ "Apache-2.0" ]
0
4fe6b62116d88dea9610548133e6cadb6b260a73
https://github.com/LaurenSpiegel/fastai_docs/tree/4fe6b62116d88dea9610548133e6cadb6b260a73
SigmoidRange
import torch import torch.nn as nn from typing import * def sigmoid_range(x, low, high): """Sigmoid function with range `(low, high)`""" return torch.sigmoid(x) * (high - low) + low class SigmoidRange(nn.Module): """Sigmoid module with range `(low, high)`""" def __init__(self, low, high): 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 import torch.nn as nn from typing import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
LaurenSpiegel/fastai_docs
SigmoidRange
false
757
[ "Apache-2.0" ]
0
4fe6b62116d88dea9610548133e6cadb6b260a73
https://github.com/LaurenSpiegel/fastai_docs/tree/4fe6b62116d88dea9610548133e6cadb6b260a73
ClusterLayer
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.utils.data.distributed from torch.nn.parameter import Parameter class ClusterLayer(nn.Module): def __init__(self, n_cluster, expansion, cluster_m): super(ClusterLayer, self).__init__() self.center = P...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.nn.parallel import torch.ut...
LakeAndCat/CluOReg
ClusterLayer
false
758
[ "MIT" ]
0
ba50cb056061b3833050d32e532e08152bdc8de2
https://github.com/LakeAndCat/CluOReg/tree/ba50cb056061b3833050d32e532e08152bdc8de2
CPUForgetMult
import torch from typing import * class CPUForgetMult(torch.nn.Module): def __init__(self): super(CPUForgetMult, self).__init__() def forward(self, f, x, hidden_init=None): result = [] forgets = f.split(1, dim=0) prev_h = hidden_init for i, h in enumerate((f * x).spli...
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 typing import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
LaurenSpiegel/fastai_docs
CPUForgetMult
false
759
[ "Apache-2.0" ]
0
4fe6b62116d88dea9610548133e6cadb6b260a73
https://github.com/LaurenSpiegel/fastai_docs/tree/4fe6b62116d88dea9610548133e6cadb6b260a73
TransformerLayer
import torch import torch.nn as nn class TransformerLayer(nn.Module): def __init__(self, c, num_heads): super().__init__() self.q = nn.Linear(c, c, bias=False) self.k = nn.Linear(c, c, bias=False) self.v = nn.Linear(c, c, bias=False) self.ma = nn.MultiheadAttention(embed_d...
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....
LTTBasic/lecttue-diagonosis
TransformerLayer
false
760
[ "MIT" ]
0
a9573f79da1fa8dcdd649bfd819ffad67ecad309
https://github.com/LTTBasic/lecttue-diagonosis/tree/a9573f79da1fa8dcdd649bfd819ffad67ecad309
SpatialAttention
import torch import torch.nn as nn class AttentionModule(nn.Module): def __init__(self, dim): super().__init__() self.conv0 = nn.Conv2d(dim, dim, 5, padding=2, groups=dim) self.conv_spatial = nn.Conv2d(dim, dim, 7, stride=1, padding=9, groups=dim, dilation=3) self.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.triton_helpers import libdevice import torch.nn as ...
LSH9832/MyPythonModules
SpatialAttention
false
761
[ "MIT" ]
0
442566a0fbd6ebe2bc20b6914686a1e2663d10c0
https://github.com/LSH9832/MyPythonModules/tree/442566a0fbd6ebe2bc20b6914686a1e2663d10c0
AsymmetricLossOptimized
import torch import torch.nn as nn class AsymmetricLossOptimized(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations https://github.com/Alibaba-MIIL/ASL/blob/main/src/loss_functions/losses.py """ def __init__(self, gamma_neg=4, gamm...
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...
LanXiangExcavator/challenge2021_submission_4
AsymmetricLossOptimized
false
762
[ "BSD-2-Clause" ]
0
ca0d4d4dd219119f7dc46464c92062ecdb7f9c49
https://github.com/LanXiangExcavator/challenge2021_submission_4/tree/ca0d4d4dd219119f7dc46464c92062ecdb7f9c49
Gaussian
import torch class Gaussian(torch.nn.Module): """Gaussian activation""" def forward(self, x): return torch.exp(-x * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
LeanAndMean/torchani
Gaussian
false
763
[ "MIT" ]
0
74221a9816a39b78945d9cc693f6cf5b2923b8b9
https://github.com/LeanAndMean/torchani/tree/74221a9816a39b78945d9cc693f6cf5b2923b8b9
BboxHead
import torch import torch.nn as nn from itertools import product as product class BboxHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(BboxHead, self).__init__() self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=( 1, 1), stride=1, padding=0) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from itertools import product as product assert_size_strid...
Juggernaut93/InsightFace-v2
BboxHead
false
764
[ "Apache-2.0" ]
0
65e9b8d1f285a87472ffb913bec136d4e046798f
https://github.com/Juggernaut93/InsightFace-v2/tree/65e9b8d1f285a87472ffb913bec136d4e046798f
Scale
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, scale=1.0): super(Scale, self).__init__() self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float)) def forward(self, x): return x * self.scale def get_inputs(): return [torch.rand([4, 4, 4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Leotju/ttfnet
Scale
false
765
[ "Apache-2.0" ]
0
94eea28ea22215310140caee492d5de2b01b3d04
https://github.com/Leotju/ttfnet/tree/94eea28ea22215310140caee492d5de2b01b3d04
Polynomial3
import torch class Polynomial3(torch.nn.Module): def __init__(self): """ In the constructor we instantiate four parameters and assign them as member parameters. """ super(Polynomial3, self).__init__() self.a = torch.nn.Parameter(torch.randn(())) self.b = torch.nn.P...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
LbsIrving/PyTorch
Polynomial3
false
766
[ "MIT" ]
0
314dbe9efc9e0116a7342d4ae3ab168c1c3afa32
https://github.com/LbsIrving/PyTorch/tree/314dbe9efc9e0116a7342d4ae3ab168c1c3afa32
MetaAconC
import torch import torch.nn as nn class MetaAconC(nn.Module): """ ACON activation (activate or not) MetaAconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is generated by a small network according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. ""...
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...
LTTBasic/lecttue-diagonosis
MetaAconC
false
767
[ "MIT" ]
0
a9573f79da1fa8dcdd649bfd819ffad67ecad309
https://github.com/LTTBasic/lecttue-diagonosis/tree/a9573f79da1fa8dcdd649bfd819ffad67ecad309