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 |
|---|---|---|---|---|---|---|---|---|---|---|
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... | FengZiYjun/fastNLP | AvgPool | false | 5,149 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
InnerProductNetwork | import torch
import torch.utils.data
class InnerProductNetwork(torch.nn.Module):
def forward(self, x):
"""
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
"""
num_fields = x.shape[1]
row, col = list(), list()
for i in range(num_fields - 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.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | Fanxingye/Autotabular | InnerProductNetwork | false | 5,150 | [
"Apache-2.0"
] | 1 | d630c78290a52f8c73885afb16884e18135c34f6 | https://github.com/Fanxingye/Autotabular/tree/d630c78290a52f8c73885afb16884e18135c34f6 |
RingLoss | import torch
import torch.nn as nn
class RingLoss(nn.Module):
"""Ring loss.
Reference:
Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018.
"""
def __init__(self, weight_ring=1.0):
super(RingLoss, self).__init__()
self.radius = nn.Parameter(to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | FEIfei-coder/circle-loss-for-reid | RingLoss | false | 5,151 | [
"MIT"
] | 1 | fbb3be087a6c390fb7f8c000eebb63aa27179a13 | https://github.com/FEIfei-coder/circle-loss-for-reid/tree/fbb3be087a6c390fb7f8c000eebb63aa27179a13 |
LinearBlock | import torch
from scipy.stats import truncnorm
def truncated_normal_(tensor, mean=0.0, std=1.0):
values = truncnorm.rvs(-2, 2, size=tensor.shape)
values = mean + std * values
tensor.copy_(torch.from_numpy(values))
return tensor
def fc_init_(module):
if hasattr(module, 'weight') and module.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.... | Barchid/snn-fsl | LinearBlock | false | 5,152 | [
"Apache-2.0"
] | 1 | 8adca6b7541d51b4ac4198f00e784e54589b4c9d | https://github.com/Barchid/snn-fsl/tree/8adca6b7541d51b4ac4198f00e784e54589b4c9d |
LNN | import math
import torch
import torch.nn.functional as F
import torch.utils.data
class LNN(torch.nn.Module):
"""A pytorch implementation of LNN layer Input shape.
- A 3D tensor with shape: ``(batch_size,field_size,embedding_size)``.
Output shape
- 2D tensor with shape:``(batch_size,LNN_dim*em... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Fanxingye/Autotabular | LNN | false | 5,153 | [
"Apache-2.0"
] | 1 | d630c78290a52f8c73885afb16884e18135c34f6 | https://github.com/Fanxingye/Autotabular/tree/d630c78290a52f8c73885afb16884e18135c34f6 |
FCDiscriminator | import torch
import torch.nn as 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | EvanfanBao/Adversarial_DA_Exp | FCDiscriminator | false | 5,154 | [
"MIT"
] | 1 | 09979742d83fe6fd5de9b9f3aa6aa5fe9a44ea54 | https://github.com/EvanfanBao/Adversarial_DA_Exp/tree/09979742d83fe6fd5de9b9f3aa6aa5fe9a44ea54 |
ConvNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class ConvNet(nn.Module):
def __init__(self):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(1, 3, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Fanxingye/AutoDL | ConvNet | false | 5,155 | [
"Apache-2.0"
] | 1 | 6f409aefc8b81e5fe47df57b82332c8df427875d | https://github.com/Fanxingye/AutoDL/tree/6f409aefc8b81e5fe47df57b82332c8df427875d |
TReLU | import torch
import torch.nn.functional as F
import torch.nn as nn
class TReLU(nn.Module):
def __init__(self):
super(TReLU, self).__init__()
self.alpha = nn.Parameter(torch.FloatTensor(1), requires_grad=True)
self.alpha.data.fill_(0)
def forward(self, x):
x = F.relu(x - self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | FightingSrain/ColorRL | TReLU | false | 5,156 | [
"MIT"
] | 1 | 2576304d56c2337e2c1cb8fba93888d984ed701b | https://github.com/FightingSrain/ColorRL/tree/2576304d56c2337e2c1cb8fba93888d984ed701b |
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 initial_method: str, 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... | FengZiYjun/fastNLP | ArcBiaffine | false | 5,157 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
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... | FengZiYjun/fastNLP | MaxPool | false | 5,158 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
Conv | 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 initial_method: str, 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._inductor.runtime import triton_helpers
from torch import nn
import t... | FengZiYjun/fastNLP | Conv | false | 5,159 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
DotAtte | import math
import torch
from torch import nn
import torch.utils.data
def seq_mask(seq_len, max_len):
"""Create sequence mask.
:param seq_len: list or torch.Tensor, the lengths of sequences in a batch.
:param max_len: int, the maximum sequence length in a batch.
:return mask: torch.LongTensor, [batch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | FengZiYjun/fastNLP | DotAtte | false | 5,160 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
L2Norm | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
... | 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
from math import sqrt as sqrt
from itertools import produ... | Feywell/association_lstm_implement | L2Norm | false | 5,161 | [
"MIT"
] | 1 | 4e439bd934dc865aad0015a897980a8f124602af | https://github.com/Feywell/association_lstm_implement/tree/4e439bd934dc865aad0015a897980a8f124602af |
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... | FengZiYjun/fastNLP | LabelBilinear | false | 5,162 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
BiAffine | import torch
from torch import nn
import torch.utils.data
from torch.nn import Parameter
class BiAffine(nn.Module):
def __init__(self, n_enc, n_dec, n_labels, biaffine=True, **kwargs):
"""
Args:
n_enc: int
the dimension of the encoder input.
n_dec: int
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
from torch.nn import Parameter
asse... | FengZiYjun/fastNLP | BiAffine | false | 5,163 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
FocalLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class FocalLoss(nn.Module):
"""
from
https://github.com/CellProfiling/HPA-competition-solutions/blob/master/bestfitting/src/layers/loss.py
"""
def __init__(self, gamma=2):
super().__init__()
self.gamma = gamma
... | 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... | Fkaneko/kaggle-hpa-single-cell-image-classification | FocalLoss | false | 5,164 | [
"MIT"
] | 1 | 52000cbf5c7eec6ace29274d9e85b5b24fac281b | https://github.com/Fkaneko/kaggle-hpa-single-cell-image-classification/tree/52000cbf5c7eec6ace29274d9e85b5b24fac281b |
ConvNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class ConvNet(nn.Module):
def __init__(self, NumChannels):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(NumChannels, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | FedericoZocco/VarMemLBFGS-PyTorch | ConvNet | false | 5,165 | [
"MIT"
] | 1 | 5a0ed7b95fc71c9a421a07071f8d5199cf6a6216 | https://github.com/FedericoZocco/VarMemLBFGS-PyTorch/tree/5a0ed7b95fc71c9a421a07071f8d5199cf6a6216 |
BCELoss2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCELoss2d(nn.Module):
def __init__(self, weight=None, size_average=True):
super(BCELoss2d, self).__init__()
self.criterion = nn.BCELoss(weight, size_average)
def forward(self, inputs, targets):
probs = F.sigmoid... | 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... | ForrestPi/SegDL | BCELoss2d | false | 5,166 | [
"MIT"
] | 1 | 56f2ff229dfa7540704d6de50292c724693aac75 | https://github.com/ForrestPi/SegDL/tree/56f2ff229dfa7540704d6de50292c724693aac75 |
T5LayerNorm | import torch
import torch.nn as nn
import torch.utils.checkpoint
class T5LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Construct a layernorm module in the T5 style No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Parameter... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.checkpoint
assert_size_stride = torch.... | Elvisambition/bert_seq2seq | T5LayerNorm | false | 5,167 | [
"Apache-2.0"
] | 1 | 643ac537c16872f0d13200de06001d8201a54fbb | https://github.com/Elvisambition/bert_seq2seq/tree/643ac537c16872f0d13200de06001d8201a54fbb |
Scale | import torch
from torch import nn
class Scale(nn.Module):
def __init__(self, scale):
super().__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 [[], {'scale': 1.0}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | FranardoHuang/ROAR | Scale | false | 5,168 | [
"Apache-2.0"
] | 1 | 859e22389907dd0e61c83980ae5ff6dae51341d3 | https://github.com/FranardoHuang/ROAR/tree/859e22389907dd0e61c83980ae5ff6dae51341d3 |
GlobalAttentionGeneral | import torch
import torch.nn as nn
import torch.nn.parallel
def conv1x1(in_planes, out_planes, bias=False):
"""1x1 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1,
padding=0, bias=bias)
class GlobalAttentionGeneral(nn.Module):
def __init__(self, idf, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | FiroshV/TTI | GlobalAttentionGeneral | false | 5,169 | [
"MIT"
] | 1 | 4d5a40b0ec69a47faf5256caa6d731e95d1f7b9a | https://github.com/FiroshV/TTI/tree/4d5a40b0ec69a47faf5256caa6d731e95d1f7b9a |
ArcMarginProduct_subcenter | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class ArcMarginProduct_subcenter(nn.Module):
def __init__(self, in_features, out_features, k=3):
super().__init__()
self.weight = nn.Parameter(torch.FloatTensor(out_features * k,
in_features))
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.... | Fkaneko/kaggle-hpa-single-cell-image-classification | ArcMarginProduct_subcenter | false | 5,170 | [
"MIT"
] | 1 | 52000cbf5c7eec6ace29274d9e85b5b24fac281b | https://github.com/Fkaneko/kaggle-hpa-single-cell-image-classification/tree/52000cbf5c7eec6ace29274d9e85b5b24fac281b |
DownConv | import torch
import torch.nn as nn
import torch.nn.functional as F
def conv3x3(in_channels, out_channels, stride=1, padding=1, bias=True, groups=1
):
return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=
stride, padding=padding, bias=bias, groups=groups)
class DownConv(nn.Module):
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ForrestPi/SegDL | DownConv | false | 5,171 | [
"MIT"
] | 1 | 56f2ff229dfa7540704d6de50292c724693aac75 | https://github.com/ForrestPi/SegDL/tree/56f2ff229dfa7540704d6de50292c724693aac75 |
RefineLoss | import torch
import numpy as np
import torch.nn as nn
class RefineLoss(nn.Module):
def __init__(self, alpha=1.5, alpha1=0.5, reduction='mean'):
super(RefineLoss, self).__init__()
self.alpha = alpha
self.alpha1 = alpha1
self.reduction = reduction
self.fx = nn.Conv2d(1, 1, 3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ForrestPi/SegDL | RefineLoss | false | 5,172 | [
"MIT"
] | 1 | 56f2ff229dfa7540704d6de50292c724693aac75 | https://github.com/ForrestPi/SegDL/tree/56f2ff229dfa7540704d6de50292c724693aac75 |
Downsample | import torch
import torch.nn as nn
import torch.hub
class Downsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.with_conv:
self.conv = torch.nn.Conv2d(in_channels, in_channels,
kernel_size=3, 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
import torch.hub
assert_size_stride = torch._C._dynamo.gua... | Frikallo/YAKbot | Downsample | false | 5,173 | [
"MIT"
] | 1 | bc798fe4ead1f6a3e4828960ea77e2a8f07b5fdc | https://github.com/Frikallo/YAKbot/tree/bc798fe4ead1f6a3e4828960ea77e2a8f07b5fdc |
Upsample | import torch
import torch.nn as nn
import torch.hub
class Upsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.with_conv:
self.conv = torch.nn.Conv2d(in_channels, in_channels,
kernel_size=3, stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.hub
assert_size_stride = torch._C._dynamo.gua... | Frikallo/YAKbot | Upsample | false | 5,174 | [
"MIT"
] | 1 | bc798fe4ead1f6a3e4828960ea77e2a8f07b5fdc | https://github.com/Frikallo/YAKbot/tree/bc798fe4ead1f6a3e4828960ea77e2a8f07b5fdc |
Attention | import torch
import torch as th
from torch import nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, encoder_dim, decoder_dim, attention_dim):
super(Attention, self).__init__()
self.attention_dim = attention_dim
self.W = nn.Linear(decoder_dim, attention_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.... | FranardoHuang/ROAR | Attention | false | 5,175 | [
"Apache-2.0"
] | 1 | 859e22389907dd0e61c83980ae5ff6dae51341d3 | https://github.com/FranardoHuang/ROAR/tree/859e22389907dd0e61c83980ae5ff6dae51341d3 |
DeterministicCriticNet | import torch
import numpy as np
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class BasicNet:
def __init__(self, optimizer_fn, gpu, LSTM=False):
self.gpu = gpu and torch.cuda.is_available()
self.LSTM = LSTM
if self.gpu:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
from torch... | G-Flor/deeprl | DeterministicCriticNet | false | 5,176 | [
"Apache-2.0"
] | 1 | aeae2c5d585e5853dc638968b1f090eb60abd351 | https://github.com/G-Flor/deeprl/tree/aeae2c5d585e5853dc638968b1f090eb60abd351 |
MTFullyConnected | import time
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.nn import functional as F
class Base(nn.Module):
""" This class is the base structure for all of classification/regression DNN models.
Mainly, it provides the general methods for training, evaluating model and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 time
import numpy as n... | EXYNOS-999/DrugEx | MTFullyConnected | false | 5,177 | [
"MIT"
] | 1 | f75a90fbc0b9863d594fbff6afecb0f866c076d6 | https://github.com/EXYNOS-999/DrugEx/tree/f75a90fbc0b9863d594fbff6afecb0f866c076d6 |
CRFLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.utils.checkpoint
class CRFLayer(nn.Module):
"""
"""
def __init__(self, output_dim):
super(CRFLayer, self).__init__()
self.output_dim = output_dim
self.trans = nn.Parameter(torch.Tensor(output_dim, 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
from torch._inductor.runtime.... | Elvisambition/bert_seq2seq | CRFLayer | false | 5,178 | [
"Apache-2.0"
] | 1 | 643ac537c16872f0d13200de06001d8201a54fbb | https://github.com/Elvisambition/bert_seq2seq/tree/643ac537c16872f0d13200de06001d8201a54fbb |
GaussianCriticNet | import torch
import numpy as np
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class BasicNet:
def __init__(self, optimizer_fn, gpu, LSTM=False):
self.gpu = gpu and torch.cuda.is_available()
self.LSTM = LSTM
if self.gpu:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | G-Flor/deeprl | GaussianCriticNet | false | 5,179 | [
"Apache-2.0"
] | 1 | aeae2c5d585e5853dc638968b1f090eb60abd351 | https://github.com/G-Flor/deeprl/tree/aeae2c5d585e5853dc638968b1f090eb60abd351 |
ConditionalRandomField | 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 initial_method: str, one of the following initializations
-... | 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
i... | FengZiYjun/fastNLP | ConditionalRandomField | false | 5,180 | [
"Apache-2.0"
] | 1 | 3ae73ab0a05d1ceef4a5181516891a8057d7f719 | https://github.com/FengZiYjun/fastNLP/tree/3ae73ab0a05d1ceef4a5181516891a8057d7f719 |
STFullyConnected | import time
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.nn import functional as F
class Base(nn.Module):
""" This class is the base structure for all of classification/regression DNN models.
Mainly, it provides the general methods for training, evaluating model and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EXYNOS-999/DrugEx | STFullyConnected | false | 5,181 | [
"MIT"
] | 1 | f75a90fbc0b9863d594fbff6afecb0f866c076d6 | https://github.com/EXYNOS-999/DrugEx/tree/f75a90fbc0b9863d594fbff6afecb0f866c076d6 |
MLP_model | import torch
import torch.nn as nn
class MLP_model(nn.Module):
def __init__(self, inputsize, layer1, layer2, layer3, device):
super().__init__()
self.fc1 = nn.Linear(inputsize, layer1)
self.fc2 = nn.Linear(layer1, layer2)
self.fc3 = nn.Linear(layer2, layer3)
self.fc4 = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | GYMS-PKU/HIgh-Frequency-Predictor | MLP_model | false | 5,182 | [
"Apache-2.0"
] | 1 | aac5efa73d6e15d95d1b99d529dcf639fb8181f4 | https://github.com/GYMS-PKU/HIgh-Frequency-Predictor/tree/aac5efa73d6e15d95d1b99d529dcf639fb8181f4 |
_MLP_B | import torch
import torch.nn as nn
class _MLP_B(nn.Module):
"""MLP that only use age gender MMSE"""
def __init__(self, in_size, drop_rate, fil_num):
super(_MLP_B, self).__init__()
self.fc1 = nn.Linear(in_size, fil_num)
self.fc2 = nn.Linear(fil_num, 2)
self.do1 = nn.Dropout(dro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | GaelKBertrand/Meliora_DeepLearning | _MLP_B | false | 5,183 | [
"MIT"
] | 1 | 5618e01066d4d0afcd7dfe074dda91af22b5857c | https://github.com/GaelKBertrand/Meliora_DeepLearning/tree/5618e01066d4d0afcd7dfe074dda91af22b5857c |
GaussianActorNet | import torch
import numpy as np
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class BasicNet:
def __init__(self, optimizer_fn, gpu, LSTM=False):
self.gpu = gpu and torch.cuda.is_available()
self.LSTM = LSTM
if self.gpu:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | G-Flor/deeprl | GaussianActorNet | false | 5,184 | [
"Apache-2.0"
] | 1 | aeae2c5d585e5853dc638968b1f090eb60abd351 | https://github.com/G-Flor/deeprl/tree/aeae2c5d585e5853dc638968b1f090eb60abd351 |
_MLP_C | import torch
import torch.nn as nn
class _MLP_C(nn.Module):
"""MLP that use DPMs from fcn and age, gender and MMSE"""
def __init__(self, in_size, drop_rate, fil_num):
super(_MLP_C, self).__init__()
self.fc1 = nn.Linear(in_size, fil_num)
self.fc2 = nn.Linear(fil_num, 2)
self.do... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | GaelKBertrand/Meliora_DeepLearning | _MLP_C | false | 5,185 | [
"MIT"
] | 1 | 5618e01066d4d0afcd7dfe074dda91af22b5857c | https://github.com/GaelKBertrand/Meliora_DeepLearning/tree/5618e01066d4d0afcd7dfe074dda91af22b5857c |
TransformerEncoderLayer | import math
import torch
import torch.nn.functional as F
from torch import nn
def _normalize(tensor, norm_layer):
"""
Broadcast layer norm
"""
size = tensor.size()
return norm_layer(tensor.view(-1, size[-1])).view(size)
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, dim, d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | FrankVerhoef/Persona-Dialogue-Generation | TransformerEncoderLayer | false | 5,186 | [
"MIT"
] | 1 | ffd8413c2e8b6446097902dd1c496aeb24b852b4 | https://github.com/FrankVerhoef/Persona-Dialogue-Generation/tree/ffd8413c2e8b6446097902dd1c496aeb24b852b4 |
ResidualDenseBlock | import torch
import torch.nn as nn
class ResidualDenseBlock(nn.Module):
def __init__(self, channels=64, kernel_size=3, growth=32):
super().__init__()
self.conv2d_1 = self.conv2d(channels, growth, kernel_size, growth, 0)
self.conv2d_2 = self.conv2d(channels, growth, kernel_size, growth, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Frognar/Super-Resolution | ResidualDenseBlock | false | 5,187 | [
"MIT"
] | 1 | 406b909d71e156aa11ee589698744e3ad9abfee7 | https://github.com/Frognar/Super-Resolution/tree/406b909d71e156aa11ee589698744e3ad9abfee7 |
SentenceEmbedding | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class BaseSelfAttention(nn.Module):
def __init__(self):
super(BaseSelfAttention, self).__init__()
def init_linear(self, input_linear):
"""Initialize linear transformation"""
bias = np.sqrt(6.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.... | Gan-Tu/ganutils | SentenceEmbedding | false | 5,188 | [
"MIT"
] | 1 | 203c703cbba0345f9cfe23b03e1e3981f03e43db | https://github.com/Gan-Tu/ganutils/tree/203c703cbba0345f9cfe23b03e1e3981f03e43db |
GFunction | import torch
import torch.nn.functional as F
from torch import nn
from torch import optim
class GFunction(nn.Module):
def __init__(self, obs_size, num_outputs=128):
super().__init__()
self.obs_size = obs_size
self.num_outputs = num_outputs
self.fc1 = nn.Linear(obs_size, 32)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
from tor... | Deepest-Project/agent57_from_ngu | GFunction | false | 5,189 | [
"MIT"
] | 1 | 2f596024c7538cfaa5cf63cde1b77f8a1c22d208 | https://github.com/Deepest-Project/agent57_from_ngu/tree/2f596024c7538cfaa5cf63cde1b77f8a1c22d208 |
UpSample | import torch
from torchvision.transforms import functional as F
import torch.nn as nn
import torch.nn.functional as F
class UpSample(nn.Sequential):
def __init__(self, skip_input, output_features):
super().__init__()
self.convA = nn.Conv2d(skip_input, output_features, kernel_size=3,
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_... | BlairLee/dataset-insights | UpSample | false | 5,190 | [
"Apache-2.0"
] | 1 | 892e2ed3a2facf97cfa3a883700830d959a0c49b | https://github.com/BlairLee/dataset-insights/tree/892e2ed3a2facf97cfa3a883700830d959a0c49b |
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._... | CV-Rookie/EmbedMask | LastLevelMaxPool | false | 5,191 | [
"MIT"
] | 1 | 3b4d9fb4e0b6112dc501708184ff684dfb45f3f0 | https://github.com/CV-Rookie/EmbedMask/tree/3b4d9fb4e0b6112dc501708184ff684dfb45f3f0 |
SelfAttentive | import torch
import torch.nn as nn
from sklearn.metrics import *
class SelfAttentive(nn.Module):
def __init__(self, hidden_size, att_hops=1, att_unit=200, dropout=0.2):
super(SelfAttentive, self).__init__()
self.drop = nn.Dropout(dropout)
self.ws1 = nn.Linear(hidden_size, att_unit, bias=F... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Dio990521/LSTM_emo_classifier | SelfAttentive | false | 5,192 | [
"MIT"
] | 1 | aaf2bf2d6a3e60c1acfcff5b82ab256f86ba0dbc | https://github.com/Dio990521/LSTM_emo_classifier/tree/aaf2bf2d6a3e60c1acfcff5b82ab256f86ba0dbc |
SelfAttention | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class BaseSelfAttention(nn.Module):
def __init__(self):
super(BaseSelfAttention, self).__init__()
def init_linear(self, input_linear):
"""Initialize linear transformation"""
bias = np.sqrt(6.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.... | Gan-Tu/ganutils | SelfAttention | false | 5,193 | [
"MIT"
] | 1 | 203c703cbba0345f9cfe23b03e1e3981f03e43db | https://github.com/Gan-Tu/ganutils/tree/203c703cbba0345f9cfe23b03e1e3981f03e43db |
ArcMarginProduct | import math
import torch
import torchvision.transforms.functional as F
from torch import nn
from torch.nn import functional as F
class ArcMarginProduct(nn.Module):
""" Process the latent vectors to output the cosine vector
for the follow-up ArcFaceLoss computation.
Args:
in_features: the column ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CTPLab/IID_representation_learning | ArcMarginProduct | false | 5,194 | [
"MIT"
] | 1 | b9dc13536963f9af332b039f7cc772e2f1090c62 | https://github.com/CTPLab/IID_representation_learning/tree/b9dc13536963f9af332b039f7cc772e2f1090c62 |
RingLoss | import torch
import warnings
import torch.nn as nn
from torchvision.transforms import *
class RingLoss(nn.Module):
"""Ring loss.
Reference:
Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018.
"""
def __init__(self):
super(RingLoss, self).__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
import warnings
import torch.nn as nn
from torchvision.transforms import *
asse... | DRACOyu/deep-person-reid | RingLoss | false | 5,195 | [
"MIT"
] | 1 | 8ca8be28c204dbc37cff76e77691f29045773aa2 | https://github.com/DRACOyu/deep-person-reid/tree/8ca8be28c204dbc37cff76e77691f29045773aa2 |
HardAttn | import torch
import torch.nn as nn
from torch.nn import functional as F
from torchvision.transforms import *
class HardAttn(nn.Module):
"""Hard Attention (Sec. 3.1.II)"""
def __init__(self, in_channels):
super(HardAttn, self).__init__()
self.fc = nn.Linear(in_channels, 4 * 2)
self.ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | DRACOyu/deep-person-reid | HardAttn | false | 5,196 | [
"MIT"
] | 1 | 8ca8be28c204dbc37cff76e77691f29045773aa2 | https://github.com/DRACOyu/deep-person-reid/tree/8ca8be28c204dbc37cff76e77691f29045773aa2 |
BertSelfAttention | import math
import torch
import torch.nn as nn
from sklearn.metrics import *
def sequence_mask(lengths, max_len=None):
"""
Creates a boolean mask from sequence lengths.
"""
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return torch.arange(0, max_len).type_as(lengths).repeat(b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Dio990521/LSTM_emo_classifier | BertSelfAttention | false | 5,197 | [
"MIT"
] | 1 | aaf2bf2d6a3e60c1acfcff5b82ab256f86ba0dbc | https://github.com/Dio990521/LSTM_emo_classifier/tree/aaf2bf2d6a3e60c1acfcff5b82ab256f86ba0dbc |
AMCLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AMCLoss(nn.Module):
def __init__(self, in_features, out_features, s=None, m=None, device='cuda'
):
"""
Angular Margin Contrastive Loss
https://arxiv.org/pdf/2004.09805.pdf
Code converted ove... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | GatorSense/LACE | AMCLoss | false | 5,198 | [
"MIT"
] | 1 | ee8194bc443886642f22c2317f5bdef23bba5147 | https://github.com/GatorSense/LACE/tree/ee8194bc443886642f22c2317f5bdef23bba5147 |
AvgPoolPad | import torch
import torch.nn as nn
from torchvision.transforms import *
class AvgPoolPad(nn.Module):
def __init__(self, stride=2, padding=1):
super(AvgPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.AvgPool2d(3, stride=stride, padding=padding,
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
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | DRACOyu/deep-person-reid | AvgPoolPad | false | 5,199 | [
"MIT"
] | 1 | 8ca8be28c204dbc37cff76e77691f29045773aa2 | https://github.com/DRACOyu/deep-person-reid/tree/8ca8be28c204dbc37cff76e77691f29045773aa2 |
EmbeddingModel | import torch
import torch.nn.functional as F
from torch import nn
from torch import optim
class EmbeddingModel(nn.Module):
def __init__(self, obs_size, num_outputs):
super(EmbeddingModel, self).__init__()
self.obs_size = obs_size
self.num_outputs = num_outputs
self.fc1 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Deepest-Project/agent57_from_ngu | EmbeddingModel | false | 5,200 | [
"MIT"
] | 1 | 2f596024c7538cfaa5cf63cde1b77f8a1c22d208 | https://github.com/Deepest-Project/agent57_from_ngu/tree/2f596024c7538cfaa5cf63cde1b77f8a1c22d208 |
_ScaledDotProductAttention | import torch
import torch.nn as nn
class _ScaledDotProductAttention(nn.Module):
def __init__(self, dropout: 'float'=None, scale: 'bool'=True):
super().__init__()
if dropout is not None:
self.dropout = nn.Dropout(p=dropout)
else:
self.dropout = dropout
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.... | Gian-Wiher/darts | _ScaledDotProductAttention | false | 5,201 | [
"Apache-2.0"
] | 1 | 0d267e08643e2e3f88163a5d955b8be75840c2f6 | https://github.com/Gian-Wiher/darts/tree/0d267e08643e2e3f88163a5d955b8be75840c2f6 |
Fire | import torch
import torch.nn as nn
from torchvision.transforms import *
class Fire(nn.Module):
def __init__(self, inplanes, squeeze_planes, expand1x1_planes,
expand3x3_planes):
super(Fire, self).__init__()
self.inplanes = inplanes
self.squeeze = nn.Conv2d(inplanes, squeeze_planes,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | DRACOyu/deep-person-reid | Fire | false | 5,202 | [
"MIT"
] | 1 | 8ca8be28c204dbc37cff76e77691f29045773aa2 | https://github.com/DRACOyu/deep-person-reid/tree/8ca8be28c204dbc37cff76e77691f29045773aa2 |
ToRGB | from torch.autograd import Function
import math
import torch
import torchvision.transforms.functional as F
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):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
import torchvision.transforms.fu... | CTPLab/IID_representation_learning | ToRGB | false | 5,203 | [
"MIT"
] | 1 | b9dc13536963f9af332b039f7cc772e2f1090c62 | https://github.com/CTPLab/IID_representation_learning/tree/b9dc13536963f9af332b039f7cc772e2f1090c62 |
MaxPoolPad | import torch
import torch.nn as nn
from torchvision.transforms import *
class MaxPoolPad(nn.Module):
def __init__(self):
super(MaxPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.MaxPool2d(3, stride=2, padding=1)
def forward(self, x):
x = self.pa... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from torchvision.transforms import *
assert_size_stride = torch._C.... | DRACOyu/deep-person-reid | MaxPoolPad | false | 5,204 | [
"MIT"
] | 1 | 8ca8be28c204dbc37cff76e77691f29045773aa2 | https://github.com/DRACOyu/deep-person-reid/tree/8ca8be28c204dbc37cff76e77691f29045773aa2 |
_GatedLinearUnit | import torch
import torch.nn as nn
import torch.nn.functional as F
class _GatedLinearUnit(nn.Module):
"""Gated Linear Unit"""
def __init__(self, input_size: 'int', hidden_size: 'int'=None, dropout:
'float'=None):
super().__init__()
if dropout is not None:
self.dropout = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Gian-Wiher/darts | _GatedLinearUnit | false | 5,205 | [
"Apache-2.0"
] | 1 | 0d267e08643e2e3f88163a5d955b8be75840c2f6 | https://github.com/Gian-Wiher/darts/tree/0d267e08643e2e3f88163a5d955b8be75840c2f6 |
_AddNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
class _TimeDistributedInterpolation(nn.Module):
def __init__(self, output_size: 'int', batch_first: 'bool'=False,
trainable: 'bool'=False):
super().__init__()
self.output_size = output_size
self.batch_first = batch... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torc... | Gian-Wiher/darts | _AddNorm | false | 5,206 | [
"Apache-2.0"
] | 1 | 0d267e08643e2e3f88163a5d955b8be75840c2f6 | https://github.com/Gian-Wiher/darts/tree/0d267e08643e2e3f88163a5d955b8be75840c2f6 |
EqualLinear | from torch.autograd import Function
import math
import torch
import torchvision.transforms.functional as F
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):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
clas... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
from torch import nn
assert_size... | CTPLab/IID_representation_learning | EqualLinear | false | 5,207 | [
"MIT"
] | 1 | b9dc13536963f9af332b039f7cc772e2f1090c62 | https://github.com/CTPLab/IID_representation_learning/tree/b9dc13536963f9af332b039f7cc772e2f1090c62 |
_ResampleNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
class _TimeDistributedInterpolation(nn.Module):
def __init__(self, output_size: 'int', batch_first: 'bool'=False,
trainable: 'bool'=False):
super().__init__()
self.output_size = output_size
self.batch_first = batch... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torc... | Gian-Wiher/darts | _ResampleNorm | false | 5,208 | [
"Apache-2.0"
] | 1 | 0d267e08643e2e3f88163a5d955b8be75840c2f6 | https://github.com/Gian-Wiher/darts/tree/0d267e08643e2e3f88163a5d955b8be75840c2f6 |
TransformerDecoderLayer | import math
import torch
import torch.nn.functional as F
from torch import nn
def _normalize(tensor, norm_layer):
"""
Broadcast layer norm
"""
size = tensor.size()
return norm_layer(tensor.view(-1, size[-1])).view(size)
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, dim, d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | FrankVerhoef/Persona-Dialogue-Generation | TransformerDecoderLayer | false | 5,209 | [
"MIT"
] | 1 | ffd8413c2e8b6446097902dd1c496aeb24b852b4 | https://github.com/FrankVerhoef/Persona-Dialogue-Generation/tree/ffd8413c2e8b6446097902dd1c496aeb24b852b4 |
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... | GimmeSpoon/mlp-singer | FeedForward | false | 5,210 | [
"MIT"
] | 1 | 36d10a23c46fa7400994ccd063de79ff089efd5e | https://github.com/GimmeSpoon/mlp-singer/tree/36d10a23c46fa7400994ccd063de79ff089efd5e |
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... | GimmeSpoon/mlp-singer | ChannelMixer | false | 5,211 | [
"MIT"
] | 1 | 36d10a23c46fa7400994ccd063de79ff089efd5e | https://github.com/GimmeSpoon/mlp-singer/tree/36d10a23c46fa7400994ccd063de79ff089efd5e |
GCN | from torch.nn import Module
import math
import torch
from math import *
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
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... | GeekV5/PaperReProduction20200425 | GCN | false | 5,212 | [
"Apache-2.0"
] | 1 | 5c44da3c2fac89dd316a5e4930a78d023a12176d | https://github.com/GeekV5/PaperReProduction20200425/tree/5c44da3c2fac89dd316a5e4930a78d023a12176d |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
import torchvision.transforms.functional as F
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):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd... | CTPLab/IID_representation_learning | ModulatedConv2d | false | 5,213 | [
"MIT"
] | 1 | b9dc13536963f9af332b039f7cc772e2f1090c62 | https://github.com/CTPLab/IID_representation_learning/tree/b9dc13536963f9af332b039f7cc772e2f1090c62 |
C3D | import torch
import torch.nn as nn
class C3D(nn.Module):
def __init__(self, num_classes):
super(C3D, self).__init__()
self.conv1a = nn.Conv3d(in_channels=3, out_channels=64, kernel_size
=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1))
self.pool1 = nn.MaxPool3d(kernel_size=(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | DuyHung21/actionrecognition | C3D | false | 5,214 | [
"MIT"
] | 1 | a095b2e16db249bff97b1eebdab1e90468224fcb | https://github.com/DuyHung21/actionrecognition/tree/a095b2e16db249bff97b1eebdab1e90468224fcb |
_GateAddNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
class _TimeDistributedInterpolation(nn.Module):
def __init__(self, output_size: 'int', batch_first: 'bool'=False,
trainable: 'bool'=False):
super().__init__()
self.output_size = output_size
self.batch_first = batch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Gian-Wiher/darts | _GateAddNorm | false | 5,215 | [
"Apache-2.0"
] | 1 | 0d267e08643e2e3f88163a5d955b8be75840c2f6 | https://github.com/Gian-Wiher/darts/tree/0d267e08643e2e3f88163a5d955b8be75840c2f6 |
InnerProductDecoder | import torch
import torch.utils.data
class InnerProductDecoder(torch.nn.Module):
"""The inner product decoder from the `"Variational Graph Auto-Encoders"
<https://arxiv.org/abs/1611.07308>`_ paper
.. math::
\\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top})
where :math:`\\mathbf{Z} \\in \\mathbb{R}^{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.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | GrumpyZhou/pytorch_geometric | InnerProductDecoder | false | 5,216 | [
"MIT"
] | 1 | 88c54e72d3e26ad48e9ccd99e5696c7f19269d94 | https://github.com/GrumpyZhou/pytorch_geometric/tree/88c54e72d3e26ad48e9ccd99e5696c7f19269d94 |
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... | GimmeSpoon/mlp-singer | TokenMixer | false | 5,218 | [
"MIT"
] | 1 | 36d10a23c46fa7400994ccd063de79ff089efd5e | https://github.com/GimmeSpoon/mlp-singer/tree/36d10a23c46fa7400994ccd063de79ff089efd5e |
GrayLoss | import torch
import torch.nn as nn
class GrayLoss(nn.Module):
def __init__(self):
super(GrayLoss, self).__init__()
self.l1 = nn.L1Loss()
def forward(self, x):
y = torch.ones_like(x) / 2.0
return 1 / self.l1(x, y)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | GuYuanjie/DeepFusionPrior | GrayLoss | false | 5,219 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
GenNoise | import torch
import torch.nn as nn
class GenNoise(nn.Module):
def __init__(self, dim2):
super(GenNoise, self).__init__()
self.dim2 = dim2
def forward(self, x):
a = list(x.size())
a[1] = self.dim2
b = torch.zeros(a).type_as(x.data)
b.normal_()
x = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | GuYuanjie/DeepFusionPrior | GenNoise | false | 5,220 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
NonBlurryLoss | import torch
import torch.nn as nn
class NonBlurryLoss(nn.Module):
def __init__(self):
"""
Loss on the distance to 0.5
"""
super(NonBlurryLoss, self).__init__()
self.mse = nn.MSELoss()
def forward(self, x):
return 1 - self.mse(x, torch.ones_like(x) * 0.5)
de... | 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... | GuYuanjie/DeepFusionPrior | NonBlurryLoss | false | 5,221 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
_GatedResidualNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class _TimeDistributedInterpolation(nn.Module):
def __init__(self, output_size: 'int', batch_first: 'bool'=False,
trainable: 'bool'=False):
super().__init__()
self.output_size = output_size
self.batch_first = batch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Gian-Wiher/darts | _GatedResidualNetwork | false | 5,222 | [
"Apache-2.0"
] | 1 | 0d267e08643e2e3f88163a5d955b8be75840c2f6 | https://github.com/Gian-Wiher/darts/tree/0d267e08643e2e3f88163a5d955b8be75840c2f6 |
TabularNetD | import torch
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.optim as optim
class GaussianNoise(nn.Module):
"""Gaussian noise regularizer"""
def __init__(self, device, sigma=0.1):
super().__init__()
self.device = device
self.sigma = sigma
def... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import ... | Atrus619/CSDGAN | TabularNetD | false | 5,223 | [
"MIT"
] | 1 | 712be213e59b32a79a4970684d726af63616edaf | https://github.com/Atrus619/CSDGAN/tree/712be213e59b32a79a4970684d726af63616edaf |
GradientLoss | import torch
import torch.nn as nn
class GradientLoss(nn.Module):
"""
L1 loss on the gradient of the picture
"""
def __init__(self):
super(GradientLoss, self).__init__()
def forward(self, a):
gradient_a_x = torch.abs(a[:, :, :, :-1] - a[:, :, :, 1:])
gradient_a_y = 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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | GuYuanjie/DeepFusionPrior | GradientLoss | false | 5,224 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.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
:para... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | GavinGuan95/Generative-VQA | ScaledDotProductAttention | false | 5,225 | [
"MIT"
] | 1 | 0912e3a2426809ef4d4eb40bae667b31c2269161 | https://github.com/GavinGuan95/Generative-VQA/tree/0912e3a2426809ef4d4eb40bae667b31c2269161 |
ScaledDotProductAttentionMemory | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.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 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | GavinGuan95/Generative-VQA | ScaledDotProductAttentionMemory | false | 5,226 | [
"MIT"
] | 1 | 0912e3a2426809ef4d4eb40bae667b31c2269161 | https://github.com/GavinGuan95/Generative-VQA/tree/0912e3a2426809ef4d4eb40bae667b31c2269161 |
VarianceLayer | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class VarianceLayer(nn.Module):
def __init__(self, patch_size=5, channels=1):
self.patch_size = patch_size
super(VarianceLayer, self).__init__()
mean_mask = np.ones((channels, channels, patch_size, patch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | GuYuanjie/DeepFusionPrior | VarianceLayer | false | 5,227 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
ROUGH_FILTER | import torch
import torch.nn as nn
class ROUGH_FILTER(nn.Module):
def __init__(self, user_num, embedding_size):
super(ROUGH_FILTER, self).__init__()
self.in_user_embedding = nn.Embedding(user_num, embedding_size)
def forward(self, out_user_embedding_weight):
score = torch.mm(self.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.... | GSL4Rec/GSL4Rec | ROUGH_FILTER | false | 5,228 | [
"Apache-2.0"
] | 1 | 9cf8964957a6d9962bef42bd4908b4f10ef0771c | https://github.com/GSL4Rec/GSL4Rec/tree/9cf8964957a6d9962bef42bd4908b4f10ef0771c |
GrayscaleLayer | import torch
import torch.nn as nn
class GrayscaleLayer(nn.Module):
def __init__(self):
super(GrayscaleLayer, self).__init__()
def forward(self, x):
return torch.mean(x, 1, keepdim=True)
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... | GuYuanjie/DeepFusionPrior | GrayscaleLayer | false | 5,229 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
SpatialGC | import torch
import torch.nn as nn
class SpatialGC(nn.Module):
"""Sapatial Graph Convolution used in DR-GCB and RAM_r's
encoder and decoder
Args:
in_channels (int): Number of channels in the input sequence data
out_channels (int): Number of channels produced by the convolution
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | GlenGGG/DR-GCN | SpatialGC | false | 5,230 | [
"Apache-2.0"
] | 1 | 540e2ede803f78b87b862aa26d099fbc02173143 | https://github.com/GlenGGG/DR-GCN/tree/540e2ede803f78b87b862aa26d099fbc02173143 |
GrayscaleLoss | import torch
import torch.nn as nn
class GrayscaleLayer(nn.Module):
def __init__(self):
super(GrayscaleLayer, self).__init__()
def forward(self, x):
return torch.mean(x, 1, keepdim=True)
class GrayscaleLoss(nn.Module):
def __init__(self):
super(GrayscaleLoss, self).__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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | GuYuanjie/DeepFusionPrior | GrayscaleLoss | false | 5,231 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
VectorQuantizer | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
class VectorQuantizer(nn.Module):
"""
Reference:
[1] https://github.com/deepmind/sonnet/blob/v2/sonnet/src/nets/vqvae.py
"""
def __init__(self, num_embeddings: 'int', embedding_dim: 'int', beta:
'f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | GilesLuo/PyTorch-VAE | VectorQuantizer | false | 5,232 | [
"Apache-2.0"
] | 1 | dab984c7eb1915be9e7cfa7bfa176ad72f7e7a2f | https://github.com/GilesLuo/PyTorch-VAE/tree/dab984c7eb1915be9e7cfa7bfa176ad72f7e7a2f |
ResBlock | import torch
class ResBlock(torch.nn.Module):
def __init__(self, num_channel):
super(ResBlock, self).__init__()
self.conv1 = torch.nn.Conv2d(num_channel, num_channel, kernel_size=
3, stride=1, padding=1)
self.conv2 = torch.nn.Conv2d(num_channel, num_channel, kernel_size=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | Gregory-Eales/mban | ResBlock | false | 5,233 | [
"Apache-2.0"
] | 1 | d8b35db51c7e601b1db777d9a80343600374250b | https://github.com/Gregory-Eales/mban/tree/d8b35db51c7e601b1db777d9a80343600374250b |
MultiHeadAttention | import math
import torch
import torch.nn as nn
def dot_scaled_attention(query: 'torch.Tensor', key: 'torch.Tensor', value:
'torch.Tensor'):
""" Dot scaled attention
Implement dot-product scaled attention which takes query, key, value and gives attention scores.
Arguments:
query -- Query tensor
in shap... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Giseung-Park/BlockSeq | MultiHeadAttention | false | 5,234 | [
"MIT"
] | 1 | 73dd55e6e500c765396fb7bcb514c9cbe7d799ac | https://github.com/Giseung-Park/BlockSeq/tree/73dd55e6e500c765396fb7bcb514c9cbe7d799ac |
UpsamplerModel | import torch
import numpy as np
import torch.nn as nn
class UpsamplerModel(nn.Module):
def __init__(self, output_shape, factor):
assert output_shape[0] % factor == 0
assert output_shape[1] % factor == 0
super(UpsamplerModel, self).__init__()
self.output_shape = output_shape
... | 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 numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.ass... | GuYuanjie/DeepFusionPrior | UpsamplerModel | false | 5,235 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
Linear | import math
import torch
from torch import Tensor
from torch.nn import Linear
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
def kaiming_uniform(tensor, fan, a):
if tensor ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import Tensor
from torch.nn import Parameter
import torch... | GrumpyZhou/pytorch_geometric | Linear | false | 5,236 | [
"MIT"
] | 1 | 88c54e72d3e26ad48e9ccd99e5696c7f19269d94 | https://github.com/GrumpyZhou/pytorch_geometric/tree/88c54e72d3e26ad48e9ccd99e5696c7f19269d94 |
FixedBlurLayer | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class FixedBlurLayer(nn.Module):
def __init__(self, kernel):
super(FixedBlurLayer, self).__init__()
self.kernel = kernel
to_pad_x = int((self.kernel.shape[0] - 1) / 2)
to_pad_y = int((self.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.triton_helpers import math as tl_math
import numpy ... | GuYuanjie/DeepFusionPrior | FixedBlurLayer | false | 5,237 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
CovarianceLayer | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class CovarianceLayer(nn.Module):
def __init__(self, patch_size=5, channels=1):
self.patch_size = patch_size
super(CovarianceLayer, self).__init__()
mean_mask = np.ones((channels, channels, patch_size, p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | GuYuanjie/DeepFusionPrior | CovarianceLayer | false | 5,238 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
Attention | import math
import torch
import torch.nn.functional as F
import torch.utils.data
def restricted_softmax(src, dim=-1, margin=0):
src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0)
out = (src - src_max).exp()
out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp())
return out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | GrumpyZhou/pytorch_geometric | Attention | false | 5,239 | [
"MIT"
] | 1 | 88c54e72d3e26ad48e9ccd99e5696c7f19269d94 | https://github.com/GrumpyZhou/pytorch_geometric/tree/88c54e72d3e26ad48e9ccd99e5696c7f19269d94 |
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... | GimmeSpoon/mlp-singer | MixerBlock | false | 5,240 | [
"MIT"
] | 1 | 36d10a23c46fa7400994ccd063de79ff089efd5e | https://github.com/GimmeSpoon/mlp-singer/tree/36d10a23c46fa7400994ccd063de79ff089efd5e |
My_loss2 | import torch
import torch.nn as nn
class My_loss2(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y, batch_size, mask):
return torch.sum(torch.pow(x - y, 2) * mask) / batch_size / 2
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | H-Liu1997/Pytorch_Pose_Estimation_Framework | My_loss2 | false | 5,241 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
NoiseNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class NoiseNet(nn.Module):
def __init__(self, channels=3, kernel_size=5):
super(NoiseNet, self).__init__()
self.kernel_size = kernel_size
self.channels = channels
to_pad = int((self.kernel_size - 1) / 2)
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.... | GuYuanjie/DeepFusionPrior | NoiseNet | false | 5,242 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
PixelNorm | import torch
import torch.nn as nn
def pixel_norm(x, eps=1e-06):
"""Pixel Normalization.
This normalization is proposed in:
Progressive Growing of GANs for Improved Quality, Stability, and Variation
Args:
x (torch.Tensor): Tensor to be normalized.
eps (float, optional): Epsilon to av... | 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_... | HXWAndCL/mmgeneration | PixelNorm | false | 5,243 | [
"Apache-2.0"
] | 1 | 9afb1d740bf56a4ecde5064d5bb2a4e2d777638b | https://github.com/HXWAndCL/mmgeneration/tree/9afb1d740bf56a4ecde5064d5bb2a4e2d777638b |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output 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.... | GavinGuan95/Generative-VQA | MultiHeadAttention | false | 5,244 | [
"MIT"
] | 1 | 0912e3a2426809ef4d4eb40bae667b31c2269161 | https://github.com/GavinGuan95/Generative-VQA/tree/0912e3a2426809ef4d4eb40bae667b31c2269161 |
My_loss_focus | import torch
import torch.nn as nn
class My_loss_focus(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y, batch_size):
return torch.sum(torch.pow(x - y, 4)) / batch_size
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand(
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | H-Liu1997/Pytorch_Pose_Estimation_Framework | My_loss_focus | false | 5,245 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
StdLoss | import torch
import numpy as np
import torch.nn as nn
from torch.nn import functional
class GrayscaleLayer(nn.Module):
def __init__(self):
super(GrayscaleLayer, self).__init__()
def forward(self, x):
return torch.mean(x, 1, keepdim=True)
class StdLoss(nn.Module):
def __init__(self):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | GuYuanjie/DeepFusionPrior | StdLoss | false | 5,246 | [
"MIT"
] | 1 | a7126e073ed8c49b6a9a662492b64aaeee56cc01 | https://github.com/GuYuanjie/DeepFusionPrior/tree/a7126e073ed8c49b6a9a662492b64aaeee56cc01 |
LinearModel | import torch
import torch.nn as nn
import torch.autograd
import torch.backends.cudnn
class LinearModel(nn.Module):
"""
NetModel class for the neural network. inherits from NetModel.
"""
def __init__(self, input_size, output_size, hidden_size):
"""
Initialize 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
import torch.nn as nn
import ... | Guydada/MIND-Recommender-System-Ptoject-Pytorch-TF-IDF--Deep-Learning | LinearModel | false | 5,247 | [
"MIT"
] | 1 | 1f42db2f5bc29d6bafbd3261407b41ab1a6eae95 | https://github.com/Guydada/MIND-Recommender-System-Ptoject-Pytorch-TF-IDF--Deep-Learning/tree/1f42db2f5bc29d6bafbd3261407b41ab1a6eae95 |
AdaptiveInstanceNorm | import torch
import torch.nn as nn
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is proposed in:
Progressive Growing of GANs for Improved Quality, Stability, and Variation
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | HXWAndCL/mmgeneration | AdaptiveInstanceNorm | false | 5,248 | [
"Apache-2.0"
] | 1 | 9afb1d740bf56a4ecde5064d5bb2a4e2d777638b | https://github.com/HXWAndCL/mmgeneration/tree/9afb1d740bf56a4ecde5064d5bb2a4e2d777638b |
My_loss_offset | import torch
import torch.nn as nn
class My_loss_offset(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, mask, y, batch_size):
return torch.sum(torch.abs(torch.pow(x - y, 2) * mask)
) / batch_size / 2
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | H-Liu1997/Pytorch_Pose_Estimation_Framework | My_loss_offset | false | 5,249 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.