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 |
|---|---|---|---|---|---|---|---|---|---|---|
GeneratorLoss | import torch
from torch import nn
import torch.utils.data
import torch
class TVLoss(nn.Module):
def __init__(self, tv_loss_weight=1):
super(TVLoss, self).__init__()
self.tv_loss_weight = tv_loss_weight
def forward(self, x):
batch_size = x.size()[0]
h_x = x.size()[2]
w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils.data
import torch
assert_size_stride = torch._C._... | LiFH/MySR | GeneratorLoss | false | 768 | [
"MIT"
] | 0 | f6075f8711853aba6f0aae9cef18c5da84abb78c | https://github.com/LiFH/MySR/tree/f6075f8711853aba6f0aae9cef18c5da84abb78c |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target, logits=True):
if logits:
input = nn.Sigmoid()(input)
N = target.size(0)
smooth = 1
input_flat = input.view(N... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | LanXiangExcavator/challenge2021_submission_4 | DiceLoss | false | 769 | [
"BSD-2-Clause"
] | 0 | ca0d4d4dd219119f7dc46464c92062ecdb7f9c49 | https://github.com/LanXiangExcavator/challenge2021_submission_4/tree/ca0d4d4dd219119f7dc46464c92062ecdb7f9c49 |
DecoderBlock | import torch
from torch import nn
class DecoderBlock(nn.Module):
"""
A block in decoder that makes use of sentence representation
TODO: block is a boring name; there gotta be a more creative name for this step
"""
def __init__(self, d_model, dropout=0.1, mode='add_attn'):
super().__init__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Lev-etd/rtg_streamlit | DecoderBlock | false | 770 | [
"Apache-2.0"
] | 0 | 7cab50e80f424601dbed0b14e1e121144581244c | https://github.com/Lev-etd/rtg_streamlit/tree/7cab50e80f424601dbed0b14e1e121144581244c |
ScaledDotProductAttention | import torch
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_dropout)
self.softmax = nn.So... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LithiumH/cs224u-final-project | ScaledDotProductAttention | false | 771 | [
"Apache-2.0"
] | 0 | 6049ccca3a2c33a77d9a6d5f44b2755301e18891 | https://github.com/LithiumH/cs224u-final-project/tree/6049ccca3a2c33a77d9a6d5f44b2755301e18891 |
Tanh | from torch.nn import Module
import torch
class Tanh(Module):
"""Rectified Tanh, since we predict betwee 0 and 1"""
def __init__(self):
super().__init__()
self.params = []
def forward(self, x):
self.x = x
return 0.5 * (1 + x.tanh())
def backward(self, d_dx):
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.triton_helpers import libdevice
from torch.nn import Module
assert_size_stride = torch._C._dynamo.guards.assert... | LucaZampieri/DL | Tanh | false | 772 | [
"MIT"
] | 0 | e53ade2638ccc3ca368e15c8454845856776e719 | https://github.com/LucaZampieri/DL/tree/e53ade2638ccc3ca368e15c8454845856776e719 |
ConvertPointsToHomogeneous | import torch
import torch.nn as nn
def convert_points_to_homogeneous(points):
"""Function that converts points from Euclidean to homogeneous space.
See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tgm.co... | 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... | LucaswasTaken/frankmocap | ConvertPointsToHomogeneous | false | 773 | [
"BSD-3-Clause"
] | 0 | 17c1761326991d0faab58bd10888e9043abf6bd5 | https://github.com/LucaswasTaken/frankmocap/tree/17c1761326991d0faab58bd10888e9043abf6bd5 |
Feedforward | import torch
from torch import nn
class Feedforward(torch.nn.Module):
def __init__(self, input_size, hidden_size, drop_p=0.2):
super(Feedforward, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.fc1 = torch.nn.Linear(self.input_size, self.hidden_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LavanayaBajaj/CREATE-CLASSIFIER | Feedforward | false | 774 | [
"MIT"
] | 0 | f00c7ec686f532a22e62d55aad169c831988be1b | https://github.com/LavanayaBajaj/CREATE-CLASSIFIER/tree/f00c7ec686f532a22e62d55aad169c831988be1b |
MLPNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLPNet(nn.Module):
def __init__(self):
super(MLPNet, self).__init__()
self.fc1 = nn.Linear(28 * 28, 500)
self.fc2 = nn.Linear(500, 256)
self.fc3 = nn.Linear(256, 10)
def forward(self, x):
x = x.v... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ledzy/EKFAC_experiment | MLPNet | false | 775 | [
"MIT"
] | 0 | 5fce6859df1bb75645c38e97325dcb25db01e369 | https://github.com/Ledzy/EKFAC_experiment/tree/5fce6859df1bb75645c38e97325dcb25db01e369 |
ZSSRNet | import torch
from torch import nn
import torch.utils.data
import torch
class ZSSRNet(nn.Module):
def __init__(self, input_channels=3, kernel_size=3, channels=64):
super(ZSSRNet, self).__init__()
self.conv0 = nn.Conv2d(input_channels, channels, kernel_size=
kernel_size, padding=kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | LiFH/MySR | ZSSRNet | false | 776 | [
"MIT"
] | 0 | f6075f8711853aba6f0aae9cef18c5da84abb78c | https://github.com/LiFH/MySR/tree/f6075f8711853aba6f0aae9cef18c5da84abb78c |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, smooth=0, eps=1e-07):
super(DiceLoss, self).__init__()
self.smooth = smooth
self.eps = eps
def forward(self, output, target):
return 1 - (2 * torch.sum(output * target) + self.smooth) / (torch.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | LisburnLad/open-solution-salt-detection | DiceLoss | false | 777 | [
"MIT"
] | 0 | 9ac292700b2f1351244e29e039425ee706aab92a | https://github.com/LisburnLad/open-solution-salt-detection/tree/9ac292700b2f1351244e29e039425ee706aab92a |
LossMSE | from torch.nn import Module
import torch
class LossMSE(Module):
"""implementation of the Mean-Squared Error Loss"""
def __init__(self):
super().__init__()
self.params = []
def forward(self, y, t):
self.y = y
self.t = t
return torch.dist(y, t, p=2)
def backwar... | 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
... | LucaZampieri/DL | LossMSE | false | 779 | [
"MIT"
] | 0 | e53ade2638ccc3ca368e15c8454845856776e719 | https://github.com/LucaZampieri/DL/tree/e53ade2638ccc3ca368e15c8454845856776e719 |
Upsample | import torch
from torch import nn
import torch.utils.data
import torch
class Upsample(nn.Module):
def __init__(self, scale):
super(Upsample, self).__init__()
self.up = nn.Upsample(scale_factor=scale, mode='bicubic',
align_corners=True)
def forward(self, x):
return self.up... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import ... | LiFH/MySR | Upsample | false | 780 | [
"MIT"
] | 0 | f6075f8711853aba6f0aae9cef18c5da84abb78c | https://github.com/LiFH/MySR/tree/f6075f8711853aba6f0aae9cef18c5da84abb78c |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN_encoder(nn.Module):
def __init__(self):
super(CNN_encoder, self).__init__()
self.net = nn.Sequential(nn.Conv2d(4, 8, kernel_size=3, padding=1,
stride=1), nn.ReLU(), nn.MaxPool2d(4, 2), nn.Conv2d(8, 8,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Lttcc/Olympics | Critic | false | 781 | [
"MIT"
] | 0 | 97411244073d127e83e84bf61b1b0a1d6718c31c | https://github.com/Lttcc/Olympics/tree/97411244073d127e83e84bf61b1b0a1d6718c31c |
AttnModel | import torch
from torch import nn
import torch.nn.functional as F
class AttnModel(nn.Module):
"""
Attention model
"""
def __init__(self, inp_size, out_size=None, att_type='dot'):
"""
:param inp_size: Input size on which the the attention
:param out_size: Output of attention
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | Lev-etd/rtg_streamlit | AttnModel | false | 782 | [
"Apache-2.0"
] | 0 | 7cab50e80f424601dbed0b14e1e121144581244c | https://github.com/Lev-etd/rtg_streamlit/tree/7cab50e80f424601dbed0b14e1e121144581244c |
ConvertPointsFromHomogeneous | import torch
import torch.nn as nn
def convert_points_from_homogeneous(points):
"""Function that converts points from homogeneous to Euclidean space.
See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tg... | 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... | LucaswasTaken/frankmocap | ConvertPointsFromHomogeneous | false | 783 | [
"BSD-3-Clause"
] | 0 | 17c1761326991d0faab58bd10888e9043abf6bd5 | https://github.com/LucaswasTaken/frankmocap/tree/17c1761326991d0faab58bd10888e9043abf6bd5 |
MulticlassDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target, logits=True):
if logits:
input = nn.Sigmoid()(input)
N = target.size(0)
smooth = 1
input_flat = input.view(N... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | LanXiangExcavator/challenge2021_submission_4 | MulticlassDiceLoss | false | 784 | [
"BSD-2-Clause"
] | 0 | ca0d4d4dd219119f7dc46464c92062ecdb7f9c49 | https://github.com/LanXiangExcavator/challenge2021_submission_4/tree/ca0d4d4dd219119f7dc46464c92062ecdb7f9c49 |
IMDModule_speed | import torch
import torch.nn as nn
import torch.utils.model_zoo
def activation(act_type, inplace=True, neg_slope=0.05, n_prelu=1):
act_type = act_type.lower()
if act_type == 'relu':
layer = nn.ReLU(inplace)
elif act_type == 'lrelu':
layer = nn.LeakyReLU(neg_slope, inplace)
elif act_typ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.model_zoo
assert_size_stride = torch._C... | Liang-ZX/EDSR-PyTorch | IMDModule_speed | false | 785 | [
"MIT"
] | 0 | a245d02fa1c3d799402aeadf7320f1c8a116e86a | https://github.com/Liang-ZX/EDSR-PyTorch/tree/a245d02fa1c3d799402aeadf7320f1c8a116e86a |
Mnist_CNN | import torch
from torch import nn
import torch.nn.functional as F
class Mnist_CNN(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size=3, stride=2, padding=1)
self.conv2 = nn.Conv2d(16, 16, kernel_size=3, stride=2, padding=1)
self.conv3 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | LbsIrving/PyTorch | Mnist_CNN | false | 786 | [
"MIT"
] | 0 | 314dbe9efc9e0116a7342d4ae3ab168c1c3afa32 | https://github.com/LbsIrving/PyTorch/tree/314dbe9efc9e0116a7342d4ae3ab168c1c3afa32 |
FeatureNorm | import torch
from torch import nn as nn
class FeatureNorm(nn.Module):
def __init__(self, num_features, feature_index=1, rank=4, reduce_dims=(
2, 3), eps=0.001, include_bias=True):
super(FeatureNorm, self).__init__()
self.shape = [1] * rank
self.shape[feature_index] = num_features
... | 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_... | Luckygyana/Fabric-Defect-Detection | FeatureNorm | false | 787 | [
"Apache-2.0"
] | 0 | 83cd8936ada6ef097993650c6db6286928666036 | https://github.com/Luckygyana/Fabric-Defect-Detection/tree/83cd8936ada6ef097993650c6db6286928666036 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.layer_1 = nn.Linear(state_dim, 800)
self.layer_2 = nn.Linear(800, 600)
self.layer_3 = nn.Linear(600,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LiuXiang199x/DRL_Navigation | Actor | false | 788 | [
"MIT"
] | 0 | 336e847bde8261d429fd2de8111b3d24c0ab4bae | https://github.com/LiuXiang199x/DRL_Navigation/tree/336e847bde8261d429fd2de8111b3d24c0ab4bae |
RNN | import torch
import torch.nn as nn
from torch.autograd import Variable
class RNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(RNN, self).__init__()
self.hidden_size = hidden_size
self.output_size = output_size
self.layer1 = nn.Linear(input_size, hidd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Lukx19/TorcsDriver | RNN | false | 789 | [
"MIT"
] | 0 | e6e3dd4b15e8dec487a29465f7592c7d5d2581cc | https://github.com/Lukx19/TorcsDriver/tree/e6e3dd4b15e8dec487a29465f7592c7d5d2581cc |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.layer_1 = nn.Linear(state_dim, 800)
self.layer_2_s = nn.Linear(800, 600)
self.layer_2_a = nn.Linear(action_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
import torch.nn as nn
assert_... | LiuXiang199x/DRL_Navigation | Critic | false | 790 | [
"MIT"
] | 0 | 336e847bde8261d429fd2de8111b3d24c0ab4bae | https://github.com/LiuXiang199x/DRL_Navigation/tree/336e847bde8261d429fd2de8111b3d24c0ab4bae |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN_encoder(nn.Module):
def __init__(self):
super(CNN_encoder, self).__init__()
self.net = nn.Sequential(nn.Conv2d(4, 8, kernel_size=3, padding=1,
stride=1), nn.ReLU(), nn.MaxPool2d(4, 2), nn.Conv2d(8, 8,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Lttcc/Olympics | Actor | false | 791 | [
"MIT"
] | 0 | 97411244073d127e83e84bf61b1b0a1d6718c31c | https://github.com/Lttcc/Olympics/tree/97411244073d127e83e84bf61b1b0a1d6718c31c |
MyNet2 | import torch
from torch import nn
from torch.nn import functional as F
class MyNet2(nn.Module):
"""Very simple network made with two fully connected layers"""
def __init__(self):
super(MyNet2, self).__init__()
self.fc1 = nn.Linear(28 * 50, 128)
self.fc2 = nn.Linear(128, 1)
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | LucaZampieri/DL | MyNet2 | false | 792 | [
"MIT"
] | 0 | e53ade2638ccc3ca368e15c8454845856776e719 | https://github.com/LucaZampieri/DL/tree/e53ade2638ccc3ca368e15c8454845856776e719 |
Hard_Distillation_Loss | import torch
import torch.nn as nn
import torch.nn
class Hard_Distillation_Loss(nn.Module):
def __init__(self):
super(Hard_Distillation_Loss, self).__init__()
self.CE_teacher = nn.CrossEntropyLoss()
self.CE_student = nn.CrossEntropyLoss()
def forward(self, teacher_y, student_y, y):
... | 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
... | ManojKesani/Transformer-Implementations | Hard_Distillation_Loss | false | 793 | [
"MIT"
] | 0 | faca89d44523da80073790d53e53b4e80bde736f | https://github.com/ManojKesani/Transformer-Implementations/tree/faca89d44523da80073790d53e53b4e80bde736f |
Soft_Distillation_Loss | import torch
import torch.nn as nn
import torch.nn
class Soft_Distillation_Loss(nn.Module):
def __init__(self, lambda_balancing):
super(Soft_Distillation_Loss, self).__init__()
self.lambda_balancing = lambda_balancing
self.CE_student = nn.CrossEntropyLoss()
self.KLD_teacher = nn.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._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ManojKesani/Transformer-Implementations | Soft_Distillation_Loss | false | 794 | [
"MIT"
] | 0 | faca89d44523da80073790d53e53b4e80bde736f | https://github.com/ManojKesani/Transformer-Implementations/tree/faca89d44523da80073790d53e53b4e80bde736f |
LinearWithGroupNorm | import torch
import torch.utils.data
from torch import nn
from math import gcd
import torch.cuda
class LinearWithGroupNorm(nn.Module):
def __init__(self, n_in: 'int', n_out: 'int', num_groups: 'int'=32,
activation: 'bool'=True) ->None:
"""
Linear layer used in LaneGCN.
:param n_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.... | MCZhi/nuplan-devkit | LinearWithGroupNorm | false | 795 | [
"Apache-2.0"
] | 0 | 3c4f5b8dcd517b27cfd258915ca5fe5c54e3cb0c | https://github.com/MCZhi/nuplan-devkit/tree/3c4f5b8dcd517b27cfd258915ca5fe5c54e3cb0c |
ActNorm | import torch
class ActNorm(torch.nn.Module):
def __init__(self, dim):
super(type(self), self).__init__()
self.dim = dim
self.s = torch.nn.Parameter(torch.ones(1, dim))
self.b = torch.nn.Parameter(torch.zeros(1, dim))
return
def forward(self, h):
h = self.s * h... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | MarcSerraPeralta/rec-flows | ActNorm | false | 796 | [
"MIT"
] | 0 | d05c3eca944f2228cffa575698ee5b010e83f167 | https://github.com/MarcSerraPeralta/rec-flows/tree/d05c3eca944f2228cffa575698ee5b010e83f167 |
CTLSTMCell | import torch
import torch.nn as nn
import torch.nn.functional as F
class CTLSTMCell(nn.Module):
def __init__(self, hidden_dim, beta=1.0, device=None):
super(CTLSTMCell, self).__init__()
device = device or 'cpu'
self.device = torch.device(device)
self.hidden_dim = 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.triton_helpers import libdevice, math as tl_math
im... | LitteleStar/TDPP | CTLSTMCell | false | 797 | [
"Apache-2.0"
] | 0 | 7b85016bea01c4c018337152599043dc2efbaba8 | https://github.com/LitteleStar/TDPP/tree/7b85016bea01c4c018337152599043dc2efbaba8 |
PatchEmbed | import torch
from torch import nn
class PatchEmbed(nn.Module):
""" Image to Patch Embedding
"""
def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768):
super().__init__()
num_patches = img_size // patch_size * (img_size // patch_size)
self.img_size = img_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | MarcCoru/dino | PatchEmbed | false | 798 | [
"Apache-2.0"
] | 0 | 45c7c7e5ed4649fb74424eef6f64b46d460f745f | https://github.com/MarcCoru/dino/tree/45c7c7e5ed4649fb74424eef6f64b46d460f745f |
FFGKL | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils
from matplotlib import cm as cm
from torch.nn.parallel import *
from torchvision.models import *
from torchvision.datasets import *
class FFGKL(nn.Module):
"""KL divergence between standart normal prior and fully-factorize gaussian post... | 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
... | CrispyHarder/ppuda | FFGKL | false | 799 | [
"MIT"
] | 0 | 15950ba297188163eaadd8ab69268ee7f6ffcf2a | https://github.com/CrispyHarder/ppuda/tree/15950ba297188163eaadd8ab69268ee7f6ffcf2a |
ConvKernel | from torch.nn import Module
import math
import torch
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class _ConvNdKernel(Module):
def __init__(self, in_channels, out_channels, kernel_size, stride,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch.nn.modules.utils import _pair... | MarcCote/spatial-reasoning | ConvKernel | false | 800 | [
"MIT"
] | 0 | 06c57cfafbd1c24b68d6ab634d19806964d867f3 | https://github.com/MarcCote/spatial-reasoning/tree/06c57cfafbd1c24b68d6ab634d19806964d867f3 |
ConvBlock | import torch
from torch import nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self):
super(ConvBlock, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
def forward(self, x):
x ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | MMorafah/FLIS | ConvBlock | false | 801 | [
"MIT"
] | 0 | 7c93ea7498b98f552ed24331eb0dfcc1f9dcacb0 | https://github.com/MMorafah/FLIS/tree/7c93ea7498b98f552ed24331eb0dfcc1f9dcacb0 |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temperature = temperature
self.dropout = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MarcosPampuch/TDNet_CARLA | ScaledDotProductAttention | false | 802 | [
"MIT"
] | 0 | efc1c872966f1cef49b82723170586a6abcfb524 | https://github.com/MarcosPampuch/TDNet_CARLA/tree/efc1c872966f1cef49b82723170586a6abcfb524 |
SegmentationLosses | import torch
import torch.nn as nn
class SegmentationLosses(nn.CrossEntropyLoss):
"""2D Cross Entropy Loss with Auxilary Loss"""
def __init__(self, weight=None, ignore_index=-1):
super(SegmentationLosses, self).__init__(weight, None, ignore_index)
def forward(self, pred, target):
return ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | MarcosPampuch/TDNet_CARLA | SegmentationLosses | false | 803 | [
"MIT"
] | 0 | efc1c872966f1cef49b82723170586a6abcfb524 | https://github.com/MarcosPampuch/TDNet_CARLA/tree/efc1c872966f1cef49b82723170586a6abcfb524 |
QuantValue | import torch
import torch.utils.data
import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class QuantValue_F(torch.autograd.Function):
"""
res = clamp(round(input/pow(2,-m)) * pow(2, -m), -pow(2, N-1), pow(2, N-1) - 1)
"""
@staticmethod
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
impo... | MariusAnje/proxylessnas | QuantValue | false | 804 | [
"Apache-2.0"
] | 0 | e6e37a946e734c731168ce82c244d9878e7fee59 | https://github.com/MariusAnje/proxylessnas/tree/e6e37a946e734c731168ce82c244d9878e7fee59 |
LeNet5Cifar100 | import torch
from torch import nn
import torch.nn.functional as F
class LeNet5Cifar100(nn.Module):
def __init__(self):
super(LeNet5Cifar100, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | MMorafah/FLIS | LeNet5Cifar100 | false | 805 | [
"MIT"
] | 0 | 7c93ea7498b98f552ed24331eb0dfcc1f9dcacb0 | https://github.com/MMorafah/FLIS/tree/7c93ea7498b98f552ed24331eb0dfcc1f9dcacb0 |
PosEnc | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils
from matplotlib import cm as cm
from torch.nn.parallel import *
from torchvision.models import *
from torchvision.datasets import *
class PosEnc(nn.Module):
def __init__(self, C, ks):
super().__init__()
self.weight = nn... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.utils
from matplotlib import cm as cm
from torch.nn.parallel import *
from torchv... | CrispyHarder/ppuda | PosEnc | false | 806 | [
"MIT"
] | 0 | 15950ba297188163eaadd8ab69268ee7f6ffcf2a | https://github.com/CrispyHarder/ppuda/tree/15950ba297188163eaadd8ab69268ee7f6ffcf2a |
MeanPool | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.checkpoint
class MeanPool(nn.Module):
def __init__(self):
super(MeanPool, self).__init__()
def forward(self, input):
x = input.mean(dim=1)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.utils.checkpoint
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
... | MarvinLvn/platalea | MeanPool | false | 807 | [
"Apache-2.0"
] | 0 | 31def0813c90a3259f86f7d86cb576cd66dca3fe | https://github.com/MarvinLvn/platalea/tree/31def0813c90a3259f86f7d86cb576cd66dca3fe |
FPNOutput | import torch
import torch.nn as nn
class ConvBNReLU(nn.Module):
def __init__(self, in_chan, out_chan, ks=1, stride=1, padding=0,
norm_layer=None, bias=True, *args, **kwargs):
super(ConvBNReLU, self).__init__()
self.conv = nn.Conv2d(in_chan, out_chan, kernel_size=ks, stride=
st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | MarcosPampuch/TDNet_CARLA | FPNOutput | false | 808 | [
"MIT"
] | 0 | efc1c872966f1cef49b82723170586a6abcfb524 | https://github.com/MarcosPampuch/TDNet_CARLA/tree/efc1c872966f1cef49b82723170586a6abcfb524 |
PEScaling | from torch.nn import Module
import torch
from torch import nn
class PEScaling(Module):
def __init__(self):
super(PEScaling, self).__init__()
self.relu = nn.ReLU()
self.sigmoid = nn.Sigmoid()
self.linear1 = nn.Linear(1, 1)
self.linear2 = nn.Linear(1, 1)
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.nn import Module
f... | M4rt1nM4yr/recipient_line_detection_DAS22 | PEScaling | false | 809 | [
"MIT"
] | 0 | be5ed87940ff2c2740cf86130743538a2ba6ac4b | https://github.com/M4rt1nM4yr/recipient_line_detection_DAS22/tree/be5ed87940ff2c2740cf86130743538a2ba6ac4b |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super(PositionwiseFeedForward, self).__init__()
self.w_1 = nn.Conv1d(d_in, d_hid, 1)
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.... | MarcosPampuch/TDNet_CARLA | PositionwiseFeedForward | false | 810 | [
"MIT"
] | 0 | efc1c872966f1cef49b82723170586a6abcfb524 | https://github.com/MarcosPampuch/TDNet_CARLA/tree/efc1c872966f1cef49b82723170586a6abcfb524 |
MemoryLayer | import torch
import numpy as np
import torch.nn as nn
class MemoryLayer(nn.Module):
def __init__(self, input_dim, memory_dim, model_dim, mlp_dim, dropout_p):
super(MemoryLayer, self).__init__()
self.input_dim = input_dim
self.memory_dim = memory_dim
self.model_dim = model_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.... | MaryZolfaghar/WCSLS | MemoryLayer | false | 811 | [
"Apache-2.0"
] | 0 | fcb3bfd11c19bb90690ec772f91bbd107832d636 | https://github.com/MaryZolfaghar/WCSLS/tree/fcb3bfd11c19bb90690ec772f91bbd107832d636 |
ConvToVector | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvToVector(nn.Module):
def __init__(self, in_channels, padding=1):
super(ConvToVector, self).__init__()
self.in_channels = in_channels
self.conv1 = nn.Conv2d(in_channels, 3, kernel_size=3, padding=padding)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MarcCote/spatial-reasoning | ConvToVector | false | 812 | [
"MIT"
] | 0 | 06c57cfafbd1c24b68d6ab634d19806964d867f3 | https://github.com/MarcCote/spatial-reasoning/tree/06c57cfafbd1c24b68d6ab634d19806964d867f3 |
MultiLayeredConv1d | import torch
import torch.utils.data.distributed
import torch.utils.data
class MultiLayeredConv1d(torch.nn.Module):
"""Multi-layered conv1d for Transformer block.
This is a module of multi-leyered conv1d designed
to replace positionwise feed-forward network
in Transforner block, which is introduced 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 import triton_helpers
import torch.utils.data.distr... | MarkWuNLP/StreamingTransformer | MultiLayeredConv1d | false | 813 | [
"Apache-2.0"
] | 0 | df9bfe348608b7e55ef1ff70464070c0055ea799 | https://github.com/MarkWuNLP/StreamingTransformer/tree/df9bfe348608b7e55ef1ff70464070c0055ea799 |
MultiHeadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn
class MultiHeadAttention(nn.Module):
def __init__(self, embed_size, num_heads, dropout=0.2, batch_dim=0):
super(MultiHeadAttention, self).__init__()
self.embed_size = embed_size
self.num_heads =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ManojKesani/Transformer-Implementations | MultiHeadAttention | false | 814 | [
"MIT"
] | 0 | faca89d44523da80073790d53e53b4e80bde736f | https://github.com/ManojKesani/Transformer-Implementations/tree/faca89d44523da80073790d53e53b4e80bde736f |
LastLevelMaxPool | import torch
import torch.utils.data
from torchvision.transforms import functional as F
from torch import nn
import torch.nn.functional as F
class LastLevelMaxPool(nn.Module):
def forward(self, x):
return [F.max_pool2d(x, 1, 2, 0)]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | Friedrich1006/maskrcnn-benchmark | LastLevelMaxPool | false | 815 | [
"MIT"
] | 0 | bfd36ce2b90218e0805dc30e72be9257a9bc129b | https://github.com/Friedrich1006/maskrcnn-benchmark/tree/bfd36ce2b90218e0805dc30e72be9257a9bc129b |
NormalLikelihood | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.utils
from matplotlib import cm as cm
from torch.nn.parallel import *
from torchvision.models import *
from torchvision.datasets import *
class NormalLikelihood(nn.Module):
def __init__(self):
super(NormalLikelihoo... | 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
... | CrispyHarder/ppuda | NormalLikelihood | false | 816 | [
"MIT"
] | 0 | 15950ba297188163eaadd8ab69268ee7f6ffcf2a | https://github.com/CrispyHarder/ppuda/tree/15950ba297188163eaadd8ab69268ee7f6ffcf2a |
ChannelSELayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils
from matplotlib import cm as cm
from torch.nn.parallel import *
from torchvision.models import *
from torchvision.datasets import *
class ChannelSELayer(nn.Module):
"""
Copied from https://github.com/ai-med/squeeze_and_excitation/bl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CrispyHarder/ppuda | ChannelSELayer | false | 817 | [
"MIT"
] | 0 | 15950ba297188163eaadd8ab69268ee7f6ffcf2a | https://github.com/CrispyHarder/ppuda/tree/15950ba297188163eaadd8ab69268ee7f6ffcf2a |
EdgeClassifLoss | import torch
import torch.optim
class EdgeClassifLoss(torch.nn.Module):
def __init__(self, normalize=torch.nn.Sigmoid(), loss=torch.nn.BCELoss(
reduction='mean')):
super(EdgeClassifLoss, self).__init__()
if isinstance(loss, torch.nn.BCELoss):
self.loss = lambda preds, target: ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | MauTrib/gnn-en-folie | EdgeClassifLoss | false | 818 | [
"Apache-2.0"
] | 0 | 3ca639919a2b285a41641717f4131107c015b510 | https://github.com/MauTrib/gnn-en-folie/tree/3ca639919a2b285a41641717f4131107c015b510 |
OhemCELoss2D | import math
import torch
import torch.nn as nn
class OhemCELoss2D(nn.CrossEntropyLoss):
"""2D Cross Entropy Loss with Auxilary Loss"""
def __init__(self, n_min, thresh=0.7, ignore_index=-1):
super(OhemCELoss2D, self).__init__(None, None, ignore_index,
reduction='none')
self.thresh... | 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 math
import tor... | MarcosPampuch/TDNet_CARLA | OhemCELoss2D | false | 819 | [
"MIT"
] | 0 | efc1c872966f1cef49b82723170586a6abcfb524 | https://github.com/MarcosPampuch/TDNet_CARLA/tree/efc1c872966f1cef49b82723170586a6abcfb524 |
LinearAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.checkpoint
class LinearAttention(nn.Module):
def __init__(self, in_size):
super(LinearAttention, self).__init__()
self.out = nn.Linear(in_size, 1)
nn.init.orthogonal_(self.out.weight.data)
self.softmax =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MarvinLvn/platalea | LinearAttention | false | 820 | [
"Apache-2.0"
] | 0 | 31def0813c90a3259f86f7d86cb576cd66dca3fe | https://github.com/MarvinLvn/platalea/tree/31def0813c90a3259f86f7d86cb576cd66dca3fe |
ColumnMaxPooling | import torch
import torch.optim
import torch.nn as nn
class ColumnMaxPooling(nn.Module):
"""
take a batch (bs, n_vertices, n_vertices, in_features)
and returns (bs, n_vertices, in_features)
"""
def __init__(self):
super().__init__()
def forward(self, x):
return torch.max(x, 2... | 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.optim
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.ass... | MauTrib/gnn-en-folie | ColumnMaxPooling | false | 821 | [
"Apache-2.0"
] | 0 | 3ca639919a2b285a41641717f4131107c015b510 | https://github.com/MauTrib/gnn-en-folie/tree/3ca639919a2b285a41641717f4131107c015b510 |
Conv1dLinear | import torch
import torch.utils.data.distributed
import torch.utils.data
class Conv1dLinear(torch.nn.Module):
"""Conv1D + Linear for Transformer block.
A variant of MultiLayeredConv1d, which replaces second conv-layer to linear.
"""
def __init__(self, in_chans, hidden_chans, kernel_size, dropout_ra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data.distr... | MarkWuNLP/StreamingTransformer | Conv1dLinear | false | 822 | [
"Apache-2.0"
] | 0 | df9bfe348608b7e55ef1ff70464070c0055ea799 | https://github.com/MarkWuNLP/StreamingTransformer/tree/df9bfe348608b7e55ef1ff70464070c0055ea799 |
TransformerDecoderLayer | from torch.nn import Module
import torch
from torch.nn import functional as F
from torch.nn import MultiheadAttention
from torch.nn import Dropout
from torch.nn import Linear
from torch.nn import LayerNorm
def _get_activation_fn(activation):
if activation == 'relu':
return F.relu
elif activation == 'g... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | M4rt1nM4yr/recipient_line_detection_DAS22 | TransformerDecoderLayer | false | 823 | [
"MIT"
] | 0 | be5ed87940ff2c2740cf86130743538a2ba6ac4b | https://github.com/M4rt1nM4yr/recipient_line_detection_DAS22/tree/be5ed87940ff2c2740cf86130743538a2ba6ac4b |
CNN | import torch
import numpy as np
import torch.nn as nn
class CNN(nn.Module):
def __init__(self, state_dim):
super(CNN, self).__init__()
self.state_dim = state_dim
self.image_size = 64
self.in_channels = 1
self.kernel_size = 3
self.padding = 0
self.stride = 2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | MaryZolfaghar/WCSLS | CNN | false | 824 | [
"Apache-2.0"
] | 0 | fcb3bfd11c19bb90690ec772f91bbd107832d636 | https://github.com/MaryZolfaghar/WCSLS/tree/fcb3bfd11c19bb90690ec772f91bbd107832d636 |
PositionwiseFeedForward | import torch
from torch import nn as nn
import torch.utils.data.distributed
def get_activation_function(activation: 'str') ->nn.Module:
"""
Gets an activation function module given the name of the activation.
:param activation: The name of the activation function.
:return: The activation function 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 import nn as nn
import torch.utils.data.distributed
assert_size_strid... | MatthewMasters/grover | PositionwiseFeedForward | false | 825 | [
"MIT"
] | 0 | 737a340754bc4c63134ef84019a0a84023fd69a3 | https://github.com/MatthewMasters/grover/tree/737a340754bc4c63134ef84019a0a84023fd69a3 |
L2Norm | import torch
from torch import nn
from torchvision.models.resnet import *
class L2Norm(nn.Module):
def forward(self, x, eps=1e-06):
norm = x.norm(dim=1, keepdim=True).clamp(min=eps)
return x / norm
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | DSciLab/SSLab | L2Norm | false | 826 | [
"MIT"
] | 0 | 9eeef8cebfa01b079779259a2ded4138bf54c1ff | https://github.com/DSciLab/SSLab/tree/9eeef8cebfa01b079779259a2ded4138bf54c1ff |
LanguageModelCriterion | import torch
import torch.nn as nn
from torch.autograd import *
class LanguageModelCriterion(nn.Module):
def __init__(self):
super(LanguageModelCriterion, self).__init__()
def forward(self, input, target, mask):
target = target[:, :input.size(1)]
mask = mask[:, :input.size(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 torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Maxi-0902/DRAN | LanguageModelCriterion | false | 827 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
ConvBlock | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, norm=None):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2d(input_size, output_size, kernel_size, stride,
padding, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | MatusBako/MakeFacesGreatAgain | ConvBlock | false | 828 | [
"MIT"
] | 0 | e4941a8460db79dec566ed02d4b23eafb416a6db | https://github.com/MatusBako/MakeFacesGreatAgain/tree/e4941a8460db79dec566ed02d4b23eafb416a6db |
SelfAttention | import torch
from torch import nn
class SelfAttention(nn.Module):
def __init__(self, dim, heads=8):
super(SelfAttention, self).__init__()
self.dim, self.heads = dim, heads
self.Q = nn.Linear(dim, dim * heads, bias=False)
self.K = nn.Linear(dim, dim * heads, bias=False)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MartrixG/transformer | SelfAttention | false | 829 | [
"MIT"
] | 0 | 8cd1e31d11aff6059fad28d4cfe27e936d611c8c | https://github.com/MartrixG/transformer/tree/8cd1e31d11aff6059fad28d4cfe27e936d611c8c |
AffineConstantFlow | import torch
import torch.nn as nn
class AffineConstantFlow(nn.Module):
"""
Scales + Shifts the flow by (learned) constants per dimension.
In NICE paper there is a Scaling layer which is a special case of this where t is None
"""
def __init__(self, dim, scale=True, shift=True):
super(Affi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | MattiaVarrone/nnest | AffineConstantFlow | false | 830 | [
"MIT"
] | 0 | 9e12be0135ba2e7fa186a904bc33480c3b0c655a | https://github.com/MattiaVarrone/nnest/tree/9e12be0135ba2e7fa186a904bc33480c3b0c655a |
Features_2_to_1 | import torch
import torch.optim
import torch.nn as nn
class Features_2_to_1(nn.Module):
def __init__(self):
"""
take a batch (bs, n_vertices, n_vertices, in_features)
and returns (bs, n_vertices, basis * in_features)
where basis = 5
"""
super().__init__()
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.optim
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.ass... | MauTrib/gnn-en-folie | Features_2_to_1 | false | 831 | [
"Apache-2.0"
] | 0 | 3ca639919a2b285a41641717f4131107c015b510 | https://github.com/MauTrib/gnn-en-folie/tree/3ca639919a2b285a41641717f4131107c015b510 |
Scale | import torch
import torch.nn as nn
class Scale(nn.Module):
def __init__(self, scale=30):
super(Scale, self).__init__()
self.scale = scale
def forward(self, x):
return x * self.scale
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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MickeyZeng/Data-Visualization | Scale | false | 832 | [
"MIT"
] | 0 | c7005d1096545d7a5eb96dd0c9bc13e874d42fa4 | https://github.com/MickeyZeng/Data-Visualization/tree/c7005d1096545d7a5eb96dd0c9bc13e874d42fa4 |
MutualBiAffineAttention | import torch
import torch.nn as nn
from torch.autograd import *
class MutualBiAffineAttention(nn.Module):
"""
Mutual BiAffine Attention between 2 kinds of features.
"""
def __init__(self, hidden_size):
super(MutualBiAffineAttention, self).__init__()
self.linear1 = nn.Linear(2 * hidden... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Maxi-0902/DRAN | MutualBiAffineAttention | false | 833 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
DownBlock | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, norm=None):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2d(input_size, output_size, kernel_size, stride,
padding, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | MatusBako/MakeFacesGreatAgain | DownBlock | false | 834 | [
"MIT"
] | 0 | e4941a8460db79dec566ed02d4b23eafb416a6db | https://github.com/MatusBako/MakeFacesGreatAgain/tree/e4941a8460db79dec566ed02d4b23eafb416a6db |
RewardCriterion | import torch
import torch.nn as nn
from torch.autograd import *
def to_contiguous(tensor):
if tensor.is_contiguous():
return tensor
else:
return tensor.contiguous()
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Maxi-0902/DRAN | RewardCriterion | false | 835 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
SelfAttention | import torch
from torch import nn as nn
import torch.utils.data.distributed
class SelfAttention(nn.Module):
"""
Self SelfAttention Layer
Given $X\\in \\mathbb{R}^{n imes in_feature}$, the attention is calculated by: $a=Softmax(W_2tanh(W_1X))$, where
$W_1 \\in \\mathbb{R}^{hidden imes in_fea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MatthewMasters/grover | SelfAttention | false | 836 | [
"MIT"
] | 0 | 737a340754bc4c63134ef84019a0a84023fd69a3 | https://github.com/MatthewMasters/grover/tree/737a340754bc4c63134ef84019a0a84023fd69a3 |
DWConv | import torch
import torch.nn as nn
class DWConv(nn.Module):
def __init__(self, dim=768):
super(DWConv, self).__init__()
self.dwconv = nn.Conv2d(dim, dim, 3, 1, 1, bias=True, groups=dim)
def forward(self, x):
x = self.dwconv(x)
return x
def get_inputs():
return [torch.ra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | LSH9832/MyPythonModules | DWConv | false | 837 | [
"MIT"
] | 0 | 442566a0fbd6ebe2bc20b6914686a1e2663d10c0 | https://github.com/LSH9832/MyPythonModules/tree/442566a0fbd6ebe2bc20b6914686a1e2663d10c0 |
Squareplus | import torch
import torch as t
import torch.nn as nn
class Squareplus(nn.Module):
def __init__(self, a=2):
super().__init__()
self.a = a
def forward(self, x):
"""The 'squareplus' activation function: has very similar properties to
softplus, but is far cheaper computationally.... | 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_... | MaximeRobeyns/BDRL | Squareplus | false | 838 | [
"Apache-2.0"
] | 0 | 55e295d5aaca6745d35525114b472ad118c14a6d | https://github.com/MaximeRobeyns/BDRL/tree/55e295d5aaca6745d35525114b472ad118c14a6d |
DiceBCELoss | import torch
from torch import nn
from torch.nn import functional as F
class DiceBCELoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(DiceBCELoss, self).__init__()
def forward(self, inputs, targets, smooth=1):
inputs = torch.sigmoid(inputs)
inputs = inputs.vi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | Michaelistaken/PathPretrain | DiceBCELoss | false | 839 | [
"MIT"
] | 0 | 650b7eb02e67f6d864d81808eb7230c48fe6946a | https://github.com/Michaelistaken/PathPretrain/tree/650b7eb02e67f6d864d81808eb7230c48fe6946a |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(DiceLoss, self).__init__()
def forward(self, inputs, targets):
intersection = (inputs * targets).sum()
dice = (2.0 * intersection + 1e-05) / (inputs.sum() + targets... | 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... | MohannadEhabBarakat/U-2-Net | DiceLoss | false | 840 | [
"Apache-2.0"
] | 0 | 89a4eba7a565e7afcd4ac04b11b55099ebef687c | https://github.com/MohannadEhabBarakat/U-2-Net/tree/89a4eba7a565e7afcd4ac04b11b55099ebef687c |
MSELoss | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss ten... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import functools
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride... | Min-Sheng/mmregression | MSELoss | false | 841 | [
"Apache-2.0"
] | 0 | 6d70383d89ccb3dea7f425b665c2a184d014a99f | https://github.com/Min-Sheng/mmregression/tree/6d70383d89ccb3dea7f425b665c2a184d014a99f |
UpBlock | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, norm=None):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2d(input_size, output_size, kernel_size, stride,
padding, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | MatusBako/MakeFacesGreatAgain | UpBlock | false | 842 | [
"MIT"
] | 0 | e4941a8460db79dec566ed02d4b23eafb416a6db | https://github.com/MatusBako/MakeFacesGreatAgain/tree/e4941a8460db79dec566ed02d4b23eafb416a6db |
AdaptiveAveragePooling | import torch
import torch.nn as nn
class AdaptiveAveragePooling(nn.Module):
"""Adaptive Pooling neck.
Args:
dim (int): Dimensions of each sample channel, can be one of {1, 2, 3}.
Default: 2
output_size (int | tuple): output size,
If dim equals to 1: output_size is a ... | 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... | Min-Sheng/mmregression | AdaptiveAveragePooling | false | 843 | [
"Apache-2.0"
] | 0 | 6d70383d89ccb3dea7f425b665c2a184d014a99f | https://github.com/Min-Sheng/mmregression/tree/6d70383d89ccb3dea7f425b665c2a184d014a99f |
DiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes are transformed as follows:
(N, C, D, H, W) -> (C, N * D * H * W)
"""
C = tensor.size(1)
axis_order = (1, 0) + tuple(range(2, te... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | MikoyChinese/Learn | DiceLoss | false | 844 | [
"Apache-2.0"
] | 0 | c482b1e84496279935b5bb2cfc1e6d78e2868c63 | https://github.com/MikoyChinese/Learn/tree/c482b1e84496279935b5bb2cfc1e6d78e2868c63 |
Residual_Block | import torch
import torch.nn as nn
from torch import add
class Residual_Block(nn.Module):
def __init__(self):
super(Residual_Block, self).__init__()
self.conv1 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size
=3, padding=1, bias=False)
self.in1 = nn.InstanceNorm2d(64, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MatusBako/MakeFacesGreatAgain | Residual_Block | false | 845 | [
"MIT"
] | 0 | e4941a8460db79dec566ed02d4b23eafb416a6db | https://github.com/MatusBako/MakeFacesGreatAgain/tree/e4941a8460db79dec566ed02d4b23eafb416a6db |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
from torch.autograd import *
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dime... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Maxi-0902/DRAN | ScaledDotProductAttention | false | 846 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
activation_quantize_fn | import torch
import torch.utils.data
import torch.nn as nn
def uniform_quantize(k):
class qfn(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
if k == 32:
out = input
elif k == 1:
out = torch.sign(input)
else:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dy... | MohammedHAlali/pytorch_DoReFaNet | activation_quantize_fn | false | 847 | [
"MIT"
] | 0 | d208089b9172f02c09cc6633158ed5b5d6cd7f1e | https://github.com/MohammedHAlali/pytorch_DoReFaNet/tree/d208089b9172f02c09cc6633158ed5b5d6cd7f1e |
FeedForward | import torch
import torch.nn.functional as F
from torch import nn
class FeedForward(nn.Module):
def __init__(self, num_features, expansion_factor, dropout):
super().__init__()
num_hidden = expansion_factor * num_features
self.fc1 = nn.Linear(num_features, num_hidden)
self.fc2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Misuzu-Kurenai/mlp-singer | FeedForward | false | 848 | [
"MIT"
] | 0 | 416451045bb9b3965aaf496e84a8b45332a6ba59 | https://github.com/Misuzu-Kurenai/mlp-singer/tree/416451045bb9b3965aaf496e84a8b45332a6ba59 |
ScaledDotProductWithBoxAttention | import torch
import numpy as np
import torch.nn as nn
from torch.autograd import *
class ScaledDotProductWithBoxAttention(nn.Module):
"""
Scaled dot-product attention with box
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1, comment=None):
"""
:param d_model: Output dimension... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Maxi-0902/DRAN | ScaledDotProductWithBoxAttention | false | 849 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
GlobalAveragePooling | import torch
import torch.nn as nn
import torch.nn.functional as F
class GlobalAveragePooling(nn.Module):
def __init__(self):
super(GlobalAveragePooling, self).__init__()
def forward(self, feat):
num_channels = feat.size(1)
return F.avg_pool2d(feat, (feat.size(2), feat.size(3))).view... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MrChenFeng/Project-Template | GlobalAveragePooling | false | 850 | [
"MIT"
] | 0 | 42a335c6abb710bbae6407cbb0ca461533bc12f9 | https://github.com/MrChenFeng/Project-Template/tree/42a335c6abb710bbae6407cbb0ca461533bc12f9 |
RadialPredictionLayer | import torch
import torch.nn as nn
class RadialPredictionLayer(torch.nn.Module):
""" The RPL classification layer with fixed prototypes
"""
def __init__(self, in_features, out_features):
super(RadialPredictionLayer, self).__init__()
self.in_features = in_features
self.out_features... | 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_... | Monkso/RPL-Softmax_RoadSigns | RadialPredictionLayer | false | 851 | [
"MIT"
] | 0 | 3df929d779ff02ec796e717659943bb46311ba0f | https://github.com/Monkso/RPL-Softmax_RoadSigns/tree/3df929d779ff02ec796e717659943bb46311ba0f |
BBoxTransform | import torch
import torch.nn as nn
class BBoxTransform(nn.Module):
def forward(self, anchors, regression):
"""
Args:
anchors: [batch_size, boxes, (y1, x1, y2, x2)]
regression: [batch_size, boxes, (dy, dx, dh, dw)]
"""
y_centers_a = (anchors[..., 0] + anchor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | MikoyChinese/Learn | BBoxTransform | false | 852 | [
"Apache-2.0"
] | 0 | c482b1e84496279935b5bb2cfc1e6d78e2868c63 | https://github.com/MikoyChinese/Learn/tree/c482b1e84496279935b5bb2cfc1e6d78e2868c63 |
weight_quantize_fn | import torch
import torch.utils.data
import torch.nn as nn
def uniform_quantize(k):
class qfn(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
if k == 32:
out = input
elif k == 1:
out = torch.sign(input)
else:
... | 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... | MohammedHAlali/pytorch_DoReFaNet | weight_quantize_fn | false | 853 | [
"MIT"
] | 0 | d208089b9172f02c09cc6633158ed5b5d6cd7f1e | https://github.com/MohammedHAlali/pytorch_DoReFaNet/tree/d208089b9172f02c09cc6633158ed5b5d6cd7f1e |
RBFLayer | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class RBFLayer(nn.Module):
"""
Transforms incoming data using a given radial basis function:
u_{i} = rbf(||x - c_{i}|| / s_{i})
Arguments:
in_features: 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.triton_helpers import libdevice, math as tl_math
from torch import nn
import torch.nn.parallel
import torch.opt... | MorganeAyle/SNIP-it | RBFLayer | false | 854 | [
"MIT"
] | 0 | df2bf44d6d3f7e4ea7733242a79c916735a7b49e | https://github.com/MorganeAyle/SNIP-it/tree/df2bf44d6d3f7e4ea7733242a79c916735a7b49e |
ChannelMixer | import torch
import torch.nn.functional as F
from torch import nn
class FeedForward(nn.Module):
def __init__(self, num_features, expansion_factor, dropout):
super().__init__()
num_hidden = expansion_factor * num_features
self.fc1 = nn.Linear(num_features, num_hidden)
self.fc2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.fun... | Misuzu-Kurenai/mlp-singer | ChannelMixer | false | 855 | [
"MIT"
] | 0 | 416451045bb9b3965aaf496e84a8b45332a6ba59 | https://github.com/Misuzu-Kurenai/mlp-singer/tree/416451045bb9b3965aaf496e84a8b45332a6ba59 |
TokenMixer | import torch
import torch.nn.functional as F
from torch import nn
class FeedForward(nn.Module):
def __init__(self, num_features, expansion_factor, dropout):
super().__init__()
num_hidden = expansion_factor * num_features
self.fc1 = nn.Linear(num_features, num_hidden)
self.fc2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.fun... | Misuzu-Kurenai/mlp-singer | TokenMixer | false | 856 | [
"MIT"
] | 0 | 416451045bb9b3965aaf496e84a8b45332a6ba59 | https://github.com/Misuzu-Kurenai/mlp-singer/tree/416451045bb9b3965aaf496e84a8b45332a6ba59 |
MultiHeadBoxAttention | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
from torch.autograd import *
class ScaledDotProductWithBoxAttention(nn.Module):
"""
Scaled dot-product attention with box
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1, comment=None):
"""
:par... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Maxi-0902/DRAN | MultiHeadBoxAttention | false | 857 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
FixedSubnetConv | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class FixedSubnetConv(nn.Conv2d):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
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 math
from torch import nn
import torch.nn.parallel
import torch.optim
imp... | MorganeAyle/SNIP-it | FixedSubnetConv | false | 858 | [
"MIT"
] | 0 | df2bf44d6d3f7e4ea7733242a79c916735a7b49e | https://github.com/MorganeAyle/SNIP-it/tree/df2bf44d6d3f7e4ea7733242a79c916735a7b49e |
SplitChannels | import torch
class SplitChannels(torch.nn.Module):
def __init__(self, split_location):
super(SplitChannels, self).__init__()
self.split_location = split_location
def forward(self, x):
a, b = x[:, :self.split_location], x[:, self.split_location:]
a, b = a.clone(), b.clone()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Myyyr/segmentation | SplitChannels | false | 859 | [
"MIT"
] | 0 | 6b9423e327cff1eb23599404031b7fb8e9ecf75d | https://github.com/Myyyr/segmentation/tree/6b9423e327cff1eb23599404031b7fb8e9ecf75d |
PoseMap | import torch
import torch.nn as nn
class PoseMap(nn.Module):
def __init__(self):
super(PoseMap, self).__init__()
pass
def forward(self, x):
assert len(x.shape) == 4, 'The HeatMap shape should be BxCxHxW'
res = x.sum(dim=1, keepdim=True)
H = x.shape[2]
W = x.sh... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MrChenFeng/Project-Template | PoseMap | false | 860 | [
"MIT"
] | 0 | 42a335c6abb710bbae6407cbb0ca461533bc12f9 | https://github.com/MrChenFeng/Project-Template/tree/42a335c6abb710bbae6407cbb0ca461533bc12f9 |
ScalarAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.checkpoint
class ScalarAttention(nn.Module):
def __init__(self, in_size, hidden_size):
super(ScalarAttention, self).__init__()
self.hidden = nn.Linear(in_size, hidden_size)
nn.init.orthogonal_(self.hidden.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
from torch._inductor.runtime.... | MarvinLvn/platalea | ScalarAttention | false | 861 | [
"Apache-2.0"
] | 0 | 31def0813c90a3259f86f7d86cb576cd66dca3fe | https://github.com/MarvinLvn/platalea/tree/31def0813c90a3259f86f7d86cb576cd66dca3fe |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
from torch.autograd import *
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the 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
from torch._inductor.runtime.... | Maxi-0902/DRAN | MultiHeadAttention | false | 862 | [
"MIT"
] | 0 | c3dbfcbc018446544150dc4e151442d6a9fcd4d9 | https://github.com/Maxi-0902/DRAN/tree/c3dbfcbc018446544150dc4e151442d6a9fcd4d9 |
MNIST_classifier | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class MNIST_classifier(nn.Module):
def __init__(self):
super(MNIST_classifier, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 5, stride=2)
self.conv2 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | MorganeAyle/SNIP-it | MNIST_classifier | false | 863 | [
"MIT"
] | 0 | df2bf44d6d3f7e4ea7733242a79c916735a7b49e | https://github.com/MorganeAyle/SNIP-it/tree/df2bf44d6d3f7e4ea7733242a79c916735a7b49e |
QuickGELU | import torch
from torch import nn
import torch.distributed.nn
class QuickGELU(nn.Module):
def forward(self, x: 'torch.Tensor'):
return x * torch.sigmoid(1.702 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.distributed.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch.... | NYU-DICE-Lab/open_clip | QuickGELU | false | 864 | [
"MIT"
] | 0 | fd71804b503135fb1c7cc8de3a0d6599741c8ed9 | https://github.com/NYU-DICE-Lab/open_clip/tree/fd71804b503135fb1c7cc8de3a0d6599741c8ed9 |
QREmbeddingBag | import torch
import numpy as np
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
class QREmbeddingBag(nn.Module):
"""Computes sums or means over two 'bags' of embeddings, one using the quotient
of the indices and the other using the remainder of the indices, witho... | 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 numpy as np
import torch.nn as nn
from torch.nn.parameter import Paramet... | MrDoghead/dlrm | QREmbeddingBag | false | 865 | [
"MIT"
] | 0 | 9b0d8ea992daa515104c7967f30110684283ebb1 | https://github.com/MrDoghead/dlrm/tree/9b0d8ea992daa515104c7967f30110684283ebb1 |
MixerBlock | import torch
import torch.nn.functional as F
from torch import nn
class FeedForward(nn.Module):
def __init__(self, num_features, expansion_factor, dropout):
super().__init__()
num_hidden = expansion_factor * num_features
self.fc1 = nn.Linear(num_features, num_hidden)
self.fc2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.fun... | Misuzu-Kurenai/mlp-singer | MixerBlock | false | 866 | [
"MIT"
] | 0 | 416451045bb9b3965aaf496e84a8b45332a6ba59 | https://github.com/Misuzu-Kurenai/mlp-singer/tree/416451045bb9b3965aaf496e84a8b45332a6ba59 |
linformerAttention | import torch
from torch import nn
def get_EF(input_size, dim, method='learnable', head_dim=None, bias=True):
"""
Retuns the E or F matrix, initialized via xavier initialization.
This is the recommended way to do it according to the authors of the paper.
Includes a method for convolution, as well as a ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MohammadrezaRezvani/performer-pytorch | linformerAttention | false | 867 | [
"MIT"
] | 0 | 347dd58111f4f79b8991f7609552203609856b4b | https://github.com/MohammadrezaRezvani/performer-pytorch/tree/347dd58111f4f79b8991f7609552203609856b4b |
FGFunction | import torch
from torch import nn
from torch.nn import functional as F
class FGFunction(nn.Module):
"""Module used for F and G
Archi :
conv -> BN -> ReLu -> conv -> BN -> ReLu
"""
def __init__(self, channels):
super(FGFunction, self).__init__()
self.gn1 = nn.GroupNorm(1, channels, eps=0.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Myyyr/segmentation | FGFunction | false | 868 | [
"MIT"
] | 0 | 6b9423e327cff1eb23599404031b7fb8e9ecf75d | https://github.com/Myyyr/segmentation/tree/6b9423e327cff1eb23599404031b7fb8e9ecf75d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.