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
AdaIN
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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AnetaKaczynska/video-GAN
AdaIN
false
44
[ "BSD-3-Clause" ]
0
e30e54c18265c658a65b1b26b57b4f499b58bfc6
https://github.com/AnetaKaczynska/video-GAN/tree/e30e54c18265c658a65b1b26b57b4f499b58bfc6
maxout
import torch import torch.nn as nn import torch.utils.data class maxout(nn.Module): """ maxout network """ def __init__(self, in_feature, out_feature, pool_size): super(maxout, self).__init__() self.in_feature = in_feature self.out_feature = out_feature self.pool_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 ...
Angelinaa/KOBE
maxout
false
45
[ "MIT" ]
0
4d25487051e2791a977e59297f70a25e51806466
https://github.com/Angelinaa/KOBE/tree/4d25487051e2791a977e59297f70a25e51806466
DecoderLayer
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
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....
AlbertiPot/attention-is-all-you-need-pytorch
DecoderLayer
false
46
[ "MIT" ]
0
c5ec40907db281b85b3bd7a5dd8016940291add0
https://github.com/AlbertiPot/attention-is-all-you-need-pytorch/tree/c5ec40907db281b85b3bd7a5dd8016940291add0
Joiner
import torch from torch import nn from torch.nn import functional as F class Joiner(nn.Module): def __init__(self, x_latent_dim, y_latent_dim, hidden_dim): super().__init__() self.fc1 = nn.Linear(x_latent_dim + y_latent_dim, hidden_dim) self.fc2 = nn.Linear(hidden_dim, 1) def forward...
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...
Andrewzh112/experiments
Joiner
false
47
[ "MIT" ]
0
a35fd9e6157cd9a746f82229c2487539f668716a
https://github.com/Andrewzh112/experiments/tree/a35fd9e6157cd9a746f82229c2487539f668716a
NoiseLayer
import torch from torch import nn class NoiseLayer(nn.Module): """adds noise. noise is per pixel (constant over channels) with per-channel weight""" def __init__(self, channels): super().__init__() self.weight = nn.Parameter(torch.zeros(channels)) self.noise = None def forward(se...
import torch from torch import device import triton import 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....
AnimeshKoratana/blurryface
NoiseLayer
false
49
[ "Apache-2.0" ]
0
c6cb5feec02f6d5af3acb1678336800390715d65
https://github.com/AnimeshKoratana/blurryface/tree/c6cb5feec02f6d5af3acb1678336800390715d65
resblock
import torch from torch import nn class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, type=1): super(mfm, self).__init__() self.out_channels = out_channels if type == 1: self.filter = nn.Conv2d(in_channels, 2 * 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AnimeshKoratana/blurryface
resblock
false
50
[ "Apache-2.0" ]
0
c6cb5feec02f6d5af3acb1678336800390715d65
https://github.com/AnimeshKoratana/blurryface/tree/c6cb5feec02f6d5af3acb1678336800390715d65
PositionwiseFeedForward
import torch import torch.nn as nn import torch.utils.data class PositionwiseFeedForward(nn.Module): """ Point-wise Feed-Forward NN, FFN, in fact 1-d convolution """ def __init__(self, d_model, d_ff, dropout=0.1): """ initialization of required functions :param d_model: model 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....
Angelinaa/KOBE
PositionwiseFeedForward
false
51
[ "MIT" ]
0
4d25487051e2791a977e59297f70a25e51806466
https://github.com/Angelinaa/KOBE/tree/4d25487051e2791a977e59297f70a25e51806466
SelfAttention
import torch import torch.nn as nn import torch.nn.functional as F class SelfAttention(nn.Module): def __init__(self, hidden_size, attention_size=100, n_attention_heads=1): super().__init__() self.hidden_size = hidden_size self.attention_size = attention_size self.n_attention_head...
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....
AnoushkaVyas/TextOutlierDetection
SelfAttention
false
52
[ "MIT" ]
0
290a6800262090998d32c8bbd311e3d53737e2cd
https://github.com/AnoushkaVyas/TextOutlierDetection/tree/290a6800262090998d32c8bbd311e3d53737e2cd
RelativeAttention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, heads, n_state): super().__init__() assert n_state % heads == 0 self.heads = heads self.n_state = n_state self.depth = self.n_state // self.heads def split_heads(self, x: 'torch.Tensor',...
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....
Aalanli/MusicGeneration
RelativeAttention
false
53
[ "MIT" ]
0
7d268322d692013d8ac6e70be31741cea519fa28
https://github.com/Aalanli/MusicGeneration/tree/7d268322d692013d8ac6e70be31741cea519fa28
GeometryFeature
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class GeometryFeature(nn.Module): def __init__(self): super(GeometryFeature, self).__init__() def forward(self, z, vnorm, unorm, h, w, ch, cw, fh, fw): x = z * (0.5 * h * (vnorm + 1) - ch) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asser...
Anonymous1234321/GuideFormer
GeometryFeature
false
55
[ "MIT" ]
0
cccee1c5305977a1bc8d0b8df3f1b6ff66bd1736
https://github.com/Anonymous1234321/GuideFormer/tree/cccee1c5305977a1bc8d0b8df3f1b6ff66bd1736
group
import torch from torch import nn class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, type=1): super(mfm, self).__init__() self.out_channels = out_channels if type == 1: self.filter = nn.Conv2d(in_channels, 2 * 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AnimeshKoratana/blurryface
group
false
57
[ "Apache-2.0" ]
0
c6cb5feec02f6d5af3acb1678336800390715d65
https://github.com/AnimeshKoratana/blurryface/tree/c6cb5feec02f6d5af3acb1678336800390715d65
ToHalf
import torch import torch.onnx class ToHalf(torch.nn.Module): def forward(self, tensor): return tensor.half() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stride...
Alwaysproblem/examples-1
ToHalf
false
58
[ "MIT" ]
0
9754fa63ed1931489a21ac1f5b299f945e369a5c
https://github.com/Alwaysproblem/examples-1/tree/9754fa63ed1931489a21ac1f5b299f945e369a5c
mfm
import torch from torch import nn class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, type=1): super(mfm, self).__init__() self.out_channels = out_channels if type == 1: self.filter = nn.Conv2d(in_channels, 2 * 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AnimeshKoratana/blurryface
mfm
false
59
[ "Apache-2.0" ]
0
c6cb5feec02f6d5af3acb1678336800390715d65
https://github.com/AnimeshKoratana/blurryface/tree/c6cb5feec02f6d5af3acb1678336800390715d65
SimpleAttention
import torch import torch.nn as nn import torch.nn.functional as F class SimpleAttention(nn.Module): def __init__(self, input_dim): super(SimpleAttention, self).__init__() self.input_dim = input_dim self.scalar = nn.Linear(self.input_dim, 1, bias=False) def forward(self, M, x=None): ...
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....
Anshul044/Project-NN
SimpleAttention
false
60
[ "MIT" ]
0
ef080846715a95b735f0381e4f60742e40791630
https://github.com/Anshul044/Project-NN/tree/ef080846715a95b735f0381e4f60742e40791630
MultiLevelPooling
import torch import torch.nn as nn class MultiLevelPooling(nn.Module): def __init__(self, levels=[1, 2, 4]): super(MultiLevelPooling, self).__init__() self.Pools = nn.ModuleList([nn.MaxPool2d(i) for i in levels]) def forward(self, x): assert len(x.size()) == 4, '输入形状不满足(n,c,w,w)' ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Asichurter/Few-Shot-Project
MultiLevelPooling
false
61
[ "MIT" ]
0
865cd6aa7b996c518dfa48dcc9ffad90445f9efe
https://github.com/Asichurter/Few-Shot-Project/tree/865cd6aa7b996c518dfa48dcc9ffad90445f9efe
Linear_soft_plus
import torch import torch.nn as nn class Linear_soft_plus(nn.Module): def __init__(self, dim_in, dim_out, bias=True): super().__init__() self.linear = nn.Linear(dim_in, dim_out, bias=bias) self.activation = nn.Softplus() def forward(self, x): out = self.linear(x) 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Armand-Morin/AutoML
Linear_soft_plus
false
62
[ "MIT" ]
0
189867e2c7734d9afb87a9f51fd42bd6cc527a64
https://github.com/Armand-Morin/AutoML/tree/189867e2c7734d9afb87a9f51fd42bd6cc527a64
ContrastiveLoss
import torch import torch.nn.functional as F class ContrastiveLoss(torch.nn.Module): def __init__(self, margin=0.99): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, output1, output2, label): euclidean_distance = F.pairwise_distance(output1, output2) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
AssassionXY/HOR
ContrastiveLoss
false
63
[ "Apache-2.0" ]
0
a4c91d90a59eb2b144d827afff626b7eac907320
https://github.com/AssassionXY/HOR/tree/a4c91d90a59eb2b144d827afff626b7eac907320
Linear_tanh
import torch import torch.nn as nn class Linear_tanh(nn.Module): def __init__(self, dim_in, dim_out, bias=True): super().__init__() self.linear = nn.Linear(dim_in, dim_out, bias=bias) self.activation = nn.Tanh() def forward(self, x): out = self.linear(x) out = self.ac...
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 ...
Armand-Morin/AutoML
Linear_tanh
false
64
[ "MIT" ]
0
189867e2c7734d9afb87a9f51fd42bd6cc527a64
https://github.com/Armand-Morin/AutoML/tree/189867e2c7734d9afb87a9f51fd42bd6cc527a64
Linear_leaky_relu
import torch import torch.nn as nn class Linear_leaky_relu(nn.Module): def __init__(self, dim_in, dim_out, bias=True): super().__init__() self.linear = nn.Linear(dim_in, dim_out, bias=bias) self.activation = nn.LeakyReLU() def forward(self, x): out = self.linear(x) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Armand-Morin/AutoML
Linear_leaky_relu
false
65
[ "MIT" ]
0
189867e2c7734d9afb87a9f51fd42bd6cc527a64
https://github.com/Armand-Morin/AutoML/tree/189867e2c7734d9afb87a9f51fd42bd6cc527a64
Conv2dBlock
import torch from torch import nn import torch.nn.functional as F class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
Arthur1511/CAD-COVID
Conv2dBlock
false
66
[ "MIT" ]
0
daab5d70b9f811da41f702e92179a15ca4809fa5
https://github.com/Arthur1511/CAD-COVID/tree/daab5d70b9f811da41f702e92179a15ca4809fa5
LinearBlock
import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamma = nn.Parame...
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...
Arthur1511/CAD-COVID
LinearBlock
false
67
[ "MIT" ]
0
daab5d70b9f811da41f702e92179a15ca4809fa5
https://github.com/Arthur1511/CAD-COVID/tree/daab5d70b9f811da41f702e92179a15ca4809fa5
Linear_sigmoid
import torch import torch.nn as nn class Linear_sigmoid(nn.Module): def __init__(self, dim_in, dim_out, bias=True): super().__init__() self.linear = nn.Linear(dim_in, dim_out, bias=bias) self.activation = nn.Sigmoid() def forward(self, x): out = self.linear(x) out = s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Armand-Morin/AutoML
Linear_sigmoid
false
68
[ "MIT" ]
0
189867e2c7734d9afb87a9f51fd42bd6cc527a64
https://github.com/Armand-Morin/AutoML/tree/189867e2c7734d9afb87a9f51fd42bd6cc527a64
BiAttention
import torch import torch.nn as nn import torch.utils.data import torch.nn.functional as F class BiAttention(nn.Module): def __init__(self, input_size, dropout): super().__init__() self.dropout = nn.Dropout(p=dropout) self.input_linear = nn.Linear(input_size, 1, bias=False) self.m...
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....
Angelinaa/KOBE
BiAttention
false
69
[ "MIT" ]
0
4d25487051e2791a977e59297f70a25e51806466
https://github.com/Angelinaa/KOBE/tree/4d25487051e2791a977e59297f70a25e51806466
Attention
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Anshul044/Project-NN
Attention
false
71
[ "MIT" ]
0
ef080846715a95b735f0381e4f60742e40791630
https://github.com/Anshul044/Project-NN/tree/ef080846715a95b735f0381e4f60742e40791630
MaxPool2dDynamicSamePadding
import math import torch from torch import 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, k...
import torch import triton import triton.language as tl from 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...
AustinCai/gmaxup-augmentation
MaxPool2dDynamicSamePadding
false
72
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
GroupScaling1D
import torch from torch import nn class GroupScaling1D(nn.Module): """Scales inputs by the second moment for the entire layer.""" def __init__(self, eps=1e-05, group_num=4): super(GroupScaling1D, self).__init__() self.eps = eps self.group_num = group_num def extra_repr(self): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Azerrroth/spacetimeformer
GroupScaling1D
false
73
[ "MIT" ]
0
e822444a6d696a1edb9e446d6f3482a70681be3c
https://github.com/Azerrroth/spacetimeformer/tree/e822444a6d696a1edb9e446d6f3482a70681be3c
adaModule
import math import torch from torch import Tensor import torch.nn as nn from torch.nn import Parameter class adaConv2d(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'int', stride: 'int'=1, padding: 'int'=0, dilation: 'int'=1, bias: 'bool'=True): supe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math i...
Artem531/pytorch-unet
adaModule
false
74
[ "MIT" ]
0
a8048f88f34a59f12f7f74735f03cf3c111a8415
https://github.com/Artem531/pytorch-unet/tree/a8048f88f34a59f12f7f74735f03cf3c111a8415
SppPooling
import torch import torch as t import torch.nn as nn class SppPooling(nn.Module): def __init__(self, levels=[1, 2, 4]): super(SppPooling, self).__init__() self.Pools = nn.ModuleList([nn.AdaptiveMaxPool2d((i, i)) for i in levels]) def forward(self, x): assert len(x.size())...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Asichurter/Few-Shot-Project
SppPooling
false
75
[ "MIT" ]
0
865cd6aa7b996c518dfa48dcc9ffad90445f9efe
https://github.com/Asichurter/Few-Shot-Project/tree/865cd6aa7b996c518dfa48dcc9ffad90445f9efe
SurfaceLoss
import torch import torch.nn as nn class SurfaceLoss(nn.Module): def __init__(self, epsilon=1e-05, softmax=True): super(SurfaceLoss, self).__init__() self.weight_map = [] def forward(self, x, distmap): x = torch.softmax(x, dim=1) self.weight_map = distmap score = x.fl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ArmandB/RITnet
SurfaceLoss
false
76
[ "MIT" ]
0
afe9524fdd795982c7e52761da68af2dfda589ea
https://github.com/ArmandB/RITnet/tree/afe9524fdd795982c7e52761da68af2dfda589ea
SmoothCrossEntropyLoss
from torch.nn import Module import torch from torch.nn.modules.module import Module def cross_entropy(input, target, size_average=True): """ Cross entropy that accepts soft targets Args: pred: predictions for neural network targets: targets, can be soft size_average: if false, sum 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.nn import M...
AustinCai/gmaxup-augmentation
SmoothCrossEntropyLoss
false
77
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
LayerNorm
import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamma = nn.Parame...
import torch import triton import triton.language 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...
Arthur1511/CAD-COVID
LayerNorm
false
78
[ "MIT" ]
0
daab5d70b9f811da41f702e92179a15ca4809fa5
https://github.com/Arthur1511/CAD-COVID/tree/daab5d70b9f811da41f702e92179a15ca4809fa5
Conv2dDynamicSamePadding
import math import torch from torch import 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_cha...
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...
AustinCai/gmaxup-augmentation
Conv2dDynamicSamePadding
false
79
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
CasualConv1d
import torch import torch.nn as nn class CasualConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True): super(CasualConv1d, self).__init__() self.dilation = dilation padding = dilation * (kernel_size - 1) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Asichurter/Few-Shot-Project
CasualConv1d
false
80
[ "MIT" ]
0
865cd6aa7b996c518dfa48dcc9ffad90445f9efe
https://github.com/Asichurter/Few-Shot-Project/tree/865cd6aa7b996c518dfa48dcc9ffad90445f9efe
DenseBlock
import torch import torch.nn as nn class CasualConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True): super(CasualConv1d, self).__init__() self.dilation = dilation padding = dilation * (kernel_size - 1) 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.triton_helpers import libdevice import torch.nn as ...
Asichurter/Few-Shot-Project
DenseBlock
false
81
[ "MIT" ]
0
865cd6aa7b996c518dfa48dcc9ffad90445f9efe
https://github.com/Asichurter/Few-Shot-Project/tree/865cd6aa7b996c518dfa48dcc9ffad90445f9efe
Block
import torch from torch import nn import torch.onnx class Block(nn.Module): def __init__(self, in_channels, num_filters, kernel_size, pool_size): super(Block, self).__init__() self.conv = nn.Conv2d(in_channels, num_filters, kernel_size=kernel_size ) self.pool = nn.MaxPool2d(ke...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
Alwaysproblem/examples-1
Block
false
82
[ "MIT" ]
0
9754fa63ed1931489a21ac1f5b299f945e369a5c
https://github.com/Alwaysproblem/examples-1/tree/9754fa63ed1931489a21ac1f5b299f945e369a5c
Bc
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.utils class Bc(nn.Module): def __init__(self, nc): super(Bc, self).__init__() self.nn = nn.Linear(nc, 1) def forward(self, input): return torch.sigmoid(self.nn(input)) def get_inputs():...
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.parallel import torch.utils.data import to...
AyufhSri/GANAccImprover
Bc
false
83
[ "MIT" ]
0
eff3a944bd6e5d9761ec815f28c0d32c87096308
https://github.com/AyufhSri/GANAccImprover/tree/eff3a944bd6e5d9761ec815f28c0d32c87096308
ATRCell
import torch import torch.nn as nn class ATRCell(nn.Module): def __init__(self, input_size, hidden_size): super(ATRCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self._W = nn.Parameter(torch.FloatTensor(input_size, hidden_size)) self._W_...
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 ...
Avmb/lm-robustness
ATRCell
false
84
[ "BSD-3-Clause" ]
0
b5417d9aac01bff0d2a56b506eabed899fd718d4
https://github.com/Avmb/lm-robustness/tree/b5417d9aac01bff0d2a56b506eabed899fd718d4
TimeEncode
import torch import numpy as np class TimeEncode(torch.nn.Module): def __init__(self, dimension): super(TimeEncode, self).__init__() self.dimension = dimension self.w = torch.nn.Linear(1, dimension) self.w.weight = torch.nn.Parameter(torch.from_numpy(1 / 10 ** np. lins...
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 numpy ...
Awannaphasch2016/tgn
TimeEncode
false
85
[ "Apache-2.0" ]
0
a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
https://github.com/Awannaphasch2016/tgn/tree/a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
LargeNN
import torch from torch import nn import torch.nn.functional as F class LargeNN(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.l1 = nn.Linear(in_channels, 1024) self.l2 = nn.Linear(1024, 1024) self.l3 = nn.Linear(1024, out_channels) def for...
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...
AustinCai/gmaxup-augmentation
LargeNN
false
86
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
LRNCell
import torch import torch.nn as nn class LRNCell(nn.Module): def __init__(self, input_size, hidden_size): super(LRNCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self._W = nn.Parameter(torch.FloatTensor(input_size, hidden_size * 3)) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Avmb/lm-robustness
LRNCell
false
87
[ "BSD-3-Clause" ]
0
b5417d9aac01bff0d2a56b506eabed899fd718d4
https://github.com/Avmb/lm-robustness/tree/b5417d9aac01bff0d2a56b506eabed899fd718d4
FeedForward
import torch import torch.nn as nn import torch.nn.functional as F class FeedForward(nn.Module): def __init__(self, d_model, d_ff=2048, dropout=0.1): super().__init__() self.linear_1 = nn.Linear(d_model, d_ff) self.dropout = nn.Dropout(dropout) self.linear_2 = nn.Linear(d_ff, d_mo...
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_...
AviVarma/torchASN-Transformer
FeedForward
false
88
[ "MIT" ]
0
55bccf4cdb099cd8e9ac99f5f87f989ce2add983
https://github.com/AviVarma/torchASN-Transformer/tree/55bccf4cdb099cd8e9ac99f5f87f989ce2add983
MergeLayer
import torch class MergeLayer(torch.nn.Module): def __init__(self, dim1, dim2, dim3, dim4): super().__init__() self.fc1 = torch.nn.Linear(dim1 + dim2, dim3) self.fc2 = torch.nn.Linear(dim3, dim4) self.act = torch.nn.ReLU() torch.nn.init.xavier_normal_(self.fc1.weight) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Awannaphasch2016/tgn
MergeLayer
false
89
[ "Apache-2.0" ]
0
a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
https://github.com/Awannaphasch2016/tgn/tree/a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
MLP
import torch class MLP(torch.nn.Module): def __init__(self, dim, drop=0.3): super().__init__() self.fc_1 = torch.nn.Linear(dim, 80) self.fc_2 = torch.nn.Linear(80, 10) self.fc_3 = torch.nn.Linear(10, 1) self.act = torch.nn.ReLU() self.dropout = torch.nn.Dropout(p=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 assert_size_stride = torch._C...
Awannaphasch2016/tgn
MLP
false
90
[ "Apache-2.0" ]
0
a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
https://github.com/Awannaphasch2016/tgn/tree/a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
DenseNet2D_up_block_concat
import torch import torch.nn as nn class DenseNet2D_up_block_concat(nn.Module): def __init__(self, skip_channels, input_channels, output_channels, up_stride, dropout=False, prob=0): super(DenseNet2D_up_block_concat, self).__init__() self.conv11 = nn.Conv2d(skip_channels + input_channels, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ArmandB/RITnet
DenseNet2D_up_block_concat
false
91
[ "MIT" ]
0
afe9524fdd795982c7e52761da68af2dfda589ea
https://github.com/ArmandB/RITnet/tree/afe9524fdd795982c7e52761da68af2dfda589ea
ScaleNorm
import torch from torch import nn class ScaleNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.scale = dim ** -0.5 self.g = nn.Parameter(torch.ones(1)) self.eps = eps def forward(self, x): n = torch.norm(x, dim=-1, keepdim=True).clamp(min=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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
Azerrroth/spacetimeformer
ScaleNorm
false
92
[ "MIT" ]
0
e822444a6d696a1edb9e446d6f3482a70681be3c
https://github.com/Azerrroth/spacetimeformer/tree/e822444a6d696a1edb9e446d6f3482a70681be3c
ShakeResNet
import math import torch from torch import nn import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.size(0)).uniform_() alp...
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 math from torch import...
AustinCai/gmaxup-augmentation
ShakeResNet
false
93
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
ShakeResNeXt
import math import torch from torch import nn import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.size(0)).uniform_() alp...
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 math from torch import...
AustinCai/gmaxup-augmentation
ShakeResNeXt
false
94
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
Norm
import torch import torch.nn as nn class Norm(nn.Module): def __init__(self, d_model, eps=1e-06): super().__init__() self.size = d_model self.alpha = nn.Parameter(torch.ones(self.size)) self.bias = nn.Parameter(torch.zeros(self.size)) self.eps = eps def forward(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AviVarma/torchASN-Transformer
Norm
false
95
[ "MIT" ]
0
55bccf4cdb099cd8e9ac99f5f87f989ce2add983
https://github.com/AviVarma/torchASN-Transformer/tree/55bccf4cdb099cd8e9ac99f5f87f989ce2add983
ConvBlock
import torch import torch.nn.functional as F class ConvBlock(torch.nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv2d = torch.nn.Conv2d(in_channels=in_channels, out_channels =out_channels, kernel_size=3, padding=1) self.batchnorm2d = torc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ArmandNM/meta-learning
ConvBlock
false
96
[ "MIT" ]
0
173fcd4b929168e9bd7948581293020a3a932857
https://github.com/ArmandNM/meta-learning/tree/173fcd4b929168e9bd7948581293020a3a932857
L2
import torch import torch.nn as nn class L2(nn.Module): def __init__(self): super(L2, self).__init__() def forward(self, output, target): lossvalue = torch.norm(output - target, p=2, dim=1).mean() return lossvalue def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
B06901052/deep-stabilization
L2
false
97
[ "Apache-2.0" ]
0
b6030b463cf1f1128660e900669f43e742aa2651
https://github.com/B06901052/deep-stabilization/tree/b6030b463cf1f1128660e900669f43e742aa2651
MLP_multiple_class
import torch class MLP_multiple_class(torch.nn.Module): def __init__(self, dim, n_labels, drop=0.3): super().__init__() self.fc_1 = torch.nn.Linear(dim, 80) self.fc_2 = torch.nn.Linear(80, 10) self.fc_3 = torch.nn.Linear(10, n_labels) self.act = torch.nn.ReLU() 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 assert_size_stride = torch._C...
Awannaphasch2016/tgn
MLP_multiple_class
false
98
[ "Apache-2.0" ]
0
a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
https://github.com/Awannaphasch2016/tgn/tree/a0eb4b4759cb44e053dfb6a825ccac1d54dba33f
L1
import torch import torch.nn as nn class L1(nn.Module): def __init__(self): super(L1, self).__init__() def forward(self, output, target): lossvalue = torch.abs(output - target).mean() return lossvalue def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
B06901052/deep-stabilization
L1
false
99
[ "Apache-2.0" ]
0
b6030b463cf1f1128660e900669f43e742aa2651
https://github.com/B06901052/deep-stabilization/tree/b6030b463cf1f1128660e900669f43e742aa2651
SmallNN
import torch from torch import nn import torch.nn.functional as F class SmallNN(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.l1 = nn.Linear(in_channels, 32) self.l2 = nn.Linear(32, 32) self.l3 = nn.Linear(32, out_channels) 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 import nn assert_s...
AustinCai/gmaxup-augmentation
SmallNN
false
100
[ "MIT" ]
0
a64ca0a76eb333e5ce6b217c301d27ca04d73bce
https://github.com/AustinCai/gmaxup-augmentation/tree/a64ca0a76eb333e5ce6b217c301d27ca04d73bce
LinearModel
import torch from torch import nn class LinearModel(nn.Module): def __init__(self, context_points: 'int'): super().__init__() self.window = context_points self.linear = nn.Linear(context_points, 1) def forward(self, y_c): _bs, _length, d_y = y_c.shape inp = y_c[:, -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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Azerrroth/spacetimeformer
LinearModel
false
101
[ "MIT" ]
0
e822444a6d696a1edb9e446d6f3482a70681be3c
https://github.com/Azerrroth/spacetimeformer/tree/e822444a6d696a1edb9e446d6f3482a70681be3c
AdMSoftmaxLoss
import torch import torch.nn as nn import torch.nn.functional as F class AdMSoftmaxLoss(nn.Module): def __init__(self, in_features, out_features, s=30.0, m=0.4): """ AM Softmax Loss """ super(AdMSoftmaxLoss, self).__init__() self.s = s self.m = m self.in_fe...
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....
B06901052/s3prl
AdMSoftmaxLoss
false
102
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
OutConv
import torch import torch.nn as nn class OutConv(nn.Module): def __init__(self, in_channels, out_channels): super(OutConv, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch....
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...
B06901052/deep-stabilization
OutConv
false
103
[ "Apache-2.0" ]
0
b6030b463cf1f1128660e900669f43e742aa2651
https://github.com/B06901052/deep-stabilization/tree/b6030b463cf1f1128660e900669f43e742aa2651
Follow_loss
import torch from torch.autograd import Variable def torch_norm_quat(quat, USE_CUDA=True): batch_size = quat.size()[0] quat_out = Variable(torch.zeros((batch_size, 4), requires_grad=True)) if USE_CUDA is True: quat_out = quat_out for i in range(batch_size): norm_quat = torch.norm(quat[...
import torch import triton import triton.language as tl from 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.autograd import Variable assert_size_stride = torch._C._dynamo.guards.assert_s...
B06901052/deep-stabilization
Follow_loss
false
104
[ "Apache-2.0" ]
0
b6030b463cf1f1128660e900669f43e742aa2651
https://github.com/B06901052/deep-stabilization/tree/b6030b463cf1f1128660e900669f43e742aa2651
Model
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, output_class_num, **kwargs): super(Model, self).__init__() self.linear = nn.Linear(input_dim, output_class_num) def forward(self, features): pooled = features.mean(dim=1) predicted = 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...
B06901052/s3prl
Model
false
105
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
ChannelNorm
import torch import torch.nn as nn class ChannelNorm(nn.Module): def __init__(self, numFeatures, epsilon=1e-05, affine=True): super(ChannelNorm, self).__init__() if affine: self.weight = nn.parameter.Parameter(torch.Tensor(1, numFeatures, 1)) self.bias = 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
B06901052/s3prl
ChannelNorm
false
106
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.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....
AviVarma/torchASN-Transformer
MultiHeadAttention
false
107
[ "MIT" ]
0
55bccf4cdb099cd8e9ac99f5f87f989ce2add983
https://github.com/AviVarma/torchASN-Transformer/tree/55bccf4cdb099cd8e9ac99f5f87f989ce2add983
GatedConv1d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch class MaskedConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation ...
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.parallel import torch.optim import torch a...
B0BBB/seq2seq.pytorch
GatedConv1d
false
108
[ "MIT" ]
0
54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
https://github.com/B0BBB/seq2seq.pytorch/tree/54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
LayerNorm1d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch class LayerNorm1d(nn.Module): def __init__(self, num_features, eps=1e-06, affine=True): super(LayerNorm1d, self).__init__() self.eps = eps self.num_features = num_features self.affine = aff...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.optim import torch ...
B0BBB/seq2seq.pytorch
LayerNorm1d
false
109
[ "MIT" ]
0
54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
https://github.com/B0BBB/seq2seq.pytorch/tree/54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
Focal_loss
import torch import torch.nn as nn class Focal_loss(nn.Module): """ Pytorch implementation from https://github.com/richardaecn/class-balanced-loss Compute the focal loss between `logits` and the ground truth `labels`. Focal loss = -alpha_t * (1-pt)^gamma * log(pt) where pt is the probability of be...
import torch import triton import triton.language as tl from 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...
BCV-Uniandes/SAMA
Focal_loss
false
110
[ "BSD-3-Clause" ]
0
4c732c71486af17efed17480e363298cb65c851f
https://github.com/BCV-Uniandes/SAMA/tree/4c732c71486af17efed17480e363298cb65c851f
ItemQueryAttention
import torch import torch as t import torch.nn as nn class ItemQueryAttention(nn.Module): """ 基于项的注意力机制。使用查询集序列对支持集的样本序列进行注意力对齐, 得到一个支持集样本的注意力上下文向量。由于注意力向量不依赖于RNN的 上下文向量,因此该注意力属于基于项的注意力,可以并行化处理 """ def __init__(self, feature_size, hidden_size): super(ItemQueryAttention, self).__init__...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Asichurter/Few-Shot-Project
ItemQueryAttention
false
111
[ "MIT" ]
0
865cd6aa7b996c518dfa48dcc9ffad90445f9efe
https://github.com/Asichurter/Few-Shot-Project/tree/865cd6aa7b996c518dfa48dcc9ffad90445f9efe
ChannelPool
import torch import torch.nn as nn class ChannelPool(nn.Module): def forward(self, x): return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1) .unsqueeze(1)), dim=1) 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...
BJTU-MIMO/Channel_estimation_MRDN
ChannelPool
false
112
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
AMSoftmaxLoss
import torch import torch.nn as nn import torch.nn.functional as F class AMSoftmaxLoss(nn.Module): def __init__(self, hidden_dim, speaker_num, s=30.0, m=0.4, **kwargs): """ AM Softmax Loss """ super(AMSoftmaxLoss, self).__init__() self.s = s self.m = m self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
B06901052/s3prl
AMSoftmaxLoss
false
113
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
MaskedConv1d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch class MaskedConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation ...
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.parallel import torch.optim import torch a...
B0BBB/seq2seq.pytorch
MaskedConv1d
false
114
[ "MIT" ]
0
54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
https://github.com/B0BBB/seq2seq.pytorch/tree/54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
GRUCell
import torch import torch.nn as nn class GRUCell(nn.Module): def __init__(self, input_size, hidden_size): super(GRUCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self._W = nn.Parameter(torch.FloatTensor(input_size + hidden_size, 2 *...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Avmb/lm-robustness
GRUCell
false
115
[ "BSD-3-Clause" ]
0
b5417d9aac01bff0d2a56b506eabed899fd718d4
https://github.com/Avmb/lm-robustness/tree/b5417d9aac01bff0d2a56b506eabed899fd718d4
Downsample
import torch import torch.nn as nn class Downsample(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv3d = nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=2, padding=1) self.bn1 = nn.InstanceNorm3d(out_channels, affine=True) ...
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....
BCV-Uniandes/SAMA
Downsample
false
116
[ "BSD-3-Clause" ]
0
4c732c71486af17efed17480e363298cb65c851f
https://github.com/BCV-Uniandes/SAMA/tree/4c732c71486af17efed17480e363298cb65c851f
AttentivePoolingModule
import torch import torch.nn as nn class AttentivePoolingModule(nn.Module): """ Implementation of Attentive Pooling """ def __init__(self, input_dim, activation='ReLU', **kwargs): super(AttentivePoolingModule, self).__init__() self.W_a = nn.Linear(input_dim, input_dim) self.W...
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....
B06901052/s3prl
AttentivePoolingModule
false
117
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
SDPAttention
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch import torch.nn.functional as F from torch.autograd import Variable class SDPAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0, causal=False): super(SDPAttention, ...
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....
B0BBB/seq2seq.pytorch
SDPAttention
false
118
[ "MIT" ]
0
54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
https://github.com/B0BBB/seq2seq.pytorch/tree/54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
SoftmaxLoss
import torch import torch.nn as nn class SoftmaxLoss(nn.Module): def __init__(self, hidden_dim, speaker_num, **kwargs): """ Softmax Loss """ super(SoftmaxLoss, self).__init__() self.fc = nn.Linear(hidden_dim, speaker_num) self.loss = nn.CrossEntropyLoss() def ...
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....
B06901052/s3prl
SoftmaxLoss
false
119
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
make_residual_dense_ver1
import torch import torch.nn as nn import torch.nn.functional as F class make_residual_dense_ver1(nn.Module): def __init__(self, nChannels, nChannels_, growthRate, kernel_size=3): super(make_residual_dense_ver1, self).__init__() self.conv = nn.Conv2d(nChannels_, growthRate, 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 import torch.nn as nn assert_...
BJTU-MIMO/Channel_estimation_MRDN
make_residual_dense_ver1
false
120
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
SelfAttentionPooling
import torch import torch.nn as nn class SelfAttentionPooling(nn.Module): """ Implementation of SelfAttentionPooling Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition https://arxiv.org/pdf/2008.01077v1.pdf """ def __init__(self, input_dim): super(SelfAttenti...
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....
B06901052/s3prl
SelfAttentionPooling
false
121
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
AP
import torch import torch.nn as nn class AttentivePooling(nn.Module): """ Implementation of Attentive Pooling """ def __init__(self, input_dim, **kwargs): super(AttentivePooling, self).__init__() self.W_a = nn.Linear(input_dim, input_dim) self.W = nn.Linear(input_dim, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
B06901052/s3prl
AP
false
122
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
SAP
import torch import torch.nn as nn class SelfAttentionPooling(nn.Module): """ Implementation of SelfAttentionPooling Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition https://arxiv.org/pdf/2008.01077v1.pdf """ def __init__(self, input_dim): super(SelfAttenti...
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....
B06901052/s3prl
SAP
false
123
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
Upsample
import torch import torch.nn as nn class Upsample(nn.Module): def __init__(self, in_channels, out_channels, scale_factor=2): super().__init__() self.trilinear = nn.Upsample(scale_factor=scale_factor) self.conv1 = nn.Conv3d(in_channels, out_channels, kernel_size=1) self.bn1 = nn.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....
BCV-Uniandes/SAMA
Upsample
false
124
[ "BSD-3-Clause" ]
0
4c732c71486af17efed17480e363298cb65c851f
https://github.com/BCV-Uniandes/SAMA/tree/4c732c71486af17efed17480e363298cb65c851f
BasicConv
import torch import torch.nn as nn class BasicConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=False, bn=False, bias=True): super(BasicConv, self).__init__() self.out_channels = out_planes self.conv = nn.Conv2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
BJTU-MIMO/Channel_estimation_MRDN
BasicConv
false
125
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
AttentionModuleV2
import math import torch import torch.nn.functional as F class AttentionModuleV2(torch.nn.Module): def __init__(self, hidden_size, fc_x_query=None, fc_spt_key=None, fc_spt_value=None, fc_x_update=None, fc_update=None, fc_spt_spt_query=None, fc_spt_spt_key=None, fc_spt_spt_value=None, gamm...
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....
ArmandNM/meta-learning
AttentionModuleV2
false
126
[ "MIT" ]
0
173fcd4b929168e9bd7948581293020a3a932857
https://github.com/ArmandNM/meta-learning/tree/173fcd4b929168e9bd7948581293020a3a932857
make_dense
import torch import torch.nn as nn import torch.nn.functional as F class make_dense(nn.Module): def __init__(self, nChannels, nChannels_, growthRate, kernel_size=3): super(make_dense, self).__init__() self.conv = nn.Conv2d(nChannels_, growthRate, kernel_size= kernel_size, padding=(ker...
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_...
BJTU-MIMO/Channel_estimation_MRDN
make_dense
false
127
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
Scale_and_shift
import torch import torch.nn as nn class Scale_and_shift(nn.Module): def __init__(self): super().__init__() self.weight = nn.Parameter(torch.rand(1)) self.bias = nn.Parameter(torch.zeros(1)) def forward(self, x): return self.weight * x + self.bias def get_inputs(): retu...
import torch import 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...
BCV-Uniandes/SAMA
Scale_and_shift
false
128
[ "BSD-3-Clause" ]
0
4c732c71486af17efed17480e363298cb65c851f
https://github.com/BCV-Uniandes/SAMA/tree/4c732c71486af17efed17480e363298cb65c851f
make_residual_dense_ver2
import torch import torch.nn as nn import torch.nn.functional as F class make_residual_dense_ver2(nn.Module): def __init__(self, nChannels, nChannels_, growthRate, kernel_size=3): super(make_residual_dense_ver2, self).__init__() if nChannels == nChannels_: self.conv = nn.Conv2d(nChann...
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_...
BJTU-MIMO/Channel_estimation_MRDN
make_residual_dense_ver2
false
129
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
DDPG
import torch from torch import nn from torch.nn import functional as F class Value_Net(nn.Module): def __init__(self, observation_dim, action_dim): super(Value_Net, self).__init__() self.fc1 = nn.Linear(observation_dim + action_dim, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = 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....
BLUECARVIN/RL_baseline
DDPG
false
130
[ "MIT" ]
0
436538f49ee505e14672a67ba3c1f60886cbbea8
https://github.com/BLUECARVIN/RL_baseline/tree/436538f49ee505e14672a67ba3c1f60886cbbea8
Cell
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, conv, in_channels, out_channels): super().__init__() self.conv_type = conv self.relu = nn.ReLU(inplace=True) if self.conv_type == 'conv2d': self.conv2d = nn.Conv3d(in_channels, out_channels, s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
BCV-Uniandes/SAMA
Cell
false
131
[ "BSD-3-Clause" ]
0
4c732c71486af17efed17480e363298cb65c851f
https://github.com/BCV-Uniandes/SAMA/tree/4c732c71486af17efed17480e363298cb65c851f
ResizeConv1d
import torch import torch.nn as nn from torch.nn import functional as F class ResizeConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, scale_factor, mode='nearest'): super().__init__() self.scale_factor = scale_factor self.mode = mode 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...
BalintHompot/uncertainty
ResizeConv1d
false
132
[ "Apache-2.0" ]
0
544c6c5cf22464d69316a31f97fc87355cd10b7e
https://github.com/BalintHompot/uncertainty/tree/544c6c5cf22464d69316a31f97fc87355cd10b7e
Mish
import torch from torch import nn class Mish(nn.Module): """Mish activation.""" def forward(self, x): return x * torch.tanh(nn.functional.softplus(x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.gua...
Benjamin-Etheredge/lightning-bolts
Mish
false
133
[ "Apache-2.0" ]
0
1971d6a924729940b98793aa7751bdf769350aca
https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca
ASP
import torch import torch.nn as nn class AttentivePooling(nn.Module): """ Implementation of Attentive Pooling """ def __init__(self, input_dim, **kwargs): super(AttentivePooling, self).__init__() self.W_a = nn.Linear(input_dim, input_dim) self.W = nn.Linear(input_dim, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
B06901052/s3prl
ASP
false
134
[ "MIT" ]
0
5f63d2df043d2d7c81580cd042fa2cea34746f48
https://github.com/B06901052/s3prl/tree/5f63d2df043d2d7c81580cd042fa2cea34746f48
Policy_Net
import torch from torch import nn from torch.nn import functional as F class Policy_Net(nn.Module): def __init__(self, observation_dim, action_dim): super(Policy_Net, self).__init__() self.fc1 = nn.Linear(observation_dim, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(25...
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....
BLUECARVIN/RL_baseline
Policy_Net
false
135
[ "MIT" ]
0
436538f49ee505e14672a67ba3c1f60886cbbea8
https://github.com/BLUECARVIN/RL_baseline/tree/436538f49ee505e14672a67ba3c1f60886cbbea8
Value_Net
import torch from torch import nn from torch.nn import functional as F class Value_Net(nn.Module): def __init__(self, observation_dim, action_dim): super(Value_Net, self).__init__() self.fc1 = nn.Linear(observation_dim + action_dim, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = 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 import nn assert_s...
BLUECARVIN/RL_baseline
Value_Net
false
136
[ "MIT" ]
0
436538f49ee505e14672a67ba3c1f60886cbbea8
https://github.com/BLUECARVIN/RL_baseline/tree/436538f49ee505e14672a67ba3c1f60886cbbea8
make_dense_LReLU
import torch import torch.nn as nn import torch.nn.functional as F class make_dense_LReLU(nn.Module): def __init__(self, nChannels, growthRate, kernel_size=3): super(make_dense_LReLU, self).__init__() self.conv = nn.Conv2d(nChannels, growthRate, kernel_size= kernel_size, padding=(kern...
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...
BJTU-MIMO/Channel_estimation_MRDN
make_dense_LReLU
false
137
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
AmdimNCELoss
import torch from torch import nn def tanh_clip(x, clip_val=10.0): """soft clip values to the range [-clip_val, +clip_val]""" if clip_val is not None: x_clip = clip_val * torch.tanh(1.0 / clip_val * x) else: x_clip = x return x_clip class AmdimNCELoss(nn.Module): """Compute the 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....
Benjamin-Etheredge/lightning-bolts
AmdimNCELoss
false
138
[ "Apache-2.0" ]
0
1971d6a924729940b98793aa7751bdf769350aca
https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca
SpatialGate
import torch import torch.nn as nn import torch.nn.functional as F class BasicConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=False, bn=False, bias=True): super(BasicConv, self).__init__() self.out_channels = out_plan...
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_...
BJTU-MIMO/Channel_estimation_MRDN
SpatialGate
false
139
[ "MIT" ]
0
f41972998a5403c901bc3e5d68d4acd05e9a7f6c
https://github.com/BJTU-MIMO/Channel_estimation_MRDN/tree/f41972998a5403c901bc3e5d68d4acd05e9a7f6c
BayesLinear
import math import torch import torch.nn as nn from torch.nn import functional as F from torch.nn import init def calculate_kl(mu_p, sig_p, mu_q, sig_q): """ Calculates the Kullback-Leibler divergence between two univariate Gaussians (p and q) Args: mu_p: mean of the Gaussian p sig_p: sta...
import torch from torch import device 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 libd...
BalintHompot/uncertainty
BayesLinear
false
140
[ "Apache-2.0" ]
0
544c6c5cf22464d69316a31f97fc87355cd10b7e
https://github.com/BalintHompot/uncertainty/tree/544c6c5cf22464d69316a31f97fc87355cd10b7e
MinPool
import torch import torch.nn as nn import torch.nn class MinPool(nn.Module): """Use nn.MaxPool to implement MinPool """ def __init__(self, kernel_size, ndim=3, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False): super(MinPool, self).__init__() self.pool = g...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert...
BeautyOfWeb/OPP_Analysis
MinPool
false
141
[ "MIT" ]
0
59b2dbc91e07fc14b3a130bff6fadaa19cd36b42
https://github.com/BeautyOfWeb/OPP_Analysis/tree/59b2dbc91e07fc14b3a130bff6fadaa19cd36b42
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): super(QNetwork, self).__init__() self.seed = torch.manual_seed(seed) hidden_units = 512 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_...
BenKang34/deep-reinforcement-learning-nanodegree
QNetwork
false
142
[ "MIT" ]
0
17c9007f757dfb1217c869fdee51798c4a21ba92
https://github.com/BenKang34/deep-reinforcement-learning-nanodegree/tree/17c9007f757dfb1217c869fdee51798c4a21ba92
SELoss
import torch from torch import Tensor from torch import nn class SELoss(nn.MSELoss): def __init__(self): super().__init__(reduction='none') def forward(self, inputs: 'Tensor', target: 'Tensor') ->Tensor: return super().forward(inputs, target).sum(1) def get_inputs(): return [torch.rand...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Benjamin-Etheredge/lightning-bolts
SELoss
false
143
[ "Apache-2.0" ]
0
1971d6a924729940b98793aa7751bdf769350aca
https://github.com/Benjamin-Etheredge/lightning-bolts/tree/1971d6a924729940b98793aa7751bdf769350aca
BayesConv1d
import math import torch import torch.nn as nn from torch.nn import functional as F from torch.nn import init def calculate_kl(mu_p, sig_p, mu_q, sig_q): """ Calculates the Kullback-Leibler divergence between two univariate Gaussians (p and q) Args: mu_p: mean of the Gaussian p sig_p: sta...
import torch from torch import device 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...
BalintHompot/uncertainty
BayesConv1d
false
144
[ "Apache-2.0" ]
0
544c6c5cf22464d69316a31f97fc87355cd10b7e
https://github.com/BalintHompot/uncertainty/tree/544c6c5cf22464d69316a31f97fc87355cd10b7e
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
BenKang34/deep-reinforcement-learning-nanodegree
Actor
false
145
[ "MIT" ]
0
17c9007f757dfb1217c869fdee51798c4a21ba92
https://github.com/BenKang34/deep-reinforcement-learning-nanodegree/tree/17c9007f757dfb1217c869fdee51798c4a21ba92
Conv2dTime
import torch import torch.nn as nn class Conv2dTime(nn.Conv2d): """ Implements time dependent 2d convolutions, by appending the time variable as an extra channel. """ def __init__(self, in_channels, *args, **kwargs): super(Conv2dTime, self).__init__(in_channels + 1, *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...
BeeQC/ANODE-reproducibility
Conv2dTime
false
146
[ "MIT" ]
0
9d6b5a297302cdaa0bbc3908de1a94f3c28c0606
https://github.com/BeeQC/ANODE-reproducibility/tree/9d6b5a297302cdaa0bbc3908de1a94f3c28c0606
AttentionLayer
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch import torch.nn.functional as F class AttentionLayer(nn.Module): """ Attention layer according to https://arxiv.org/abs/1409.0473. Params: num_units: Number of units used in the attention layer """ ...
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....
B0BBB/seq2seq.pytorch
AttentionLayer
false
147
[ "MIT" ]
0
54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4
https://github.com/B0BBB/seq2seq.pytorch/tree/54bb0e9f3e5c7db7f257841ed652e8ff447b8ee4