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 |
|---|---|---|---|---|---|---|---|---|---|---|
PyramidUp | import torch
import torch.nn as nn
from torch.nn import functional as F
class PyramidUp(nn.Module):
def __init__(self) ->None:
super(PyramidUp, self).__init__()
self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16,
24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 4], [1, 4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | masanorihirano/pytorch_extra_mhirano | PyramidUp | false | 7,171 | [
"MIT"
] | 1 | d19e07445567c069793b7ca1a22a846d7cbce58d | https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d |
ComprehensionLayer_step2 | import math
import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout=0.0):
super(ScaledDotProductAttention, self).__init__()
self.dropout = nn.Dropout(dropout)
def forward(self, query, key, value):
assert query.size()[-1] == key.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.... | luyu-fan/LRCM | ComprehensionLayer_step2 | false | 7,172 | [
"MIT"
] | 1 | 6b0e4d7998bc4969afa764eb753077e3f858f1ba | https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba |
ClassHead | import torch
import torch.nn as nn
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,
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | lurenjia307/RetinaPedestrian_Pytorch | ClassHead | false | 7,173 | [
"MIT"
] | 1 | 59c4aa50f3ef2ecb1113ad3b9950e8bbbff1206f | https://github.com/lurenjia307/RetinaPedestrian_Pytorch/tree/59c4aa50f3ef2ecb1113ad3b9950e8bbbff1206f |
LaplacianPyramidLayer | import torch
from typing import Tuple
import torch.nn as nn
from torch.nn import functional as F
class PyramidDown(nn.Module):
def __init__(self) ->None:
super(PyramidDown, self).__init__()
self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16,
24, 16, 4], [6, 24, 36, 24, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 torch.nn import functional as F
assert_size_stride = ... | masanorihirano/pytorch_extra_mhirano | LaplacianPyramidLayer | false | 7,174 | [
"MIT"
] | 1 | d19e07445567c069793b7ca1a22a846d7cbce58d | https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d |
ActorNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ActorNet(nn.Module):
def __init__(self):
super(ActorNet, self).__init__()
self.fc1 = nn.Linear(4, 20)
self.fc2 = nn.Linear(20, 40)
self.fc3 = nn.Linear(40, 50)
self.fc4 = nn.Linear(50, 30)
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... | mathildebadoual/RL_power_systems | ActorNet | false | 7,175 | [
"MIT"
] | 1 | 825e60bad16129e0a0229d15af5110b26e0a1577 | https://github.com/mathildebadoual/RL_power_systems/tree/825e60bad16129e0a0229d15af5110b26e0a1577 |
MyKernelTorch | import torch
import torch.nn as nn
class MyKernelTorch(nn.Module):
def __init__(self, n_features: 'int'):
super().__init__()
self.dense1 = nn.Linear(n_features, 20)
self.dense2 = nn.Linear(20, 2)
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
x = nn.ReLU()(self.dense1(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_... | maxpark/alibi-detect | MyKernelTorch | false | 7,176 | [
"Apache-2.0"
] | 1 | 84384297a85764c18537aa1c8699c4ad040cf7cd | https://github.com/maxpark/alibi-detect/tree/84384297a85764c18537aa1c8699c4ad040cf7cd |
ResidualConnection | import torch
import torch.nn as nn
class ResidualConnection(nn.Module):
def __init__(self, *layers):
super(ResidualConnection, self).__init__()
self.layers = nn.Sequential(*layers)
def forward(self, input):
return (input + self.layers(input)) / 2.0
def get_inputs():
return [tor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | maxkvant/LinearizedNNs | ResidualConnection | false | 7,177 | [
"Apache-2.0"
] | 1 | eb0198be70ca55e7463b97a5023d2f6ffe0f8ba6 | https://github.com/maxkvant/LinearizedNNs/tree/eb0198be70ca55e7463b97a5023d2f6ffe0f8ba6 |
NormalizeImages | import torch
import torch.nn as nn
class NormalizeImages(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
flat = x.view(x.size(0), -1)
mp = torch.mean(flat, dim=1)
sp = torch.std(flat, dim=1) + 1e-07
return (x - mp.detach().unsqueeze(-1).unsque... | 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_... | matteo-ronchetti/IKA | NormalizeImages | false | 7,178 | [
"MIT"
] | 1 | 29d1752a059c3ab7659b332b72bf8c1506e7dd20 | https://github.com/matteo-ronchetti/IKA/tree/29d1752a059c3ab7659b332b72bf8c1506e7dd20 |
SoftmaxAttention | import torch
import torch.nn as nn
def masked_softmax(tensor, mask):
"""
Apply a masked softmax on the last dimension of a tensor.
The input tensor and mask should be of size (batch, *, sequence_length).
Args:
tensor: The tensor on which the softmax function must be applied along
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | marvosyntactical/fs2018ex3viz | SoftmaxAttention | false | 7,179 | [
"Apache-2.0"
] | 1 | 9002133a45b52c596efa91d842f691fe1f066a6c | https://github.com/marvosyntactical/fs2018ex3viz/tree/9002133a45b52c596efa91d842f691fe1f066a6c |
_leaky_relu | import torch
from torch import nn
class _leaky_relu(nn.Module):
def __init__(self):
super(_leaky_relu, self).__init__()
def forward(self, x):
x_neg = 0.1 * x
return torch.max(x_neg, x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | maxuanquang/SfmLearner-Redesign | _leaky_relu | false | 7,180 | [
"MIT"
] | 1 | 0250a9cc443b5754ba45f69153a03ca26f903a7b | https://github.com/maxuanquang/SfmLearner-Redesign/tree/0250a9cc443b5754ba45f69153a03ca26f903a7b |
CriticNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class CriticNet(nn.Module):
def __init__(self):
super(CriticNet, self).__init__()
self.fc1 = nn.Linear(4, 20)
self.fc2 = nn.Linear(20, 40)
self.fc3 = nn.Linear(40, 30)
self.fc4 = nn.Linear(30, 8)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | mathildebadoual/RL_power_systems | CriticNet | false | 7,181 | [
"MIT"
] | 1 | 825e60bad16129e0a0229d15af5110b26e0a1577 | https://github.com/mathildebadoual/RL_power_systems/tree/825e60bad16129e0a0229d15af5110b26e0a1577 |
ZeroConv2d | import torch
from torch import nn
from torch.nn import functional as F
class ZeroConv2d(nn.Module):
def __init__(self, in_channel, out_channel, padding=1):
super().__init__()
self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0)
self.conv.weight.data.zero_()
self.conv.bias.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | mbaddar1/glow-pytorch | ZeroConv2d | false | 7,182 | [
"MIT"
] | 1 | e07ca542ce4dd93ddf680c51eda25d1f9db252a1 | https://github.com/mbaddar1/glow-pytorch/tree/e07ca542ce4dd93ddf680c51eda25d1f9db252a1 |
BasicGraphConvolutionLayer | import torch
from torch.nn.parameter import Parameter
class BasicGraphConvolutionLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.W2 = Parameter(torch.rand((in_channels, o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.g... | mbrukman/machine-learning-book | BasicGraphConvolutionLayer | false | 7,183 | [
"MIT"
] | 1 | f29a0f8aafa63a77081f3bcec68866e33dd41776 | https://github.com/mbrukman/machine-learning-book/tree/f29a0f8aafa63a77081f3bcec68866e33dd41776 |
InvConv2d | import torch
from torch import nn
from torch.nn import functional as F
class InvConv2d(nn.Module):
def __init__(self, in_channel):
super().__init__()
weight = torch.randn(in_channel, in_channel)
q, _ = torch.qr(weight)
weight = q.unsqueeze(2).unsqueeze(3)
self.weight = 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 import nn
from torch.nn import functional as F
assert_size_stride = t... | mbaddar1/glow-pytorch | InvConv2d | false | 7,184 | [
"MIT"
] | 1 | e07ca542ce4dd93ddf680c51eda25d1f9db252a1 | https://github.com/mbaddar1/glow-pytorch/tree/e07ca542ce4dd93ddf680c51eda25d1f9db252a1 |
ScaledDotProductAttention | import torch
import torch.optim.lr_scheduler
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, d_model, attention_dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temper = d_model ** 0.5
self.dropout = nn.Dropout(attention_dropout)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mcoavoux/self-attentive-parser | ScaledDotProductAttention | false | 7,185 | [
"MIT"
] | 1 | fa5814ecfdbf4fde329ea725e1d2ddaa55f247d6 | https://github.com/mcoavoux/self-attentive-parser/tree/fa5814ecfdbf4fde329ea725e1d2ddaa55f247d6 |
LayerNorm | import torch
import torch.multiprocessing
from torch import nn
from torch.nn import functional as F
import torch.optim
import torch.utils.data
import torch.distributed
class LayerNorm(nn.Module):
def __init__(self, channels: 'int', eps: 'float'=1e-05):
super().__init__()
self.channels = channels
... | 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.multiprocessing
from torch import nn
import torch.optim
import tor... | mbarnig/vits-train | LayerNorm | false | 7,186 | [
"MIT"
] | 1 | cfb8a0fc91daad868fe3d062ebf85d62edbd7506 | https://github.com/mbarnig/vits-train/tree/cfb8a0fc91daad868fe3d062ebf85d62edbd7506 |
AvgPoolShortening | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class AvgPoolShortening(Module):
"""
### Average pool shortening
This down-samples by a given factor with average pooling
"""
def __init__(self, k: 'int'):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride... | mcx/annotated_deep_learning_paper_implementations | AvgPoolShortening | false | 7,187 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
AttentionNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.functional
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_, out):
super().__init__()
self.conv = conv3x3(in_, out)
self.activation = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | lvxiuwang/ferattention | AttentionNet | false | 7,188 | [
"MIT"
] | 1 | 02e97df4a12129ed6706bddf0d2109650eae8765 | https://github.com/lvxiuwang/ferattention/tree/02e97df4a12129ed6706bddf0d2109650eae8765 |
MaxPool3x3 | import torch
import torch.nn as nn
import torch.utils.data
class MaxPool3x3(nn.Module):
"""3x3 max pool with no subsampling."""
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1):
super(MaxPool3x3, self).__init__()
self.maxpool = nn.MaxPool2d(kernel_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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | mc-nya/unnas | MaxPool3x3 | false | 7,189 | [
"MIT"
] | 1 | f778bb743144cf56ce2a48ccca20e9f3a97a7b84 | https://github.com/mc-nya/unnas/tree/f778bb743144cf56ce2a48ccca20e9f3a97a7b84 |
MultiHeadAttention | import math
import torch
import typing
import torch.multiprocessing
from torch import nn
from torch.nn import functional as F
import torch.optim
import torch.utils.data
import torch.distributed
class MultiHeadAttention(nn.Module):
def __init__(self, channels: 'int', out_channels: 'int', n_heads: 'int',
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mbarnig/vits-train | MultiHeadAttention | false | 7,190 | [
"MIT"
] | 1 | cfb8a0fc91daad868fe3d062ebf85d62edbd7506 | https://github.com/mbarnig/vits-train/tree/cfb8a0fc91daad868fe3d062ebf85d62edbd7506 |
ChannelNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ChannelNorm(Module):
"""
## Channel Normalization
This is similar to [Group Normalization](../group_norm/index.html) but affine transform is done group wise.
""... | 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.nn import Module
from torch import nn
import torch.utils.data
import... | mcx/annotated_deep_learning_paper_implementations | ChannelNorm | false | 7,191 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
NodeNetwork | import torch
import torch.nn.functional as F
from torch.nn.parameter import Parameter
def global_sum_pool(X, batch_mat):
if batch_mat is None or batch_mat.dim() == 1:
return torch.sum(X, dim=0).unsqueeze(0)
else:
return torch.mm(batch_mat, X)
class BasicGraphConvolutionLayer(torch.nn.Module)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mbrukman/machine-learning-book | NodeNetwork | false | 7,192 | [
"MIT"
] | 1 | f29a0f8aafa63a77081f3bcec68866e33dd41776 | https://github.com/mbrukman/machine-learning-book/tree/f29a0f8aafa63a77081f3bcec68866e33dd41776 |
FFN | import torch
import typing
import torch.multiprocessing
from torch import nn
from torch.nn import functional as F
import torch.optim
import torch.utils.data
import torch.distributed
class FFN(nn.Module):
def __init__(self, in_channels: 'int', out_channels: 'int',
filter_channels: 'int', kernel_size: 'int... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import typing
import torch.mu... | mbarnig/vits-train | FFN | false | 7,193 | [
"MIT"
] | 1 | cfb8a0fc91daad868fe3d062ebf85d62edbd7506 | https://github.com/mbarnig/vits-train/tree/cfb8a0fc91daad868fe3d062ebf85d62edbd7506 |
DiscriminatorLoss | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class DiscriminatorLoss(Module):
"""
## Discriminator Loss
We want to find $w$ to maximize
$$\\mathbb{E}_{x \\sim \\mathbb{P}_r} [f_w(x)]- \\mathbb{E}_{z \... | 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.nn import Module
import torch.utils.data
import torch.nn.functional
import tor... | mcx/annotated_deep_learning_paper_implementations | DiscriminatorLoss | false | 7,194 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
Model | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Model, self).__init__()
self.layer1 = nn.Linear(input_size, hidden_size)
self.layer2 = nn.Linear(hidden_size, output_size)
def forward(self, x):
x = 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.... | mbrukman/machine-learning-book | Model | false | 7,195 | [
"MIT"
] | 1 | f29a0f8aafa63a77081f3bcec68866e33dd41776 | https://github.com/mbrukman/machine-learning-book/tree/f29a0f8aafa63a77081f3bcec68866e33dd41776 |
ClippedValueFunctionLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ClippedValueFunctionLoss(Module):
"""
## Clipped Value Function Loss
Similarly we clip the value function update also.
egin{align}
V^{\\pi_ heta}_{CLIP}(s_t)
&= clip\\Big... | 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.nn import Module
import torch.utils.data
import torch.nn.functional
import tor... | mcx/annotated_deep_learning_paper_implementations | ClippedValueFunctionLoss | false | 7,196 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
CrossEntropyBayesRisk | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class CrossEntropyBayesRisk(Module):
"""
<a id="CrossEntropyBayesRisk"></a>
## Bayes Risk with Cross Entropy Loss
Bayes risk is the overall maximum cost of making incorrect estimates.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride = torch._C._dynamo.g... | mcx/annotated_deep_learning_paper_implementations | CrossEntropyBayesRisk | false | 7,197 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
DPFP | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class DPFP(Module):
"""
## Deterministic Parameter Free Project (DPFP)
This is the new projection function $ extcolor{lightgreen}{\\phi}$ introduced in the paper.
DPF... | 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.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.... | mcx/annotated_deep_learning_paper_implementations | DPFP | false | 7,198 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
KLDivLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class KLDivLoss(Module):
"""
## KL-Divergence loss
This calculates the KL divergence between a given normal distribution and $\\mathcal{N}(0, 1)$
"""
def forward(self, sigma_hat: 'to... | 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... | mcx/annotated_deep_learning_paper_implementations | KLDivLoss | false | 7,199 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
MaximumLikelihoodLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MaximumLikelihoodLoss(Module):
"""
<a id="MaximumLikelihoodLoss"></a>
## Type II Maximum Likelihood Loss
The distribution $D(\\mathbf{p} ert extcolor{orange}{\\mathbf{lpha}})$ 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.triton_helpers import math as tl_math
from torch.nn import Module
import torch.utils.data
import torch.nn.funct... | mcx/annotated_deep_learning_paper_implementations | MaximumLikelihoodLoss | false | 7,200 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
FCVAE | import torch
from torch.nn import functional as F
from torch import nn
class BaseVAE(nn.Module):
"""
Base abstract class for the Variational Autoencoders
"""
def __init__(self, channels=1, width=28, height=28, z_dim=2):
"""
Constructor
Parameters:
channels - The n... | 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... | mbusy/vae | FCVAE | false | 7,201 | [
"MIT"
] | 1 | 455e382a557b72fc944460331e5dd010ff83a76a | https://github.com/mbusy/vae/tree/455e382a557b72fc944460331e5dd010ff83a76a |
PatchEmbeddings | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class PatchEmbeddings(Module):
"""
<a id="PatchEmbeddings"></a>
## Get patch embeddings
The paper splits the image into patches of equal size and do a linear transfo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 import nn
import torch.utils.data
import ... | mcx/annotated_deep_learning_paper_implementations | PatchEmbeddings | false | 7,202 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
LearnedPositionalEmbeddings | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class LearnedPositionalEmbeddings(Module):
"""
<a id="LearnedPositionalEmbeddings"></a>
## Add parameterized positional encodings
This adds learned positional embedd... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride... | mcx/annotated_deep_learning_paper_implementations | LearnedPositionalEmbeddings | false | 7,203 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
LSTMCell | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class LSTMCell(Module):
"""
## Long Short-Term Memory Cell
LSTM Cell computes $c$, and $h$. $c$ is like the long-term memory,
and $h$ is like the short term memory.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.nn impor... | mcx/annotated_deep_learning_paper_implementations | LSTMCell | false | 7,204 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
SquaredReLU | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SquaredReLU(Module):
"""
## Squared ReLU activation
$$y = {\\max(x, 0)}^2$$
Squared ReLU is used as the activation function in the
[position wise feedforw... | 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.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.... | mcx/annotated_deep_learning_paper_implementations | SquaredReLU | false | 7,205 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
MarginLoss | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MarginLoss(Module):
'\n ## Margin loss for class existence\n\n A separate margin loss is used for each output capsule and the total loss is the sum of them.... | 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.nn import Module
... | mcx/annotated_deep_learning_paper_implementations | MarginLoss | false | 7,206 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
Squash | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Squash(Module):
'\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2}{1 + {\\lVert \\math... | 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.nn import Module
import torch.utils.data
import torch.nn.functional
... | mcx/annotated_deep_learning_paper_implementations | Squash | false | 7,207 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
FeedForward | import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class FeedForward(nn.Module):
"""
### Position-wise Feed Forward Layer $ ext{F\\small{FW}}$
This consists of two linear layers and an activation in the middle.
"""
def __init__(self, d_mode... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mcx/annotated_deep_learning_paper_implementations | FeedForward | false | 7,208 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
BehaviorClone | import torch
import torch.nn as nn
import torch.nn.functional as F
class BehaviorClone(nn.Module):
def __init__(self, input_shape, output_shape):
super(BehaviorClone, self).__init__()
self.input_shape = input_shape
self.output_shape = output_shape
self.fc1 = nn.Linear(input_shape,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | mdiephuis/Berkeley-cs294-112 | BehaviorClone | false | 7,209 | [
"MIT"
] | 1 | 99559e046b635ca8d229f19ca4ad45c2c02a1c01 | https://github.com/mdiephuis/Berkeley-cs294-112/tree/99559e046b635ca8d229f19ca4ad45c2c02a1c01 |
SpatialDepthWiseConvolution | from torch.nn import Module
import math
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SpatialDepthWiseConvolution(Module):
"""
## Spatial Depth Wise Convolution
This is actually slower
"""
def __init__(self, d_k: 'int', kernel_si... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert... | mcx/annotated_deep_learning_paper_implementations | SpatialDepthWiseConvolution | false | 7,210 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
KLDivergenceLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class KLDivergenceLoss(Module):
"""
<a id="KLDivergenceLoss"></a>
## KL Divergence Regularization Loss
This tries to shrink the total evidence to zero if the sample cannot be correctly 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.triton_helpers import libdevice
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
... | mcx/annotated_deep_learning_paper_implementations | KLDivergenceLoss | false | 7,211 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
SpatialDepthWisePerHeadConvolution | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SpatialDepthWisePerHeadConvolution(Module):
"""
## Spatial Depth Wise Per Head Convolution
"""
def __init__(self, heads: 'int', d_k: 'int', kernel_size: 'int'=3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 import nn
import torch.utils.data
import ... | mcx/annotated_deep_learning_paper_implementations | SpatialDepthWisePerHeadConvolution | false | 7,212 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
SpatialDepthWiseSharedConvolution | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SpatialDepthWiseSharedConvolution(Module):
"""
## Spatial Depth Wise Shared Convolution
We share the same kernel across all channels.
"""
def __init__(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import ... | mcx/annotated_deep_learning_paper_implementations | SpatialDepthWiseSharedConvolution | false | 7,213 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
SquaredErrorBayesRisk | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SquaredErrorBayesRisk(Module):
"""
<a id="SquaredErrorBayesRisk"></a>
## Bayes Risk with Squared Error Loss
Here the cost function is squared error,
$$\\sum_{k=1}^K (y_k - p_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.nn import Module
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride = torch._C._dynamo.g... | mcx/annotated_deep_learning_paper_implementations | SquaredErrorBayesRisk | false | 7,214 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
MNIST_Discriminator | import torch
import torch.nn as nn
from torch.nn import functional as F
class MNIST_Discriminator(nn.Module):
def __init__(self, latent_size):
super(MNIST_Discriminator, self).__init__()
self.latent_size = latent_size
self.linear1 = nn.Linear(self.latent_size, self.latent_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | mdiephuis/adversarial-autoencoders | MNIST_Discriminator | false | 7,215 | [
"MIT"
] | 1 | a722239564362796774de21a64fd92e81dce4089 | https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089 |
MNIST_Encoder | import torch
import torch.nn as nn
from torch.nn import functional as F
class MNIST_Encoder(nn.Module):
def __init__(self, in_channels, latent_size):
super(MNIST_Encoder, self).__init__()
self.in_channels = in_channels
self.latent_size = latent_size
self.linear1 = nn.Linear(self.i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | mdiephuis/adversarial-autoencoders | MNIST_Encoder | false | 7,216 | [
"MIT"
] | 1 | a722239564362796774de21a64fd92e81dce4089 | https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089 |
MNIST_Generator | import torch
import torch.nn as nn
from torch.nn import functional as F
class MNIST_Generator(nn.Module):
def __init__(self, out_channels, latent_size):
super(MNIST_Generator, self).__init__()
self.out_channels = out_channels
self.latent_size = latent_size
self.linear1 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | mdiephuis/adversarial-autoencoders | MNIST_Generator | false | 7,217 | [
"MIT"
] | 1 | a722239564362796774de21a64fd92e81dce4089 | https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089 |
Discriminator | import torch
import torch.nn as nn
from torch.nn import functional as F
class Discriminator(nn.Module):
def __init__(self, latent_size, d=128):
super(Discriminator, self).__init__()
self.latent_size = latent_size
self.d = d
self.linear1 = nn.Linear(self.latent_size, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | mdiephuis/adversarial-autoencoders | Discriminator | false | 7,218 | [
"MIT"
] | 1 | a722239564362796774de21a64fd92e81dce4089 | https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089 |
MemoryEfficientPFLU | from torch.autograd import Function
import torch
from torch import nn
class PFLUFunction(Function):
@staticmethod
def forward(ctx, x):
ctx.save_for_backward(x)
return x * (1 + x / torch.sqrt(1 + x * x)) / 2
@staticmethod
def backward(ctx, grad_output):
x, = ctx.saved_tensors
... | 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.autograd import Function
from torch import nn
assert_size_stride = t... | mengzhu0308/PFLU-FPFLU | MemoryEfficientPFLU | false | 7,219 | [
"Apache-2.0"
] | 1 | 628cd472db2913e555e902bdf35af834f84a284b | https://github.com/mengzhu0308/PFLU-FPFLU/tree/628cd472db2913e555e902bdf35af834f84a284b |
FPFLU | import torch
from torch import nn
class FPFLU(nn.Module):
def forward(self, x):
return torch.maximum(x, x / (1 + 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 import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | mengzhu0308/PFLU-FPFLU | FPFLU | false | 7,220 | [
"Apache-2.0"
] | 1 | 628cd472db2913e555e902bdf35af834f84a284b | https://github.com/mengzhu0308/PFLU-FPFLU/tree/628cd472db2913e555e902bdf35af834f84a284b |
WQ | import torch
import torch.nn as nn
def stats_quant(x, nbit, qmode='symm', dequantize=True):
z_typical = {'4bit': [0.077, 1.013], '8bit': [0.027, 1.114]}
z = z_typical[f'{int(nbit)}bit']
m = x.abs().mean()
std = x.std()
if qmode == 'symm':
n_lv = 2 ** (nbit - 1) - 1
alpha_w = 1 / z[... | 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... | mengjian0502/TorchInference_SRAM | WQ | false | 7,221 | [
"MIT"
] | 1 | fcc465c73b79f2ab670b6af03aa53f9bb47c64ca | https://github.com/mengjian0502/TorchInference_SRAM/tree/fcc465c73b79f2ab670b6af03aa53f9bb47c64ca |
Coxnnet | import torch
import numpy as np
import torch.nn as nn
class Coxnnet(nn.Module):
def __init__(self, nfeat):
super(Coxnnet, self).__init__()
self.fc1 = nn.Linear(nfeat, int(np.ceil(nfeat ** 0.5)))
self.dropout = nn.Dropout(0.5)
self.fc2 = nn.Linear(int(np.ceil(nfeat ** 0.5)), 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.triton_helpers import libdevice
import numpy as np
... | menggerSherry/SAVAE-Cox | Coxnnet | false | 7,222 | [
"Apache-2.0"
] | 1 | c087ab4f267da28db7eb497c844bea59e65ed125 | https://github.com/menggerSherry/SAVAE-Cox/tree/c087ab4f267da28db7eb497c844bea59e65ed125 |
MVNormalNetwork | import torch
import torch.nn as nn
class MVNormalNetwork(nn.Module):
def __init__(self, latent_dim):
super().__init__()
self.mean = nn.Linear(latent_dim, latent_dim)
self.sc = nn.Linear(latent_dim, latent_dim)
def forward(self, x):
mean = self.mean(x)
sc = self.sc(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.triton_helpers import math as tl_math
import torch.... | mgb45/OC-notebooks | MVNormalNetwork | false | 7,223 | [
"MIT"
] | 1 | 67b1899d1fb3455ab3caab58f94429b9f432164b | https://github.com/mgb45/OC-notebooks/tree/67b1899d1fb3455ab3caab58f94429b9f432164b |
Conv1d_samePadding | import torch
from torch import nn
import torch.nn.functional as F
class Conv1d_samePadding(nn.Conv1d):
def __init__(self, *args, padding: int=0, **kwargs):
assert padding == 0, "no additional padding on top of 'same' padding"
kwargs['padding'] = 0
super().__init__(*args, **kwargs)
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn.functional as F
assert_size_stride = torch.... | mgrachten/crepe-pytorch | Conv1d_samePadding | false | 7,224 | [
"MIT"
] | 1 | 94305a78d2d82e414c251d50b63dc021af277c75 | https://github.com/mgrachten/crepe-pytorch/tree/94305a78d2d82e414c251d50b63dc021af277c75 |
NALUCell | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from torch.nn.parameter import Parameter
class NeuralAccumulatorCell(nn.Module):
"""A Neural Accumulator (NAC) cell [1].
Attributes:
in_dim: size of the input sample.
out_dim: size of the ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | mikomel/machine-number-sense | NALUCell | false | 7,225 | [
"MIT"
] | 1 | 173b67e4f25bd8249ba4a41904d4cd4af26bae05 | https://github.com/mikomel/machine-number-sense/tree/173b67e4f25bd8249ba4a41904d4cd4af26bae05 |
MHAttention | import math
import torch
from torch import nn
import torch.nn.functional as F
class MHAttention(nn.Module):
def __init__(self, ninp, nhead, dropout):
super(MHAttention, self).__init__()
if ninp % nhead != 0:
raise ValueError(
'The hidden size is not a multiple of 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.... | microsoft/Protein-Folding | MHAttention | false | 7,226 | [
"MIT"
] | 1 | f534b2dd1e3f192fbcdadf234f25828c7f458a58 | https://github.com/microsoft/Protein-Folding/tree/f534b2dd1e3f192fbcdadf234f25828c7f458a58 |
FeedForward | import torch
from torch import nn
class FeedForward(nn.Module):
def __init__(self, ninp, dim_feedforward, dropout):
super(FeedForward, self).__init__()
self.linear1 = nn.Linear(ninp, dim_feedforward)
self.dropout = nn.Dropout(dropout)
self.linear2 = nn.Linear(dim_feedforward, ninp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | microsoft/Protein-Folding | FeedForward | false | 7,227 | [
"MIT"
] | 1 | f534b2dd1e3f192fbcdadf234f25828c7f458a58 | https://github.com/microsoft/Protein-Folding/tree/f534b2dd1e3f192fbcdadf234f25828c7f458a58 |
NeuralAccumulatorCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from torch.nn.parameter import Parameter
class NeuralAccumulatorCell(nn.Module):
"""A Neural Accumulator (NAC) cell [1].
Attributes:
in_dim: size of the input sample.
out_dim: size of the output sampl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | mikomel/machine-number-sense | NeuralAccumulatorCell | false | 7,228 | [
"MIT"
] | 1 | 173b67e4f25bd8249ba4a41904d4cd4af26bae05 | https://github.com/mikomel/machine-number-sense/tree/173b67e4f25bd8249ba4a41904d4cd4af26bae05 |
Conv3x3 | import torch
import torch.nn as nn
class Conv3x3(nn.Module):
"""Layer to pad and convolve input
"""
def __init__(self, in_channels, out_channels, use_refl=True):
super(Conv3x3, self).__init__()
if use_refl:
self.pad = nn.ReflectionPad2d(1)
else:
self.pad = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | minjabenho/image2pcl | Conv3x3 | false | 7,229 | [
"Apache-2.0"
] | 1 | 7e696ee48edae30814d32f32e605ad6cf8bf702c | https://github.com/minjabenho/image2pcl/tree/7e696ee48edae30814d32f32e605ad6cf8bf702c |
fadein_layer | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.data
class fadein_layer(nn.Module):
def __init__(self, config):
super(fadein_layer, self).__init__()
self.alpha = 0.0
def update_alpha(self, delta):
self.alpha = self.alpha + delta
... | 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.... | mingo-x/pggan-pytorch | fadein_layer | false | 7,230 | [
"MIT"
] | 1 | a1dde73cd4df52476fe7c948d81fa9caea8070a5 | https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5 |
pixelwise_norm_layer | import torch
import torch.nn as nn
import torch.utils.data
class pixelwise_norm_layer(nn.Module):
def __init__(self):
super(pixelwise_norm_layer, self).__init__()
self.eps = 1e-08
def forward(self, x):
return x / (torch.mean(x ** 2, dim=1, keepdim=True) + self.eps) ** 0.5
def get_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.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dy... | mingo-x/pggan-pytorch | pixelwise_norm_layer | false | 7,231 | [
"MIT"
] | 1 | a1dde73cd4df52476fe7c948d81fa9caea8070a5 | https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5 |
equalized_conv2d | import torch
import torch.nn as nn
from torch.nn.init import normal
import torch.utils.data
def _calculate_fan_in_and_fan_out(tensor):
dimensions = tensor.ndimension()
if dimensions < 2:
raise ValueError(
'Fan in and fan out can not be computed for tensor with less than 2 dimensions'
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 torch.nn.init import normal
import torch.utils.data
a... | mingo-x/pggan-pytorch | equalized_conv2d | false | 7,232 | [
"MIT"
] | 1 | a1dde73cd4df52476fe7c948d81fa9caea8070a5 | https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5 |
ParityPonderGRU | from torch.nn import Module
import torch
from torch import nn
from typing import Tuple
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ParityPonderGRU(Module):
"""
## PonderNet with GRU for Parity Task
This is a simple model that uses a [GRU Cell](https://pytorch.org/docs/s... | 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.nn import Module
from torch import nn
import... | mcx/annotated_deep_learning_paper_implementations | ParityPonderGRU | false | 7,233 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
equalized_linear | import torch
import torch.nn as nn
from torch.nn.init import normal
import torch.utils.data
def _calculate_fan_in_and_fan_out(tensor):
dimensions = tensor.ndimension()
if dimensions < 2:
raise ValueError(
'Fan in and fan out can not be computed for tensor with less than 2 dimensions'
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 torch.nn.init import normal
import torch.utils.data
a... | mingo-x/pggan-pytorch | equalized_linear | false | 7,234 | [
"MIT"
] | 1 | a1dde73cd4df52476fe7c948d81fa9caea8070a5 | https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5 |
ConvBlock | import torch
import torch.nn as nn
class Conv3x3(nn.Module):
"""Layer to pad and convolve input
"""
def __init__(self, in_channels, out_channels, use_refl=True):
super(Conv3x3, self).__init__()
if use_refl:
self.pad = nn.ReflectionPad2d(1)
else:
self.pad = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | minjabenho/image2pcl | ConvBlock | false | 7,235 | [
"Apache-2.0"
] | 1 | 7e696ee48edae30814d32f32e605ad6cf8bf702c | https://github.com/minjabenho/image2pcl/tree/7e696ee48edae30814d32f32e605ad6cf8bf702c |
Project3D | import torch
import torch.nn as nn
class Project3D(nn.Module):
"""Layer which projects 3D points into a camera with intrinsics K and at position T
"""
def __init__(self, batch_size, height, width, eps=1e-07):
super(Project3D, self).__init__()
self.batch_size = batch_size
self.heig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | minjabenho/image2pcl | Project3D | false | 7,236 | [
"Apache-2.0"
] | 1 | 7e696ee48edae30814d32f32e605ad6cf8bf702c | https://github.com/minjabenho/image2pcl/tree/7e696ee48edae30814d32f32e605ad6cf8bf702c |
SelfAttnLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
def get_activation_fn(activation):
if activation == 'relu':
return F.relu
elif activation == 'gelu':
return F.gelu
raise RuntimeError('activation should be relu/gelu, not {}'.format(
activation))
class Transformer... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mensudza/C-Tran | SelfAttnLayer | false | 7,237 | [
"MIT"
] | 1 | 4895ccb0e675ae2dcd2b619a9e47f30707062668 | https://github.com/mensudza/C-Tran/tree/4895ccb0e675ae2dcd2b619a9e47f30707062668 |
depthwise_separable_conv | import torch
import torch.nn as nn
class depthwise_separable_conv(torch.nn.Module):
def __init__(self, nin, nout, kernel_size, padding):
super(depthwise_separable_conv, self).__init__()
self.depthwise = nn.Conv2d(nin, nin, kernel_size=kernel_size,
padding=padding, groups=nin)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | mirayyuce/Neural-Architecture-Search | depthwise_separable_conv | false | 7,238 | [
"BSD-3-Clause"
] | 1 | e294816c85200f4301376c8b355634c6cca81816 | https://github.com/mirayyuce/Neural-Architecture-Search/tree/e294816c85200f4301376c8b355634c6cca81816 |
BertPredictionHeadTransform | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | minjoong507/Image-Captioning-Transformer | BertPredictionHeadTransform | false | 7,239 | [
"MIT"
] | 1 | 813060f0bb656e336154173f11e99a80362c8c2a | https://github.com/minjoong507/Image-Captioning-Transformer/tree/813060f0bb656e336154173f11e99a80362c8c2a |
Router | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Squash(Module):
'\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mcx/annotated_deep_learning_paper_implementations | Router | false | 7,240 | [
"MIT"
] | 1 | f169f3a71dd2d36eb28ad31062d3475efa367b88 | https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88 |
Pointer | import torch
import torch.nn as nn
def mask_logits(target, mask):
mask = mask.type(torch.float32)
return target * mask + (1 - mask) * -1e+30
class Initialized_Conv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, groups=1, relu=False, bias=False):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | mirbostani/QA-KD-AL | Pointer | false | 7,241 | [
"MIT"
] | 1 | 0ec8756ee06ae2a204a5e9110503bc697e9108fb | https://github.com/mirbostani/QA-KD-AL/tree/0ec8756ee06ae2a204a5e9110503bc697e9108fb |
SSIM | import torch
import torch.nn as nn
class SSIM(nn.Module):
"""Layer to compute the SSIM loss between a pair of images
"""
def __init__(self):
super(SSIM, self).__init__()
self.mu_x_pool = nn.AvgPool2d(3, 1)
self.mu_y_pool = nn.AvgPool2d(3, 1)
self.sig_x_pool = nn.AvgPool2d(... | 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
... | minjabenho/image2pcl | SSIM | false | 7,242 | [
"Apache-2.0"
] | 1 | 7e696ee48edae30814d32f32e605ad6cf8bf702c | https://github.com/minjabenho/image2pcl/tree/7e696ee48edae30814d32f32e605ad6cf8bf702c |
dream_loss | import torch
class dream_loss(torch.nn.Module):
def __init__(self):
super(dream_loss, self).__init__()
def forward(self, yhat, y):
diff = torch.sum(yhat - y)
return diff
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | mkelcb/knet | dream_loss | false | 7,244 | [
"MIT"
] | 1 | f0e75f526c8bcdc6969052328b2b1b9cd6767cd8 | https://github.com/mkelcb/knet/tree/f0e75f526c8bcdc6969052328b2b1b9cd6767cd8 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | minjoong507/Image-Captioning-Transformer | BertSelfAttention | false | 7,247 | [
"MIT"
] | 1 | 813060f0bb656e336154173f11e99a80362c8c2a | https://github.com/minjoong507/Image-Captioning-Transformer/tree/813060f0bb656e336154173f11e99a80362c8c2a |
BertLMPredictionHead | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | minjoong507/Image-Captioning-Transformer | BertLMPredictionHead | false | 7,248 | [
"MIT"
] | 1 | 813060f0bb656e336154173f11e99a80362c8c2a | https://github.com/minjoong507/Image-Captioning-Transformer/tree/813060f0bb656e336154173f11e99a80362c8c2a |
CAT_TokenEmbedding | import torch
import torch.nn as nn
class CAT_TokenEmbedding(nn.Module):
def __init__(self, c_in=1, d_feature=10):
super(CAT_TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_feature,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | mkmysk123456789/Informer2020 | CAT_TokenEmbedding | false | 7,250 | [
"Apache-2.0"
] | 1 | ad4b895169a17db580aab6d2c09fd07e06c9b6fa | https://github.com/mkmysk123456789/Informer2020/tree/ad4b895169a17db580aab6d2c09fd07e06c9b6fa |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | minjoong507/Image-Captioning-Transformer | BertAttention | false | 7,252 | [
"MIT"
] | 1 | 813060f0bb656e336154173f11e99a80362c8c2a | https://github.com/minjoong507/Image-Captioning-Transformer/tree/813060f0bb656e336154173f11e99a80362c8c2a |
BoundSoftmaxImpl | import torch
import torch.nn as nn
class BoundSoftmaxImpl(nn.Module):
def __init__(self, axis):
super().__init__()
self.axis = axis
def forward(self, x):
max_x = torch.max(x, dim=self.axis).values
assert self.axis == int(self.axis)
x = torch.exp(x - max_x.unsqueeze(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 math as tl_math
import torch.nn as nn
... | mnmueller/auto_LiRPA | BoundSoftmaxImpl | false | 7,253 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
CAT_TemporalEmbedding | import math
import torch
import torch.nn as nn
class CAT_FixedEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(CAT_FixedEmbedding, self).__init__()
w = torch.zeros(c_in, d_model).float()
w.require_grad = False
position = torch.arange(0, c_in).float().unsqueeze(1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | mkmysk123456789/Informer2020 | CAT_TemporalEmbedding | false | 7,254 | [
"Apache-2.0"
] | 1 | ad4b895169a17db580aab6d2c09fd07e06c9b6fa | https://github.com/mkmysk123456789/Informer2020/tree/ad4b895169a17db580aab6d2c09fd07e06c9b6fa |
CQAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
def mask_logits(target, mask):
mask = mask.type(torch.float32)
return target * mask + (1 - mask) * -1e+30
class CQAttention(nn.Module):
def __init__(self, d_model, dropout=0.1):
super().__init__()
w4C = torch.empty(d_mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mirbostani/QA-KD-AL | CQAttention | false | 7,255 | [
"MIT"
] | 1 | 0ec8756ee06ae2a204a5e9110503bc697e9108fb | https://github.com/mirbostani/QA-KD-AL/tree/0ec8756ee06ae2a204a5e9110503bc697e9108fb |
Transition | import torch
import torch.nn as nn
import torch.nn.functional as F
class Transition(nn.Module):
def __init__(self, in_planes, out_planes):
super(Transition, self).__init__()
self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=1, bias=True)
def forward(self, x):
out = self.conv(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
import torch.nn as nn
assert_... | mnmueller/auto_LiRPA | Transition | false | 7,256 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
mlp_2layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class mlp_2layer(nn.Module):
def __init__(self, in_ch, in_dim, width=1):
super(mlp_2layer, self).__init__()
self.fc1 = nn.Linear(in_ch * in_dim * in_dim, 256 * width)
self.fc2 = nn.Linear(256 * width, 10)
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
import torch.nn as nn
assert_... | mnmueller/auto_LiRPA | mlp_2layer | false | 7,257 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
BertLayerNormNoVar | import torch
import torch.nn as nn
class BertLayerNormNoVar(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNormNoVar, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsil... | 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... | mnmueller/auto_LiRPA | BertLayerNormNoVar | false | 7,258 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
mlp_5layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class mlp_5layer(nn.Module):
def __init__(self, in_ch, in_dim, width=1):
super(mlp_5layer, self).__init__()
self.fc1 = nn.Linear(in_ch * in_dim * in_dim, 256 * width)
self.fc2 = nn.Linear(256 * width, 256 * width)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | mnmueller/auto_LiRPA | mlp_5layer | false | 7,259 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
mlp_3layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class mlp_3layer(nn.Module):
def __init__(self, in_ch, in_dim, width=1):
super(mlp_3layer, self).__init__()
self.fc1 = nn.Linear(in_ch * in_dim * in_dim, 256 * width)
self.fc2 = nn.Linear(256 * width, 128 * width)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | mnmueller/auto_LiRPA | mlp_3layer | false | 7,261 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
AdaptiveInstanceNorm | import torch
import torch.nn as nn
from math import sqrt
def equal_lr(module, name='weight'):
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
weight = getattr(module, self.name + '_orig')
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | mmhnoaccount/DeepChroma_128 | AdaptiveInstanceNorm | false | 7,262 | [
"MIT"
] | 1 | 337ec961bfc4ee44f48cb84e624c293ee2805b62 | https://github.com/mmhnoaccount/DeepChroma_128/tree/337ec961bfc4ee44f48cb84e624c293ee2805b62 |
cnn_4layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class cnn_4layer(nn.Module):
def __init__(self, in_ch, in_dim, width=2, linear_size=256):
super(cnn_4layer, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 4 * width, 4, stride=2, padding=1)
self.conv2 = nn.Conv2d(4 * width... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | mnmueller/auto_LiRPA | cnn_4layer | false | 7,263 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
cnn_4layer_LeakyRelu | import torch
import torch.nn as nn
import torch.nn.functional as F
class cnn_4layer_LeakyRelu(nn.Module):
def __init__(self, in_ch, in_dim, width=2, linear_size=256, alpha=0.1):
super(cnn_4layer_LeakyRelu, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 4 * width, 4, stride=2, padding=1)
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... | mnmueller/auto_LiRPA | cnn_4layer_LeakyRelu | false | 7,264 | [
"BSD-3-Clause"
] | 1 | 55cb270b0b99f07b74541d55706c69fbb9daff66 | https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66 |
Net2 | import torch
from torch import nn
class Net2(nn.Module):
"""
Net2 is a more complex network consisting of two hidden layers with 400
and 300 neurons
"""
hidden1 = 400
hidden2 = 300
def __init__(self, input_size):
super(Net2, self).__init__()
self.fc1 = nn.Linear(input_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... | moritzschaefer/pavooc | Net2 | false | 7,265 | [
"MIT"
] | 1 | 735f5455f9a95a5734436a24e2aa92cf600c91af | https://github.com/moritzschaefer/pavooc/tree/735f5455f9a95a5734436a24e2aa92cf600c91af |
Debugnetwork | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torch.nn import init
class conv(nn.Module):
"""
n*n conv with relu
"""
def __init__(self, in_dim, out_dim, kernal_size, stride, padding):
super(conv, self).__init__()
self.con_layer = nn.Conv2d(in_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 to... | H-Liu1997/Pytorch_Pose_Estimation_Framework | Debugnetwork | false | 7,266 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
NeuralNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class NeuralNet(nn.Module):
def __init__(self, num_input_nodes, num_hidden_nodes, output_dimension):
super(NeuralNet, self).__init__()
self.input_linear = nn.Linear(num_input_nodes, num_hidden_nodes)
self.output_linear = 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.... | mohiitgupta/named-entity-recognition-nlp-purdue | NeuralNet | false | 7,267 | [
"MIT"
] | 1 | 68232bbd5d17f3e3989e5df37175cdc670896608 | https://github.com/mohiitgupta/named-entity-recognition-nlp-purdue/tree/68232bbd5d17f3e3989e5df37175cdc670896608 |
LoRALayer | import torch
from torch import nn
import torch.nn.parallel
import torch.utils.data
class LoRALayer(nn.Module):
def __init__(self, n_in, n_out=None, adapter_dim=16, adapter_alpha=32):
super(LoRALayer, self).__init__()
if not n_out:
n_out = n_in
self.adapter_dim = adapter_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 import nn
import torch.nn.parallel
import torch.utils.data
assert_siz... | mojishoki/LoRA | LoRALayer | false | 7,268 | [
"MIT"
] | 1 | 556225e776b4e2c5f77d332db15f0c712c13fe0e | https://github.com/mojishoki/LoRA/tree/556225e776b4e2c5f77d332db15f0c712c13fe0e |
NetVLAD | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
class NetVLAD(nn.Module):
"""NetVLAD layer implementation"""
def __init__(self, dim, num_clusters=64):
"""
Args:
dim : int
Dimension of descriptors
num_clusters : int
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | lulor/project_vg | NetVLAD | false | 7,269 | [
"MIT"
] | 1 | 27b0c3b3038c5a666dde516a0a265ae8ddf2059f | https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f |
DuelingNet | import torch
from torch import nn
import torch.nn.functional as F
class DuelingNet(nn.Module):
def __init__(self, n_in, n_mid, n_out):
super(DuelingNet, self).__init__()
self.fc1 = nn.Linear(n_in, n_mid)
self.fc2 = nn.Linear(n_mid, n_mid)
self.fc3_adv = nn.Linear(n_mid, n_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 import triton_helpers
from torch import nn
assert_s... | moriaki3193/Torch26 | DuelingNet | false | 7,271 | [
"MIT"
] | 1 | fb75f6b6bb07c63fedb03fad7b647837eb40db2e | https://github.com/moriaki3193/Torch26/tree/fb75f6b6bb07c63fedb03fad7b647837eb40db2e |
AveragePooling | import torch
import torch.nn as nn
class AveragePooling(nn.Module):
def __init__(self):
super(AveragePooling, self).__init__()
"""
(item, subitem) can be (word, characters), or (sentence, words)
x: num_items x max_subitem_size x input_size
x_mask: num_items x max_subitem_size
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | mpandeydev/SDnetmod | AveragePooling | false | 7,272 | [
"MIT"
] | 1 | c8cdf6150e3cd28330359a7d81df236729522a69 | https://github.com/mpandeydev/SDnetmod/tree/c8cdf6150e3cd28330359a7d81df236729522a69 |
SinenetComponent | import torch
class SinenetComponent(torch.nn.Module):
def __init__(self, time_len, i):
super().__init__()
self.time_len = time_len
self.i = i
self.t_wav = 1.0 / 16000
self.log_f_mean = 5.02654
self.log_f_std = 0.373288
self.a = torch.nn.Parameter(torch.Tens... | 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... | moquan/22_Nov_2018 | SinenetComponent | false | 7,273 | [
"MIT"
] | 1 | eaa81bf5050d74612fe1322abcdb26a0a919e976 | https://github.com/moquan/22_Nov_2018/tree/eaa81bf5050d74612fe1322abcdb26a0a919e976 |
Net3 | import torch
from torch import nn
class Net3(nn.Module):
"""
Net3 is a neural network consisting of four hidden layers with sizes 400,
300, 300 and 70
"""
layer_sizes = [400, 300, 300, 70]
hidden1 = 400
hidden2 = 300
hidden3 = 300
hidden4 = 70
def __init__(self, input_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... | moritzschaefer/pavooc | Net3 | false | 7,274 | [
"MIT"
] | 1 | 735f5455f9a95a5734436a24e2aa92cf600c91af | https://github.com/moritzschaefer/pavooc/tree/735f5455f9a95a5734436a24e2aa92cf600c91af |
MaxPooling | import torch
import torch.nn as nn
class MaxPooling(nn.Module):
def __init__(self):
super(MaxPooling, self).__init__()
self.MIN = -1000000.0
"""
(item, subitem) can be (word, characters), or (sentence, words)
x: num_items x max_subitem_size x input_size
x_mask: num_items x max_... | 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... | mpandeydev/SDnetmod | MaxPooling | false | 7,275 | [
"MIT"
] | 1 | c8cdf6150e3cd28330359a7d81df236729522a69 | https://github.com/mpandeydev/SDnetmod/tree/c8cdf6150e3cd28330359a7d81df236729522a69 |
Actor | import torch
import torch.nn.functional as F
import torch.nn as nn
class Actor(torch.nn.Module):
def __init__(self, numObs, numActions):
super(Actor, self).__init__()
self.actor_input = nn.Linear(numObs, 32)
self.actor_fc1 = nn.Linear(32, 32)
self.actor_output = nn.Linear(32, numA... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | mpgussert/fundamentalRL | Actor | false | 7,276 | [
"MIT"
] | 1 | 4f45436226e0823c21cac316dec8bbf1df697467 | https://github.com/mpgussert/fundamentalRL/tree/4f45436226e0823c21cac316dec8bbf1df697467 |
Agent | import torch
import torch.nn.functional as F
import torch.nn as nn
class Agent(torch.nn.Module):
def __init__(self, numObs, numActions):
super(Agent, self).__init__()
self.critic_input = nn.Linear(numObs, 32)
self.critic_fc1 = nn.Linear(32, 32)
self.critic_output = nn.Linear(32, 1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | mpgussert/fundamentalRL | Agent | false | 7,277 | [
"MIT"
] | 1 | 4f45436226e0823c21cac316dec8bbf1df697467 | https://github.com/mpgussert/fundamentalRL/tree/4f45436226e0823c21cac316dec8bbf1df697467 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.