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 |
|---|---|---|---|---|---|---|---|---|---|---|
SplitCosineLinear | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn import functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.nn.modules.module import Module
class CosineLinear(Module):
def __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
from torch._inductor.runtime.... | JosephKJ/class-incremental-learning | SplitCosineLinear | false | 17,520 | [
"MIT"
] | 8 | 689271b84f2e553930ca6687d036ac99bd84b311 | https://github.com/JosephKJ/class-incremental-learning/tree/689271b84f2e553930ca6687d036ac99bd84b311 |
SimpleSSM | import math
import torch
import torch.nn as nn
class MatrixMultiplication(nn.Module):
"""
batch operation supporting matrix multiplication layer
"""
def __init__(self, in_features: 'int', out_features: 'int'):
super(MatrixMultiplication, self).__init__()
self.in_features = in_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | Junyoungpark/2021-lg-AI-camp | SimpleSSM | false | 17,521 | [
"MIT"
] | 4 | 3c0e5dd689e8e3dd61cc80243ad90cab951c06de | https://github.com/Junyoungpark/2021-lg-AI-camp/tree/3c0e5dd689e8e3dd61cc80243ad90cab951c06de |
SPPblock | import torch
import torch.nn as nn
import torch.nn.functional as F
class SPPblock(nn.Module):
def __init__(self, in_channels):
super(SPPblock, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=[2, 2], stride=2)
self.pool2 = nn.MaxPool2d(kernel_size=[3, 3], stride=3)
self.pool... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | JACKYLUO1991/HybridNet | SPPblock | false | 17,522 | [
"Apache-2.0"
] | 6 | eb97d8a048ca4bb4087bc542360172e169a08dbf | https://github.com/JACKYLUO1991/HybridNet/tree/eb97d8a048ca4bb4087bc542360172e169a08dbf |
group | import torch
import torch.nn as nn
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if type == 1:
self.filter = nn.Conv2d(in_channels, 2 * out_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | JunhongH/CP-GAN | group | false | 17,523 | [
"Apache-2.0"
] | 9 | 5ac129da8cf6d010dc0da03bb4637d20c822d50b | https://github.com/JunhongH/CP-GAN/tree/5ac129da8cf6d010dc0da03bb4637d20c822d50b |
resblock | import torch
import torch.nn as nn
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if type == 1:
self.filter = nn.Conv2d(in_channels, 2 * out_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | JunhongH/CP-GAN | resblock | false | 17,524 | [
"Apache-2.0"
] | 9 | 5ac129da8cf6d010dc0da03bb4637d20c822d50b | https://github.com/JunhongH/CP-GAN/tree/5ac129da8cf6d010dc0da03bb4637d20c822d50b |
mfm | import torch
import torch.nn as nn
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if type == 1:
self.filter = nn.Conv2d(in_channels, 2 * out_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | JunhongH/CP-GAN | mfm | false | 17,525 | [
"Apache-2.0"
] | 9 | 5ac129da8cf6d010dc0da03bb4637d20c822d50b | https://github.com/JunhongH/CP-GAN/tree/5ac129da8cf6d010dc0da03bb4637d20c822d50b |
Simulator | import math
import torch
import torch.nn as nn
class MatrixMultiplication(nn.Module):
"""
batch operation supporting matrix multiplication layer
"""
def __init__(self, in_features: 'int', out_features: 'int'):
super(MatrixMultiplication, self).__init__()
self.in_features = in_feat... | 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
import math
import torch.nn as nn
assert_size_stride = ... | Junyoungpark/2021-lg-AI-camp | Simulator | false | 17,526 | [
"MIT"
] | 4 | 3c0e5dd689e8e3dd61cc80243ad90cab951c06de | https://github.com/Junyoungpark/2021-lg-AI-camp/tree/3c0e5dd689e8e3dd61cc80243ad90cab951c06de |
GaussianLayer | import torch
import torch.nn as nn
class GaussianLayer(nn.Module):
def __init__(self, input_dim, output_dim):
super(GaussianLayer, self).__init__()
self.z_mu = torch.nn.Linear(input_dim, output_dim)
self.z_sigma = torch.nn.Linear(input_dim, output_dim)
def forward(self, x):
m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | Junyoungpark/2021-lg-AI-camp | GaussianLayer | false | 17,527 | [
"MIT"
] | 4 | 3c0e5dd689e8e3dd61cc80243ad90cab951c06de | https://github.com/Junyoungpark/2021-lg-AI-camp/tree/3c0e5dd689e8e3dd61cc80243ad90cab951c06de |
BiaffineScorer | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class BiaffineScorer(nn.Module):
def __init__(self, input1_size, input2_size, output_size):
super().__init__()
self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1,
output_size)
self.W_bilin.w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | KaijuML/dtt-multi-branch | BiaffineScorer | false | 17,528 | [
"Apache-2.0"
] | 8 | a49850a95034e58d387b9d48c647cfc2b83c45b5 | https://github.com/KaijuML/dtt-multi-branch/tree/a49850a95034e58d387b9d48c647cfc2b83c45b5 |
FCDiscriminator | import torch
from torch import nn
class FCDiscriminator(nn.Module):
def __init__(self, num_classes, ndf=64):
super(FCDiscriminator, self).__init__()
self.conv1 = nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2,
padding=1)
self.conv2 = nn.Conv2d(ndf, ndf * 2, kernel_size=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
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | JohanVer/heatnet | FCDiscriminator | false | 17,529 | [
"MIT"
] | 7 | a2de9ec918fbbc6d9433aba344cbbcb2a2cdc85e | https://github.com/JohanVer/heatnet/tree/a2de9ec918fbbc6d9433aba344cbbcb2a2cdc85e |
_GLUBlock | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class _GLUBlock(nn.Module):
def __init__(self, n_c_in, n_c_out):
super(_GLUBlock, self).__init__()
self.pad = nn.ConstantPad1d((1, 2), 0)
self.conv_data = nn.Conv1d(n_c_in, n_c_out, 4, stride=1, bias=True)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | KaibinBao/neuralnilm-pytorch | _GLUBlock | false | 17,530 | [
"Apache-2.0"
] | 4 | 017b85fc921f0638f93a0e16f615028f60b7d279 | https://github.com/KaibinBao/neuralnilm-pytorch/tree/017b85fc921f0638f93a0e16f615028f60b7d279 |
LSTM | import torch
import torch.nn as nn
import torch.nn.functional as F
class LSTM(nn.Module):
def __init__(self, input_size, cell_size, hidden_size):
"""
cell_size is the size of cell_state.
hidden_size is the size of hidden_state, or say the output_state of each step
"""
supe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Kelang-Tian/ST-MGAT | LSTM | false | 17,531 | [
"MIT"
] | 8 | f527cb5748d022d9c3b4eddd3481cf641bb0dae3 | https://github.com/Kelang-Tian/ST-MGAT/tree/f527cb5748d022d9c3b4eddd3481cf641bb0dae3 |
AverageAttention | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of input for the first-layer of the FFN.
d_ff (int): the hidden layer size of th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.cuda
import torch.distributed
assert_size_str... | KaijuML/PARENTing-rl | AverageAttention | false | 17,532 | [
"Apache-2.0"
] | 8 | 98d20e1899e0ff3a9a7a6bb3e50ec28ff0b3b700 | https://github.com/KaijuML/PARENTing-rl/tree/98d20e1899e0ff3a9a7a6bb3e50ec28ff0b3b700 |
StableBCELoss | import torch
class StableBCELoss(torch.nn.modules.Module):
def __init__(self):
super(StableBCELoss, self).__init__()
def forward(self, input, target):
neg_abs = -input.abs()
loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log()
return loss.mean()
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | KeremTurgutlu/fast-kaggle | StableBCELoss | false | 17,533 | [
"Apache-2.0"
] | 8 | 0ea341b44a58da2dfb606a0ae32bac166985b49e | https://github.com/KeremTurgutlu/fast-kaggle/tree/0ea341b44a58da2dfb606a0ae32bac166985b49e |
TimeBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class TimeBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3):
"""
:param in_channels: Number of input features at each node in each time
step.
:param out_channels: Desired number of outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Kelang-Tian/ST-MGAT | TimeBlock | false | 17,534 | [
"MIT"
] | 8 | f527cb5748d022d9c3b4eddd3481cf641bb0dae3 | https://github.com/Kelang-Tian/ST-MGAT/tree/f527cb5748d022d9c3b4eddd3481cf641bb0dae3 |
AUXModule | import torch
import torch.nn.functional as F
import torch.nn as nn
class AUXModule(nn.Module):
def __init__(self, in_features, out_features):
super().__init__()
self.linear = nn.Linear(in_features, out_features)
def forward(self, x):
x = F.adaptive_max_pool2d(x, output_size=(1, 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_... | KeremTurgutlu/fast-kaggle | AUXModule | false | 17,535 | [
"Apache-2.0"
] | 8 | 0ea341b44a58da2dfb606a0ae32bac166985b49e | https://github.com/KeremTurgutlu/fast-kaggle/tree/0ea341b44a58da2dfb606a0ae32bac166985b49e |
Generator | import torch
import torch.nn as nn
import torch.nn.functional as F
class Generator(nn.Module):
"""Define standard linear + softmax generation step."""
def __init__(self, d_model, vocab):
super(Generator, self).__init__()
self.proj = nn.Linear(d_model, vocab)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | KimGroup/AQT | Generator | false | 17,536 | [
"MIT"
] | 4 | b3440f04c1fb4cb44c30569bc6bf07103ac2553c | https://github.com/KimGroup/AQT/tree/b3440f04c1fb4cb44c30569bc6bf07103ac2553c |
RewardCriterion | import torch
from torch import nn
import torch.nn.init
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward):
input = input.contiguous().view(-1)
reward = reward.contiguous().view(-1)
mask = (seq > ... | 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.nn.init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | KunpengLi1994/PsTuts | RewardCriterion | false | 17,537 | [
"Apache-2.0"
] | 4 | 2063bf0aac8d3fd13bf5a14b80ce05586b8365f9 | https://github.com/KunpengLi1994/PsTuts/tree/2063bf0aac8d3fd13bf5a14b80ce05586b8365f9 |
LandmarkHead | import torch
from itertools import product as product
import torch.nn as nn
class LandmarkHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(LandmarkHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size=
(1, 1), stride=1, padd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
import torch.nn as nn
assert_size_strid... | Jung-Jun-Uk/mixface | LandmarkHead | false | 17,538 | [
"MIT"
] | 10 | cee17f99d5e22bf962d9bccbda44a57ab8493173 | https://github.com/Jung-Jun-Uk/mixface/tree/cee17f99d5e22bf962d9bccbda44a57ab8493173 |
ScaledDotProductAttention | import torch
import numpy as np
from torch import nn
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: Dimensionality of queries and keys... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Kilichbek/artemis-m2-transformer | ScaledDotProductAttention | false | 17,539 | [
"MIT"
] | 8 | 99f7e797965710bf2565283d6b5028a6fe32664c | https://github.com/Kilichbek/artemis-m2-transformer/tree/99f7e797965710bf2565283d6b5028a6fe32664c |
ClassHead | import torch
from itertools import product as product
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,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
import torch.nn as nn
assert_size_strid... | Jung-Jun-Uk/UNPG | ClassHead | false | 17,540 | [
"Apache-2.0"
] | 7 | a6f9c1731a68fc035eb8fe8198f5a5c643825a5b | https://github.com/Jung-Jun-Uk/UNPG/tree/a6f9c1731a68fc035eb8fe8198f5a5c643825a5b |
TransformerNet | import torch
from torch.nn import functional as F
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JEF1056/Reconstruction-Style | TransformerNet | false | 17,541 | [
"MIT"
] | 6 | 3430d9e9f05c6980ae251cf15b619148a2c899d6 | https://github.com/JEF1056/Reconstruction-Style/tree/3430d9e9f05c6980ae251cf15b619148a2c899d6 |
BboxHead | import torch
from itertools import product as product
import torch.nn as nn
class BboxHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(BboxHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(
1, 1), stride=1, padding=0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
import torch.nn as nn
assert_size_strid... | Jung-Jun-Uk/UNPG | BboxHead | false | 17,542 | [
"Apache-2.0"
] | 7 | a6f9c1731a68fc035eb8fe8198f5a5c643825a5b | https://github.com/Jung-Jun-Uk/UNPG/tree/a6f9c1731a68fc035eb8fe8198f5a5c643825a5b |
TransformerNet | import functools
import torch
def get_norm_layer(norm_type='instance', affine_state=True):
if norm_type == 'batch':
norm_layer = functools.partial(torch.nn.BatchNorm2d, affine=True)
elif norm_type == 'instance':
norm_layer = functools.partial(torch.nn.InstanceNorm2d, affine=
affine... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JunhongH/CP-GAN | TransformerNet | false | 17,543 | [
"Apache-2.0"
] | 9 | 5ac129da8cf6d010dc0da03bb4637d20c822d50b | https://github.com/JunhongH/CP-GAN/tree/5ac129da8cf6d010dc0da03bb4637d20c822d50b |
Highway | import torch
import torch.nn as nn
import torch.nn.functional as F
class Highway(nn.Module):
def __init__(self, in_features, out_features):
"""
inputs: [N, T, C]
outputs: [N, T, C]
"""
super().__init__()
self.linear1 = nn.Linear(in_features, out_features)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | KinglittleQ/Tacotron | Highway | false | 17,544 | [
"MIT"
] | 6 | d43c0c4e5b91029ffae0f96d69a1d3b3106d49c5 | https://github.com/KinglittleQ/Tacotron/tree/d43c0c4e5b91029ffae0f96d69a1d3b3106d49c5 |
Conv1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding='same'):
"""
inputs: [N, T, C_in]
outputs: [N, T, C_out]
"""
super().__init__()
if paddi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | KinglittleQ/Tacotron | Conv1d | false | 17,545 | [
"MIT"
] | 6 | d43c0c4e5b91029ffae0f96d69a1d3b3106d49c5 | https://github.com/KinglittleQ/Tacotron/tree/d43c0c4e5b91029ffae0f96d69a1d3b3106d49c5 |
LinearFeedforward | import torch
import torch.nn as nn
import torch.utils.data
class Linear(nn.Linear):
def forward(self, x):
size = x.size()
return super().forward(x.contiguous().view(-1, size[-1])).view(*
size[:-1], -1)
class Feedforward(nn.Module):
def __init__(self, d_in, d_out, activation=Non... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Krish-sysadmin/genienlp | LinearFeedforward | false | 17,546 | [
"BSD-3-Clause"
] | 6 | 3586e4368eb0b0756a772294daedc043ce55454c | https://github.com/Krish-sysadmin/genienlp/tree/3586e4368eb0b0756a772294daedc043ce55454c |
vgg11_modified | import torch
import torch.nn as nn
import torch.nn.functional as F
class vgg11_modified(nn.Module):
def __init__(self, num_classes=20):
super(vgg11_modified, self).__init__()
self.num_classes = num_classes
self.pad = nn.ReflectionPad2d((1, 1, 1, 1))
self.pool = nn.MaxPool2d((2, 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.... | JonGant/FoveatedTextureTransform | vgg11_modified | false | 17,547 | [
"MIT"
] | 4 | a3bad4abdb0a61e038cfe3602ef568dfea1a6127 | https://github.com/JonGant/FoveatedTextureTransform/tree/a3bad4abdb0a61e038cfe3602ef568dfea1a6127 |
SFCN | import torch
import torch.nn as nn
class SFCN(nn.Module):
def __init__(self):
super(SFCN, self).__init__()
cnn = nn.Sequential()
input_c = [3, 18, 18]
padding = [3, 3, 6]
dilation = [1, 1, 2]
for i in range(3):
cnn.add_module('sfcn{}'.format(i), nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | L597383845/row-col-table-recognition | SFCN | false | 17,548 | [
"MIT"
] | 7 | 617718751861b3f4e35a4b34dde4c898575e6818 | https://github.com/L597383845/row-col-table-recognition/tree/617718751861b3f4e35a4b34dde4c898575e6818 |
Attention | import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.init
class Attention(nn.Module):
"""
Applies an attention mechanism on the output features from the decoder.
"""
def __init__(self, dim):
super(Attention, self).__init__()
self.dim = dim
self.lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | KunpengLi1994/PsTuts | Attention | false | 17,549 | [
"Apache-2.0"
] | 4 | 2063bf0aac8d3fd13bf5a14b80ce05586b8365f9 | https://github.com/KunpengLi1994/PsTuts/tree/2063bf0aac8d3fd13bf5a14b80ce05586b8365f9 |
ScaledDotProductAttentionMemory | import torch
import numpy as np
from torch import nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, d_model, d_k, d_v, h, m):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionalit... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Kilichbek/artemis-m2-transformer | ScaledDotProductAttentionMemory | false | 17,550 | [
"MIT"
] | 8 | 99f7e797965710bf2565283d6b5028a6fe32664c | https://github.com/Kilichbek/artemis-m2-transformer/tree/99f7e797965710bf2565283d6b5028a6fe32664c |
CNN_Net | import torch
from torch import nn
import torch.nn.functional as F
class CNN_Net(nn.Module):
def __init__(self, device=None):
super(CNN_Net, self).__init__()
self.conv1 = nn.Conv2d(1, 64, 3, 1)
self.conv2 = nn.Conv2d(64, 16, 7, 1)
self.fc1 = nn.Linear(4 * 4 * 16, 200)
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.... | Koukyosyumei/NAIST-Experiments | CNN_Net | false | 17,551 | [
"Apache-2.0"
] | 4 | 2795f6d7f59e7881ba4fe08a37881b8c2b7b4498 | https://github.com/Koukyosyumei/NAIST-Experiments/tree/2795f6d7f59e7881ba4fe08a37881b8c2b7b4498 |
LayerNorm | import torch
from torch import Tensor
from torch.nn import Parameter
from torch.nn import LayerNorm
from typing import Optional
import torch.fx
from typing import Any
import torch.utils.data
from inspect import Parameter
from torch.nn.parameter import Parameter
def maybe_num_nodes(edge_index, num_nodes=None):
if ... | 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 Tensor
fro... | JinheonBaek/pytorch_geometric | LayerNorm | false | 17,552 | [
"MIT"
] | 4 | dfd32d08a3d8191d6290e53458d4eda515d04fd6 | https://github.com/JinheonBaek/pytorch_geometric/tree/dfd32d08a3d8191d6290e53458d4eda515d04fd6 |
SEBlock | import torch
from torch import nn
class SEBlock(nn.Module):
def __init__(self, num_channels):
super(SEBlock, self).__init__()
self.lin1 = nn.Conv2d(num_channels, num_channels, 1)
self.lin2 = nn.Conv2d(num_channels, num_channels, 1)
def forward(self, x):
h = nn.functional.avg_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Keleas/Wafer_maps | SEBlock | false | 17,553 | [
"MIT"
] | 7 | ee555cafab213a86baf2d9e3b7fb392e1b89a832 | https://github.com/Keleas/Wafer_maps/tree/ee555cafab213a86baf2d9e3b7fb392e1b89a832 |
ConvTranspose2d | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.functional import pad
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
def convtranspose2d_same_padding(input, weight, bias=None, stride=1,
padding=1, dilation=1, groups=1):
input_rows... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.functional as F
from torch.nn.... | Koukyosyumei/secure_ml | ConvTranspose2d | false | 17,554 | [
"MIT"
] | 10 | 9da24f4ce4782ec2f6dd63b0437f657a0e190e40 | https://github.com/Koukyosyumei/secure_ml/tree/9da24f4ce4782ec2f6dd63b0437f657a0e190e40 |
GCN | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.nn.functional as F
from torch.nn import Parameter
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | LEAP-WS/CGPN | GCN | false | 17,555 | [
"MIT"
] | 9 | 28564d9ec7cc7342ff53f3f5a1d36ca5985c11a9 | https://github.com/LEAP-WS/CGPN/tree/28564d9ec7cc7342ff53f3f5a1d36ca5985c11a9 |
Conv2d | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.functional import pad
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
def conv2d_same_padding(input, weight, bias=None, stride=1, padding=1,
dilation=1, groups=1):
input_rows = input.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.functional as F
from torch.nn.... | Koukyosyumei/secure_ml | Conv2d | false | 17,556 | [
"MIT"
] | 10 | 9da24f4ce4782ec2f6dd63b0437f657a0e190e40 | https://github.com/Koukyosyumei/secure_ml/tree/9da24f4ce4782ec2f6dd63b0437f657a0e190e40 |
Highway | import torch
import torch.nn as nn
import torch.nn.utils
class Highway(nn.Module):
def __init__(self, conv_out_dim, e_word):
super().__init__()
self.conv_out_dim = conv_out_dim
self.e_word = e_word
self.linear_proj = nn.Linear(conv_out_dim, self.e_word)
self.linear_gate = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | LFhase/Learning_CS224N | Highway | false | 17,557 | [
"MIT"
] | 5 | 21af6dd4f7b9dcb3f34aac9c2cebf4a02a17176f | https://github.com/LFhase/Learning_CS224N/tree/21af6dd4f7b9dcb3f34aac9c2cebf4a02a17176f |
FocalLoss | import torch
import torch.nn as nn
def log_minus_sigmoid(x):
return torch.clamp(-x, max=0) - torch.log(1 + torch.exp(-torch.abs(x))
) + 0.5 * torch.clamp(x, min=0, max=0)
def log_sigmoid(x):
return torch.clamp(x, max=0) - torch.log(1 + torch.exp(-torch.abs(x))
) + 0.5 * torch.clamp(x, min=0,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | LIANGKE23/Siamese-FC-KF-CF | FocalLoss | false | 17,558 | [
"MIT"
] | 10 | 3d9db19c0f39f0588a5061cd182bfbfc37dca76f | https://github.com/LIANGKE23/Siamese-FC-KF-CF/tree/3d9db19c0f39f0588a5061cd182bfbfc37dca76f |
Quantization | import torch
import torch.utils.data
import torch.nn as nn
class Quant(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
input = torch.clamp(input, 0, 1)
output = (input * 255.0).round() / 255.0
return output
@staticmethod
def backward(ctx, grad_output):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
impo... | LCM1999/VolumeRescaling | Quantization | false | 17,559 | [
"Apache-2.0"
] | 4 | 3eeabf057e68804ed945711b440f19e419c10d7a | https://github.com/LCM1999/VolumeRescaling/tree/3eeabf057e68804ed945711b440f19e419c10d7a |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
from torch import nn
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: Dimens... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Kilichbek/artemis-m2-transformer | MultiHeadAttention | false | 17,560 | [
"MIT"
] | 8 | 99f7e797965710bf2565283d6b5028a6fe32664c | https://github.com/Kilichbek/artemis-m2-transformer/tree/99f7e797965710bf2565283d6b5028a6fe32664c |
Model | import torch
from torchvision.transforms import functional as F
from torch import nn
import torch.nn.functional as F
class Model(nn.Module):
"""
定义了一个简单的三层全连接神经网络,每一层都是线性的
"""
def __init__(self, in_dim, n_hidden1, out_dim):
super().__init__()
self.layer1 = nn.Linear(in_dim, n_hidden1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Event0511/curling-reid | Model | false | 17,561 | [
"Apache-2.0"
] | 3 | 1494d0faeed951e495573c694362f001df5bf6fd | https://github.com/Event0511/curling-reid/tree/1494d0faeed951e495573c694362f001df5bf6fd |
_ASPPModule | import torch
import torch.nn as nn
class _ASPPModule(nn.Module):
"""Atrous Spatial Pyramid Pooling"""
def __init__(self, in_channels, out_channels, pyramids):
super(_ASPPModule, self).__init__()
self.stages = nn.Module()
for i, (dilation, padding) in enumerate(zip(pyramids, pyramids))... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | LcDog/APL | _ASPPModule | false | 17,562 | [
"MIT"
] | 7 | a4302b5d28d63672eda7eff35075b3bce3eccd68 | https://github.com/LcDog/APL/tree/a4302b5d28d63672eda7eff35075b3bce3eccd68 |
alpha | import torch
import torch.utils.data
import torch.nn as nn
class alpha(nn.Module):
def __init__(self, alpha_val=0):
super(alpha, self).__init__()
self.alpha = nn.Parameter(torch.Tensor([alpha_val]))
self.alpha.requires_grad = True
def forward(self, x):
out = torch.mul(self.al... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | LayerFolding/Layer-Folding | alpha | false | 17,563 | [
"BSD-3-Clause"
] | 7 | 9c010edc17b1a4a68b36a67cf00c94840d76b735 | https://github.com/LayerFolding/Layer-Folding/tree/9c010edc17b1a4a68b36a67cf00c94840d76b735 |
Policy | import torch
import torch.nn as nn
import torch.nn.functional as F
class Policy(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Policy, self).__init__()
self.affine1 = nn.Linear(input_size, hidden_size, bias=False)
self.affine2 = nn.Linear(hidden_size, output_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LaRiffle/private-RL | Policy | false | 17,564 | [
"MIT"
] | 4 | 05fdcefbc0aa8bddcb5e2eaf64d203d0c0a38a58 | https://github.com/LaRiffle/private-RL/tree/05fdcefbc0aa8bddcb5e2eaf64d203d0c0a38a58 |
Block | import torch
import torch.nn as nn
def projection_pooling_column(input):
b, c, _h, w = input.size()
input = input.permute(0, 1, 3, 2)
ave_v = input.mean(dim=3)
ave_v = ave_v.reshape(b, c, w, -1)
input[:, :, :, :] = ave_v[:, :, :]
input = input.permute(0, 1, 3, 2)
return input
def project... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | L597383845/row-col-table-recognition | Block | false | 17,565 | [
"MIT"
] | 7 | 617718751861b3f4e35a4b34dde4c898575e6818 | https://github.com/L597383845/row-col-table-recognition/tree/617718751861b3f4e35a4b34dde4c898575e6818 |
BalancedLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class BalancedLoss(nn.Module):
def __init__(self, neg_weight=1.0):
super(BalancedLoss, self).__init__()
self.neg_weight = neg_weight
def forward(self, input, target):
pos_mask = target == 1
neg_mask = target =... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | LIANGKE23/Siamese-FC-KF-CF | BalancedLoss | false | 17,566 | [
"MIT"
] | 10 | 3d9db19c0f39f0588a5061cd182bfbfc37dca76f | https://github.com/LIANGKE23/Siamese-FC-KF-CF/tree/3d9db19c0f39f0588a5061cd182bfbfc37dca76f |
EqualLinear | import math
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
input = input
if input.ndim == 3:
return F.leaky_relu(input + bias.view(1, *rest_dim, bias.shape[0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch.nn import functional as F
assert_siz... | Liamkuo/SAIR | EqualLinear | false | 17,567 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
SaN | import torch
import torch.nn as nn
from collections import OrderedDict
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
x = x.view(x.size(0), -1)
return x
class L2Normalization(nn.Module):
def __init__(self):
super(L2N... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Jiangtong-Li/ZHSIR | SaN | false | 17,568 | [
"Apache-2.0"
] | 8 | fd2c0a7e79f22cbf565ccd5e13342f1b317ac9b7 | https://github.com/Jiangtong-Li/ZHSIR/tree/fd2c0a7e79f22cbf565ccd5e13342f1b317ac9b7 |
DenseCrossEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
class DenseCrossEntropy(nn.Module):
def __init__(self):
super(DenseCrossEntropy, self).__init__()
def forward(self, logits, labels):
logits = logits.float()
labels = labels.float()
logprobs = F.log_softmax(log... | 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
... | LichenYang-Jeffrey/DCL-with-Efficient-B7 | DenseCrossEntropy | false | 17,569 | [
"MIT"
] | 4 | 84940c96a8c7926c630a7a6d5bfd5c6e52a57c2e | https://github.com/LichenYang-Jeffrey/DCL-with-Efficient-B7/tree/84940c96a8c7926c630a7a6d5bfd5c6e52a57c2e |
FusedLeakyReLU | import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
input = input
if input.ndim == 3:
return F.leaky_relu(input + bias.view(1, *rest_dim, bias.shape[0]),
... | import torch
import triton
import 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 = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda... | Liamkuo/SAIR | FusedLeakyReLU | false | 17,570 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
DenseCrossEntropy_smooth | import torch
import torch.nn as nn
import torch.nn.functional as F
class DenseCrossEntropy(nn.Module):
def __init__(self):
super(DenseCrossEntropy, self).__init__()
def forward(self, logits, labels):
logits = logits.float()
labels = labels.float()
logprobs = F.log_softmax(log... | 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
... | LichenYang-Jeffrey/DCL-with-Efficient-B7 | DenseCrossEntropy_smooth | false | 17,571 | [
"MIT"
] | 4 | 84940c96a8c7926c630a7a6d5bfd5c6e52a57c2e | https://github.com/LichenYang-Jeffrey/DCL-with-Efficient-B7/tree/84940c96a8c7926c630a7a6d5bfd5c6e52a57c2e |
ycbcr_to_rgb_jpeg | import torch
import numpy as np
from torch import nn
class ycbcr_to_rgb_jpeg(nn.Module):
""" Converts YCbCr image to RGB JPEG
Input:
image(tensor): batch x height x width x 3
Outpput:
result(tensor): batch x 3 x height x width
"""
def __init__(self):
super(ycbcr_to_rgb_jpe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
assert_size_stride = torch._C._dynamo.gu... | Liamkuo/SAIR | ycbcr_to_rgb_jpeg | false | 17,572 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
chroma_subsampling | import torch
from torch import nn
class chroma_subsampling(nn.Module):
""" Chroma subsampling on CbCv channels
Input:
image(tensor): batch x height x width x 3
Output:
y(tensor): batch x height x width
cb(tensor): batch x height/2 x width/2
cr(tensor): batch x height/2 x wi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Liamkuo/SAIR | chroma_subsampling | false | 17,573 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
PixelNorm | import torch
from torch import nn
class PixelNorm(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim=
True) + 1e-08)
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
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Liamkuo/SAIR | PixelNorm | false | 17,574 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
ResidualBlock_noBN | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv3d):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
impor... | LCM1999/VolumeRescaling | ResidualBlock_noBN | false | 17,575 | [
"Apache-2.0"
] | 4 | 3eeabf057e68804ed945711b440f19e419c10d7a | https://github.com/LCM1999/VolumeRescaling/tree/3eeabf057e68804ed945711b440f19e419c10d7a |
idct_8x8 | import itertools
import torch
import numpy as np
from torch import nn
class idct_8x8(nn.Module):
""" Inverse discrete Cosine Transformation
Input:
dcp(tensor): batch x height x width
Output:
image(tensor): batch x height x width
"""
def __init__(self):
super(idct_8x8, 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 itertools
import numpy as np
from torch import nn
assert_size_stride = to... | Liamkuo/SAIR | idct_8x8 | false | 17,576 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
OHEMLoss | import torch
import torch.nn.functional as F
from torch import nn
class OHEMLoss(nn.Module):
def __init__(self, rate=0.8):
super(OHEMLoss, self).__init__()
None
self.rate = rate
def change_rate(self, new_rate):
None
self.rate = new_rate
def forward(self, cls_pred... | 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... | LightnessOfBeing/kaggle-bengali-classification | OHEMLoss | false | 17,577 | [
"MIT"
] | 5 | 342bc2a9bf57f9f03fa25f5271cb178ab8f7b4ff | https://github.com/LightnessOfBeing/kaggle-bengali-classification/tree/342bc2a9bf57f9f03fa25f5271cb178ab8f7b4ff |
LinModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class LinModel(nn.Module):
def __init__(self, in_dim, out_dim):
super(LinModel, self).__init__()
self.linear = nn.Linear(in_dim, out_dim)
def forward(self, x):
out = self.linear(x)
out = F.softmax(out, dim=-1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Lisennlp/distributed_train_pytorch | LinModel | false | 17,578 | [
"Apache-2.0"
] | 10 | da43ac6b5f4484b5f7bc92e3c778539b9017cb82 | https://github.com/Lisennlp/distributed_train_pytorch/tree/da43ac6b5f4484b5f7bc92e3c778539b9017cb82 |
ToRGB | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch.nn import functional as F
assert_siz... | Liamkuo/SAIR | ToRGB | false | 17,579 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
BasicBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation)
class BasicBlock(nn.Module):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Limingxing00/Retinal-Vessel-Segmentation-ISBI2022 | BasicBlock | false | 17,580 | [
"MIT"
] | 9 | 9480de5c17dc3665a5f6d6d0117596bc5ffc108e | https://github.com/Limingxing00/Retinal-Vessel-Segmentation-ISBI2022/tree/9480de5c17dc3665a5f6d6d0117596bc5ffc108e |
Quantization_Loss | import torch
import torch.nn as nn
class Quantization_Loss(nn.Module):
def __init__(self):
super(Quantization_Loss, self).__init__()
def forward(self, inputs):
loss = -(inputs * torch.log(inputs + 1e-20) + (1.0 - inputs) *
torch.log(1.0 - inputs + 1e-20))
return loss.mean... | 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
... | LiuChaoXD/Remote-Sensing-Image-Retrieval-Models | Quantization_Loss | false | 17,581 | [
"MIT"
] | 4 | c135562263102080716e35260f111dcff7762264 | https://github.com/LiuChaoXD/Remote-Sensing-Image-Retrieval-Models/tree/c135562263102080716e35260f111dcff7762264 |
Contrast_Loss | import torch
import torch.nn as nn
class Contrast_Loss(nn.Module):
def __init__(self, margin=0.5):
super(Contrast_Loss, self).__init__()
self.margin = margin
def forward(self, inputs, target):
R = (target.unsqueeze(0) == target.unsqueeze(1)).float()
distance = ((inputs.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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | LiuChaoXD/Remote-Sensing-Image-Retrieval-Models | Contrast_Loss | false | 17,582 | [
"MIT"
] | 4 | c135562263102080716e35260f111dcff7762264 | https://github.com/LiuChaoXD/Remote-Sensing-Image-Retrieval-Models/tree/c135562263102080716e35260f111dcff7762264 |
Biaffine | import torch
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, in_features, out_features=1, bias=(True, True)):
super(Biaffine, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.bias = bias
self.linear_input_size = in_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | LindgeW/BiaffineParser | Biaffine | false | 17,583 | [
"Apache-2.0"
] | 4 | 3671f9f5d4fdbcad67d90ecfdafbeb316e4378db | https://github.com/LindgeW/BiaffineParser/tree/3671f9f5d4fdbcad67d90ecfdafbeb316e4378db |
StyledConv | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | Liamkuo/SAIR | StyledConv | false | 17,584 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
Depth_Pointwise_Conv1d | import torch
from torch import nn
class Depth_Pointwise_Conv1d(nn.Module):
def __init__(self, in_ch, out_ch, k):
super().__init__()
if k == 1:
self.depth_conv = nn.Identity()
else:
self.depth_conv = nn.Conv1d(in_channels=in_ch, out_channels=
in_ch, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | LeftAttention/Attention-Codebase | Depth_Pointwise_Conv1d | false | 17,585 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
MultiHeadAttention | import math
import torch
import torch.nn as nn
class SelfAttention(nn.Module):
def __init__(self, dropout=0.1):
super(SelfAttention, self).__init__()
self.softmax = nn.Softmax(dim=-1)
self._dropout = nn.Dropout(dropout)
def forward(self, q, k, v, pad_mask=None):
"""
:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | LindgeW/BiaffineParser | MultiHeadAttention | false | 17,586 | [
"Apache-2.0"
] | 4 | 3671f9f5d4fdbcad67d90ecfdafbeb316e4378db | https://github.com/LindgeW/BiaffineParser/tree/3671f9f5d4fdbcad67d90ecfdafbeb316e4378db |
ECAAttention | import torch
from torch import nn
from torch.nn import init
class ECAAttention(nn.Module):
def __init__(self, kernel_size=3):
super().__init__()
self.gap = nn.AdaptiveAvgPool2d(1)
self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=(
kernel_size - 1) // 2)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.nn import init
assert_size_stride = torch._C._dy... | LeftAttention/Attention-Codebase | ECAAttention | false | 17,587 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
SpatialAttention | import torch
from torch import nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super().__init__()
self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding=
kernel_size // 2)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
max_result,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | LeftAttention/Attention-Codebase | SpatialAttention | false | 17,588 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
ExternalAttention | import torch
from torch import nn
from torch.nn import init
class ExternalAttention(nn.Module):
def __init__(self, d_model, S=64):
super().__init__()
self.mk = nn.Linear(d_model, S, bias=False)
self.mv = nn.Linear(S, d_model, bias=False)
self.softmax = nn.Softmax(dim=1)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LeftAttention/Attention-Codebase | ExternalAttention | false | 17,589 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
DoubleAttention | import torch
from torch import nn
from torch.nn import init
from torch.nn import functional as F
class DoubleAttention(nn.Module):
def __init__(self, in_channels, c_m, c_n, reconstruct=True):
super().__init__()
self.in_channels = in_channels
self.reconstruct = reconstruct
self.c_m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LeftAttention/Attention-Codebase | DoubleAttention | false | 17,590 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
SimplifiedScaledDotProductAttention | import torch
import numpy as np
from torch import nn
from torch.nn import init
class SimplifiedScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LeftAttention/Attention-Codebase | SimplifiedScaledDotProductAttention | false | 17,591 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
MinibatchStatConcatLayer | import torch
import torch.nn as nn
def mean(tensor, axis, **kwargs):
if isinstance(axis, int):
axis = [axis]
for ax in axis:
tensor = torch.mean(tensor, axis=ax, **kwargs)
return tensor
class MinibatchStatConcatLayer(nn.Module):
"""Minibatch stat concatenation layer.
- averaging ... | 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_... | Lornatang/PyTorch-PGGAN | MinibatchStatConcatLayer | false | 17,592 | [
"MIT"
] | 5 | a5ad433968641cafc13e2d0c2d9780872071b262 | https://github.com/Lornatang/PyTorch-PGGAN/tree/a5ad433968641cafc13e2d0c2d9780872071b262 |
ScaledDotProductAttention | import torch
import numpy as np
from torch import nn
from torch.nn import init
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LeftAttention/Attention-Codebase | ScaledDotProductAttention | false | 17,593 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
Model | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Model(nn.Module):
def __init__(self, n_inputs, n_outputs, n_hidden=64, lr=0.001, softmax=
False, device='cpu'):
super(Model, self).__init__()
self.n_inputs = n_inputs
self.n_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 import triton_helpers
import torch.nn as nn
import ... | Grottoh/Deep-Active-Inference-for-Partially-Observable-MDPs | Model | false | 17,594 | [
"MIT"
] | 8 | 11fedf09cefaada3dd60f1af430d59d87cbd706e | https://github.com/Grottoh/Deep-Active-Inference-for-Partially-Observable-MDPs/tree/11fedf09cefaada3dd60f1af430d59d87cbd706e |
TransformerEncoderLayer | from torch.nn import Module
import torch
from torch import Tensor
import torch.nn.functional as F
from typing import Optional
from torch.nn.modules import Module
from torch.nn.modules.activation import MultiheadAttention
from torch.nn.modules.dropout import Dropout
from torch.nn.modules.linear import Linear
from torch.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Lingzhi-WANG/Quotation-Recommendation | TransformerEncoderLayer | false | 17,595 | [
"MIT"
] | 4 | 40a875a41f10a597604206e067a16cbbfc88cdd7 | https://github.com/Lingzhi-WANG/Quotation-Recommendation/tree/40a875a41f10a597604206e067a16cbbfc88cdd7 |
ChannelAttentionModule | import torch
import numpy as np
from torch import nn
from torch.nn import init
class SimplifiedScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LeftAttention/Attention-Codebase | ChannelAttentionModule | false | 17,596 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
OutlookAttention | import math
import torch
from torch import nn
from torch.nn import functional as F
class OutlookAttention(nn.Module):
def __init__(self, dim, num_heads=1, kernel_size=3, padding=1, stride=1,
qkv_bias=False, attn_drop=0.1):
super().__init__()
self.dim = dim
self.num_heads = num_hea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | LeftAttention/Attention-Codebase | OutlookAttention | false | 17,597 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
SpatialGroupEnhance | import torch
from torch import nn
from torch.nn import init
class SpatialGroupEnhance(nn.Module):
def __init__(self, groups):
super().__init__()
self.groups = groups
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.weight = nn.Parameter(torch.zeros(1, groups, 1, 1))
self.bias ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from torch.nn import init
assert_size_stride = torch._C._d... | LeftAttention/Attention-Codebase | SpatialGroupEnhance | false | 17,598 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
WeightedBCEDiceLoss | import torch
import torch.nn as nn
def f_score(pr, gt, beta=1, eps=1e-07, threshold=None, activation='sigmoid'):
activation_fn = torch.nn.Sigmoid()
pr = activation_fn(pr)
if threshold is not None:
pr = (pr > threshold).float()
tp = torch.sum(gt * pr)
fp = torch.sum(pr) - tp
fn = 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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | LovreAB17/Eff-UNet | WeightedBCEDiceLoss | false | 17,599 | [
"MIT"
] | 5 | b1e76a68d96e55324b6859c64ad2367653143e5e | https://github.com/LovreAB17/Eff-UNet/tree/b1e76a68d96e55324b6859c64ad2367653143e5e |
UnderfitNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class UnderfitNet(nn.Module):
def __init__(self):
super(UnderfitNet, self).__init__()
self.fc1 = nn.Linear(28 * 28, 64)
self.fc2 = nn.Linear(64, 10)
def forward(self, x):
x = x.view(-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
import ... | Lornatang/Deep-learning-with-python3 | UnderfitNet | false | 17,600 | [
"Apache-2.0"
] | 4 | 11794d871e68f8f80486a07bf5137325b4ee1526 | https://github.com/Lornatang/Deep-learning-with-python3/tree/11794d871e68f8f80486a07bf5137325b4ee1526 |
DiceLoss | import torch
import torch.nn as nn
def f_score(pr, gt, beta=1, eps=1e-07, threshold=None, activation='sigmoid'):
activation_fn = torch.nn.Sigmoid()
pr = activation_fn(pr)
if threshold is not None:
pr = (pr > threshold).float()
tp = torch.sum(gt * pr)
fp = torch.sum(pr) - tp
fn = 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... | LovreAB17/Eff-UNet | DiceLoss | false | 17,601 | [
"MIT"
] | 5 | b1e76a68d96e55324b6859c64ad2367653143e5e | https://github.com/LovreAB17/Eff-UNet/tree/b1e76a68d96e55324b6859c64ad2367653143e5e |
FocalLossSimple | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class FocalLossSimple(nn.Module):
def __init__(self, gamma=2, alpha=0.25):
super().__init__()
self.gamma = gamma
self.alpha = alpha
def forward(self, logit, target, epoch=0):
target = 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... | LiubovSobolevskaya/hpa-single-cell | FocalLossSimple | false | 17,602 | [
"MIT"
] | 6 | ebe6d046b651a1c45095f26e99cfb13adefb63d9 | https://github.com/LiubovSobolevskaya/hpa-single-cell/tree/ebe6d046b651a1c45095f26e99cfb13adefb63d9 |
BCE | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class BCE(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logit, target, epoch=0):
target = target.float()
pred_prob = F.sigmoid(logit)
return F.binary_cross_entropy(pre... | 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... | LiubovSobolevskaya/hpa-single-cell | BCE | false | 17,603 | [
"MIT"
] | 6 | ebe6d046b651a1c45095f26e99cfb13adefb63d9 | https://github.com/LiubovSobolevskaya/hpa-single-cell/tree/ebe6d046b651a1c45095f26e99cfb13adefb63d9 |
SSARDecoder | import torch
from torch import nn
class SSARDecoder(nn.Module):
def __init__(self):
super(SSARDecoder, self).__init__()
self.deconv0 = nn.ConvTranspose2d(256, 64, 4, 2, 1)
self.deconv1 = nn.ConvTranspose2d(64, 32, 4, 2, 1)
self.deconv2 = nn.ConvTranspose2d(32, 16, 4, 2, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | LEChaney/Real-time-SSAR | SSARDecoder | false | 17,604 | [
"MIT"
] | 4 | b4ad8c2356b0ec4237bb9f62394e7169ea5aca50 | https://github.com/LEChaney/Real-time-SSAR/tree/b4ad8c2356b0ec4237bb9f62394e7169ea5aca50 |
OverfitNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class OverfitNet(nn.Module):
def __init__(self):
super(OverfitNet, self).__init__()
self.fc1 = nn.Linear(28 * 28, 2048)
self.fc2 = nn.Linear(2048, 10)
def forward(self, x):
x = x.view(-... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Lornatang/Deep-learning-with-python3 | OverfitNet | false | 17,605 | [
"Apache-2.0"
] | 4 | 11794d871e68f8f80486a07bf5137325b4ee1526 | https://github.com/Lornatang/Deep-learning-with-python3/tree/11794d871e68f8f80486a07bf5137325b4ee1526 |
MultConst | import torch
import torch.nn as nn
class MultConst(nn.Module):
def forward(self, input):
return 255 * input
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | LucasAlegre/SelfieArt | MultConst | false | 17,606 | [
"MIT"
] | 4 | 30c2b2a0a40de31938a19b4d1d63869e78052fd0 | https://github.com/LucasAlegre/SelfieArt/tree/30c2b2a0a40de31938a19b4d1d63869e78052fd0 |
MINCNet | import torch
import torch.utils.data
import torch.nn as nn
class MINCNet(nn.Module):
def __init__(self):
super(MINCNet, self).__init__()
self.ReLU = nn.ReLU(True)
self.conv11 = nn.Conv2d(3, 64, 3, 1, 1)
self.conv12 = nn.Conv2d(64, 64, 3, 1, 1)
self.maxpool1 = nn.MaxPool2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
impor... | KwanWaiPang/BasicSR | MINCNet | false | 17,607 | [
"Apache-2.0"
] | 5 | b48db3f962beca806f70388be759889620257112 | https://github.com/KwanWaiPang/BasicSR/tree/b48db3f962beca806f70388be759889620257112 |
SiamFC | import torch
import torch.nn as nn
import torch.nn.functional as F
class SiamFC(nn.Module):
def __init__(self, out_scale=0.001):
super(SiamFC, self).__init__()
self.out_scale = out_scale
def forward(self, z, x):
return self._fast_xcorr(z, x) * self.out_scale
def _fast_xcorr(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | LIANGKE23/Siamese-FC-KF-CF | SiamFC | false | 17,608 | [
"MIT"
] | 10 | 3d9db19c0f39f0588a5061cd182bfbfc37dca76f | https://github.com/LIANGKE23/Siamese-FC-KF-CF/tree/3d9db19c0f39f0588a5061cd182bfbfc37dca76f |
EnsembleLayer | import torch
import torch as th
from torch import nn as nn
class EnsembleLayer(nn.Module):
def __init__(self, ensemble_size, input_dim, output_dim):
super().__init__()
self.W = nn.Parameter(th.empty((ensemble_size, input_dim,
output_dim)), requires_grad=True).float()
nn.init.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
import torch as th
from torch import nn as nn
assert_size_stride = torch._C._dyn... | LucasAlegre/sac-plus | EnsembleLayer | false | 17,609 | [
"MIT"
] | 9 | 829c8652bc07a420e855ace696ae44de5feb5379 | https://github.com/LucasAlegre/sac-plus/tree/829c8652bc07a420e855ace696ae44de5feb5379 |
AvgPool | import torch
import torch.nn.functional as F
from torch import nn
import torch.utils.data
class AvgPool(nn.Module):
"""1-d average pooling module."""
def __init__(self, stride=None, padding=0):
super(AvgPool, self).__init__()
self.stride = stride
self.padding = padding
def forwar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards... | LindaCY/fastNLP | AvgPool | false | 17,610 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
VGG16 | import torch
import torch.nn as nn
import torch.nn.functional as F
class VGG16(nn.Module):
def __init__(self):
super(VGG16, self).__init__()
self.conv1_1 = nn.Conv2d(3, 64, 3)
self.conv1_2 = nn.Conv2d(64, 64, 3, padding=(1, 1))
self.maxpool1 = nn.MaxPool2d((2, 2), padding=(1, 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_... | Jiannan-Liu/nCoVSegNet | VGG16 | false | 17,611 | [
"MIT"
] | 5 | 7543e68edff011a7f7b694c97cf0f185d441fd6b | https://github.com/Jiannan-Liu/nCoVSegNet/tree/7543e68edff011a7f7b694c97cf0f185d441fd6b |
MaxPool | import torch
import torch.nn.functional as F
from torch import nn
import torch.utils.data
class MaxPool(nn.Module):
"""1-d max-pooling module."""
def __init__(self, stride=None, padding=0, dilation=1):
super(MaxPool, self).__init__()
self.stride = stride
self.padding = padding
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards... | LindaCY/fastNLP | MaxPool | false | 17,612 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
MeanPoolWithMask | import torch
from torch import nn
import torch.utils.data
class MeanPoolWithMask(nn.Module):
def __init__(self):
super(MeanPoolWithMask, self).__init__()
self.inf = 10000000000000.0
def forward(self, tensor, mask, dim=0):
masks = mask.view(mask.size(0), mask.size(1), -1).float()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | LindaCY/fastNLP | MeanPoolWithMask | false | 17,613 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
Bi_Attention | import torch
import torch.nn.functional as F
from torch import nn
import torch.utils.data
class Bi_Attention(nn.Module):
def __init__(self):
super(Bi_Attention, self).__init__()
self.inf = 10000000000000.0
def forward(self, in_x1, in_x2, x1_len, x2_len):
assert in_x1.size()[0] == 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.... | LindaCY/fastNLP | Bi_Attention | false | 17,614 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
NetVLAD | import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms import *
class NetVLAD(nn.Module):
"""NetVLAD layer implementation"""
def __init__(self, num_clusters=16, dim=512, alpha=100.0,
normalize_input=True):
"""
Args:
num_clusters : 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.... | GeWu-Lab/OGM-GE_CVPR2022 | NetVLAD | false | 17,615 | [
"MIT"
] | 4 | 08b3f2498dd3e89f57fe9a12b5bf0c162eba1fbf | https://github.com/GeWu-Lab/OGM-GE_CVPR2022/tree/08b3f2498dd3e89f57fe9a12b5bf0c162eba1fbf |
Fusion_feature | import torch
import torch.nn as nn
import torch.nn.functional as F
class Fusion_feature(nn.Module):
def __init__(self):
super(Fusion_feature, self).__init__()
self.conv3 = nn.Conv2d(192, 384, kernel_size=3, padding=1)
self.conv3_1x1 = nn.Conv2d(384, 256, kernel_size=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
import torch.nn as nn
assert_... | LiuChaoXD/Remote-Sensing-Image-Retrieval-Models | Fusion_feature | false | 17,616 | [
"MIT"
] | 4 | c135562263102080716e35260f111dcff7762264 | https://github.com/LiuChaoXD/Remote-Sensing-Image-Retrieval-Models/tree/c135562263102080716e35260f111dcff7762264 |
IoULoss | import torch
import torch.nn as nn
class IoULoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super().__init__()
def forward(self, inputs, targets):
smooth = 1.0
num = targets.size(0)
m1 = inputs.view(num, -1)
m2 = targets.view(num, -1)
inte... | 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... | Luoxd1996/Rank2nuclearSegmentation | IoULoss | false | 17,617 | [
"MIT"
] | 5 | bd85ac13eec7ce18c286efd521a27486483da904 | https://github.com/Luoxd1996/Rank2nuclearSegmentation/tree/bd85ac13eec7ce18c286efd521a27486483da904 |
LabelBilinear | import torch
from torch import nn
import torch.utils.data
class LabelBilinear(nn.Module):
"""helper module for Biaffine Dependency Parser predicting label
"""
def __init__(self, in1_features, in2_features, num_label, bias=True):
super(LabelBilinear, self).__init__()
self.bilinear = nn.Bil... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dyna... | LindaCY/fastNLP | LabelBilinear | false | 17,618 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
ArcBiaffine | import torch
from torch import nn
import torch.utils.data
import torch.nn.init as init
def initial_parameter(net, initial_method=None):
"""A method used to initialize the weights of PyTorch models.
:param net: a PyTorch model
:param str initial_method: one of the following initializations.
-... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.nn.init as init
assert... | LindaCY/fastNLP | ArcBiaffine | false | 17,619 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.