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 |
|---|---|---|---|---|---|---|---|---|---|---|
PoseNetFeat | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.utils.cpp_extension
class PoseNetFeat(nn.Module):
def __init__(self, num_points):
super(PoseNetFeat, self).__init__()
self.conv1 = torch.nn.Conv1d(3, 64, 1)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | LiCHOTHU/ocean-kp | PoseNetFeat | false | 1,891 | [
"MIT"
] | 0 | 2102bda2e51233baad0da12a6b1f168a7882564b | https://github.com/LiCHOTHU/ocean-kp/tree/2102bda2e51233baad0da12a6b1f168a7882564b |
BertIntermediate | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT"s gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | RoshanTanisha/TVCaption | BertIntermediate | false | 1,892 | [
"MIT"
] | 0 | 8b14a340134ec69ed87426ee1f0e93e53f6456e5 | https://github.com/RoshanTanisha/TVCaption/tree/8b14a340134ec69ed87426ee1f0e93e53f6456e5 |
Attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
class Attention(nn.Module):
def __init__(self, opt):
super(Attention, self).__init__()
self.rnn_size = opt.rnn_size
self.att_hid_size = opt.att_hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | VISLANG-Lab/MGCL | Attention | false | 1,893 | [
"MIT"
] | 0 | 22da06ffa7410d9632bfda8eefb1b79e4f660de0 | https://github.com/VISLANG-Lab/MGCL/tree/22da06ffa7410d9632bfda8eefb1b79e4f660de0 |
PositionWiseFeedForward | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
def gelu(x):
""" gelu activation function """
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class PositionWiseFeedForward(nn.Module):
""" feedForward neural networks for each position """
def __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 math
import ... | Kyumin-Park/Protein-Chemical-Releativity-BERT | PositionWiseFeedForward | false | 1,894 | [
"MIT"
] | 0 | 6a339f4e640d99199f38a00769f5872c2a53ac55 | https://github.com/Kyumin-Park/Protein-Chemical-Releativity-BERT/tree/6a339f4e640d99199f38a00769f5872c2a53ac55 |
Autoencoder | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.optim as optim
import torch as T
from torch.nn import Conv2d
from torch.nn import MaxPool2d
from torch.nn import BCELoss
class Autoencoder(Module):
def __init__(self, lr=0.002):
super(Autoencoder, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | ShivangMathur1/Small-Pytorch-Projects | Autoencoder | false | 1,895 | [
"MIT"
] | 0 | aebc6e81103fe2a6830caeedc1b17227e211a6e5 | https://github.com/ShivangMathur1/Small-Pytorch-Projects/tree/aebc6e81103fe2a6830caeedc1b17227e211a6e5 |
ColorJitterLayer | from torch.autograd import Function
import math
import numbers
import torch
import numpy as np
import torch.nn as nn
import torch.utils.cpp_extension
def hsv2rgb(hsv):
"""Convert a 4-d HSV tensor to the RGB counterpart.
>>> %timeit hsv2rgb_lookup(hsv)
2.37 ms ± 13.4 µs per loop (mean ± std. dev. of 7 runs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | ParthaEth/PyTorch-StudioGAN | ColorJitterLayer | false | 1,896 | [
"MIT"
] | 0 | 16dd84415e4b7f4667cb1b1e0ef3fc04edf6b5a9 | https://github.com/ParthaEth/PyTorch-StudioGAN/tree/16dd84415e4b7f4667cb1b1e0ef3fc04edf6b5a9 |
LayerNorm | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
""" layer normalization """
def __init__(self, cfg, eps=1e-12):
super().__init__()
self.gamma = nn.Parameter(torch.ones(cfg.hidden_dim))
self.beta = nn.Parameter(torch.zeros(cf... | 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_... | Kyumin-Park/Protein-Chemical-Releativity-BERT | LayerNorm | false | 1,897 | [
"MIT"
] | 0 | 6a339f4e640d99199f38a00769f5872c2a53ac55 | https://github.com/Kyumin-Park/Protein-Chemical-Releativity-BERT/tree/6a339f4e640d99199f38a00769f5872c2a53ac55 |
_DynamicGates | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class _DynamicGates(nn.Module):
"""Internal class to wrap the dynamic gate parameters into a dedicated PyTorch Module"""
def __init__(self, cfg: 'Config', input_size: 'int'):
super(_DynamicGates, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | NHoose/neuralhydrology | _DynamicGates | false | 1,898 | [
"BSD-3-Clause"
] | 0 | f320b417fe747a923ff8ef685ad33fd8b34effad | https://github.com/NHoose/neuralhydrology/tree/f320b417fe747a923ff8ef685ad33fd8b34effad |
NTM | from _paritybench_helpers import _mock_config
import logging
import torch
import numpy as np
from torch.nn import functional as F
import torch.multiprocessing
from torch import nn
import torch.utils.data
class NTM(nn.Module):
def __init__(self, opt, hidden_dim=500, l1_strength=0.001):
super(NTM, 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.... | WuDiDaBinGe/TAKG | NTM | false | 1,899 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | RoshanTanisha/TVCaption | BertSelfAttention | false | 1,900 | [
"MIT"
] | 0 | 8b14a340134ec69ed87426ee1f0e93e53f6456e5 | https://github.com/RoshanTanisha/TVCaption/tree/8b14a340134ec69ed87426ee1f0e93e53f6456e5 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | RoshanTanisha/TVCaption | BertAttention | false | 1,901 | [
"MIT"
] | 0 | 8b14a340134ec69ed87426ee1f0e93e53f6456e5 | https://github.com/RoshanTanisha/TVCaption/tree/8b14a340134ec69ed87426ee1f0e93e53f6456e5 |
MLP | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class Conv1D(nn.Module):
def __init__(self, nf, nx):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | VayerMaking/gpt-2-Pytorch | MLP | false | 1,902 | [
"MIT"
] | 0 | 7bc35f3c1d6c87d1ac306c0f789282b9df59182a | https://github.com/VayerMaking/gpt-2-Pytorch/tree/7bc35f3c1d6c87d1ac306c0f789282b9df59182a |
BertPredictionHeadTransform | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT"s gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | RoshanTanisha/TVCaption | BertPredictionHeadTransform | false | 1,903 | [
"MIT"
] | 0 | 8b14a340134ec69ed87426ee1f0e93e53f6456e5 | https://github.com/RoshanTanisha/TVCaption/tree/8b14a340134ec69ed87426ee1f0e93e53f6456e5 |
_MCLSTMCell | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from typing import Tuple
class _Gate(nn.Module):
"""Utility class to implement a standard sigmoid gate"""
def __init__(self, in_features: 'int', out_features: 'int'):
super(_Gate, self).__init__()
self.fc = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | NHoose/neuralhydrology | _MCLSTMCell | false | 1,904 | [
"BSD-3-Clause"
] | 0 | f320b417fe747a923ff8ef685ad33fd8b34effad | https://github.com/NHoose/neuralhydrology/tree/f320b417fe747a923ff8ef685ad33fd8b34effad |
SelfAttention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class SelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.query = nn.Linear(config.hidden_size, config.hidden_size)
self.key = nn.Linear(config.hidden_size, config.hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Zaaachary/CSQA | SelfAttention | false | 1,905 | [
"BSD-3-Clause"
] | 0 | 6da6e076f67e9458deacb665d31463db14c7d860 | https://github.com/Zaaachary/CSQA/tree/6da6e076f67e9458deacb665d31463db14c7d860 |
VGGBase | import torch
import torchvision
from torch import nn
import torch.nn.functional as F
from itertools import product as product
import torch.optim
import torch.utils.data
def decimate(tensor, m):
"""
Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value.
This is used when we conve... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 torchvision
from torch... | aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection | VGGBase | false | 1,906 | [
"MIT"
] | 0 | a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 | https://github.com/aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection/tree/a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 |
SSD300 | import torch
import torchvision
from torch import nn
import torch.nn.functional as F
from math import sqrt
from itertools import product as product
import torch.optim
import torch.utils.data
def decimate(tensor, m):
"""
Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value.
This... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection | SSD300 | false | 1,907 | [
"MIT"
] | 0 | a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 | https://github.com/aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection/tree/a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 |
Model | from torch.nn import Module
import torch
import torch.nn.functional
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch.nn import Parameter
from torch.nn import Module
class Mode... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn.functional
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import t... | Jovonni/jukebox | Model | false | 1,908 | [
"MIT"
] | 0 | 965a6f78aae67506a6e4fcdb205e2c39132e12e0 | https://github.com/Jovonni/jukebox/tree/965a6f78aae67506a6e4fcdb205e2c39132e12e0 |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.Module):
"""
Construye la capa de normalización
"""
def __init__(self, features, eps=1e-06):
"""
Constructor LayerNorm
Parámetros:
features: Tamaño del vector
eps: Diferencia para la división
"""
super(LayerNorm, 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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AbeJLazaro/TraductorEspanolOtomi | LayerNorm | false | 1,909 | [
"MIT"
] | 0 | 75e1558d3b1a7efe9beb3c7d992c3bf1d3d88d0b | https://github.com/AbeJLazaro/TraductorEspanolOtomi/tree/75e1558d3b1a7efe9beb3c7d992c3bf1d3d88d0b |
GEGLU | import torch
import torch.nn.functional as F
import torch.nn as nn
class GEGLU(nn.Module):
def forward(self, x):
x, gates = x.chunk(2, dim=-1)
return F.gelu(gates) * x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AlansBoyHeart/vit-pytorch | GEGLU | false | 1,910 | [
"MIT"
] | 0 | 1959adae0bdd7801475bba34d7d61bdc529b4616 | https://github.com/AlansBoyHeart/vit-pytorch/tree/1959adae0bdd7801475bba34d7d61bdc529b4616 |
Generator | import torch
from torch import nn
import torch.nn.functional as F
class Generator(nn.Module):
"""
Define el paso de generación lineal + softmax
"""
def __init__(self, d_model, vocab):
"""
Constructor del generador lineal
Parámetros:
d_model: Dimensión del modelo
vocab: Tamaño del vocabular... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AbeJLazaro/TraductorEspanolOtomi | Generator | false | 1,911 | [
"MIT"
] | 0 | 75e1558d3b1a7efe9beb3c7d992c3bf1d3d88d0b | https://github.com/AbeJLazaro/TraductorEspanolOtomi/tree/75e1558d3b1a7efe9beb3c7d992c3bf1d3d88d0b |
BPRLoss | import torch
import torch.nn as nn
class BPRLoss(nn.Module):
""" BPRLoss, based on Bayesian Personalized Ranking
Args:
- gamma(float): Small value to avoid division by zero
Shape:
- Pos_score: (N)
- Neg_score: (N), same shape as the Pos_score
- Output: scalar.
Exampl... | 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
... | Ahren09/RecBole | BPRLoss | false | 1,912 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
PixelNormLayer | import torch
import torch.nn as nn
class PixelNormLayer(nn.Module):
def __init__(self):
super(PixelNormLayer, self).__init__()
def forward(self, x):
return x / torch.sqrt(torch.mean(x ** 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AleksiKnuutila/ganspace | PixelNormLayer | false | 1,913 | [
"Apache-2.0"
] | 0 | 23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 | https://github.com/AleksiKnuutila/ganspace/tree/23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def forward(self, x, eps=1e-06):
norm = x.norm(dim=1, keepdim=True).clamp(min=eps)
return x / norm
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | AlansBoyHeart/vit-pytorch | L2Norm | false | 1,914 | [
"MIT"
] | 0 | 1959adae0bdd7801475bba34d7d61bdc529b4616 | https://github.com/AlansBoyHeart/vit-pytorch/tree/1959adae0bdd7801475bba34d7d61bdc529b4616 |
PositionwiseFeedForward | import torch
from torch import nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
"""
Implementa la ecuación del feed_forward networks para el transformer
"""
"""
Se implementa una red de dos capas sencillas con una ReLU en medio
FFN(x) = max(0, xW_1 + b_1)W_x + b_2
"""
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 import nn
assert_s... | AbeJLazaro/TraductorEspanolOtomi | PositionwiseFeedForward | false | 1,915 | [
"MIT"
] | 0 | 75e1558d3b1a7efe9beb3c7d992c3bf1d3d88d0b | https://github.com/AbeJLazaro/TraductorEspanolOtomi/tree/75e1558d3b1a7efe9beb3c7d992c3bf1d3d88d0b |
DoubleResolutionLayer | import torch
import torch.nn as nn
class DoubleResolutionLayer(nn.Module):
def forward(self, x):
x = nn.functional.interpolate(x, scale_factor=2, mode='nearest')
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AleksiKnuutila/ganspace | DoubleResolutionLayer | false | 1,916 | [
"Apache-2.0"
] | 0 | 23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 | https://github.com/AleksiKnuutila/ganspace/tree/23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 |
NoiseLayer | import torch
import torch.nn as nn
class NoiseLayer(nn.Module):
"""adds noise. noise is per pixel (constant over channels) with per-channel weight"""
def __init__(self, channels):
super().__init__()
self.weight = nn.Parameter(torch.zeros(channels))
self.noise = None
def forward(s... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C... | AleksiKnuutila/ganspace | NoiseLayer | false | 1,917 | [
"Apache-2.0"
] | 0 | 23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 | https://github.com/AleksiKnuutila/ganspace/tree/23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 |
SEModule | import torch
import torch.nn as nn
from torch import optim as optim
class SEModule(nn.Module):
def __init__(self, channels, channel_reduction):
super(SEModule, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.fc1 = nn.Conv2d(channels, channels // channel_reduction,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | AdityaSidharta/kaggle_humpback_new_whale | SEModule | false | 1,918 | [
"MIT"
] | 0 | 779d60746f8eba99d0336836200150fa7a08388e | https://github.com/AdityaSidharta/kaggle_humpback_new_whale/tree/779d60746f8eba99d0336836200150fa7a08388e |
OuterProductLayer | import torch
import torch.nn as nn
class OuterProductLayer(nn.Module):
"""OuterProduct Layer used in PNN. This implementation is
adapted from code that the author of the paper published on https://github.com/Atomu2014/product-nets.
"""
def __init__(self, num_feature_field, embedding_size, device):
... | 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... | Ahren09/RecBole | OuterProductLayer | false | 1,919 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.eps = eps
self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))
def forward(self, x):
std = torch.var(... | 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_... | AlansBoyHeart/vit-pytorch | LayerNorm | false | 1,920 | [
"MIT"
] | 0 | 1959adae0bdd7801475bba34d7d61bdc529b4616 | https://github.com/AlansBoyHeart/vit-pytorch/tree/1959adae0bdd7801475bba34d7d61bdc529b4616 |
Upscale2d | import torch
import torch.nn as nn
def upscale2d(x, factor=2, gain=1):
assert x.dim() == 4
if gain != 1:
x = x * gain
if factor != 1:
shape = x.shape
x = x.view(shape[0], shape[1], shape[2], 1, shape[3], 1).expand(-1,
-1, -1, factor, -1, factor)
x = x.contiguous... | 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... | AleksiKnuutila/ganspace | Upscale2d | false | 1,921 | [
"Apache-2.0"
] | 0 | 23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 | https://github.com/AleksiKnuutila/ganspace/tree/23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 |
NegSamplingLoss | import torch
import torch.nn as nn
class NegSamplingLoss(nn.Module):
def __init__(self):
super(NegSamplingLoss, self).__init__()
def forward(self, score, sign):
return -torch.mean(torch.sigmoid(sign * score))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Ahren09/RecBole | NegSamplingLoss | false | 1,922 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
BaseFactorizationMachine | import torch
import torch.nn as nn
class BaseFactorizationMachine(nn.Module):
"""Calculate FM result over the embeddings
Args:
reduce_sum: bool, whether to sum the result, default is True.
Input:
input_x: tensor, A 3D tensor with shape:``(batch_size,field_size,embed_dim)``.
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Ahren09/RecBole | BaseFactorizationMachine | false | 1,923 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
InnerProductLayer | import torch
import torch.nn as nn
class InnerProductLayer(nn.Module):
"""InnerProduct Layer used in PNN that compute the element-wise
product or inner product between feature vectors.
"""
def __init__(self, num_feature_field, device):
"""
Args:
num_feature_field(int) :nu... | 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... | Ahren09/RecBole | InnerProductLayer | false | 1,924 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
InnerProductLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class InnerProductLoss(nn.Module):
"""This is the inner-product loss used in CFKG for optimization.
"""
def __init__(self):
super(InnerProductLoss, self).__init__()
def forward(self, anchor, positive, negative):
pos_s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | Ahren09/RecBole | InnerProductLoss | false | 1,925 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
PatchEmbed | import torch
import torch.nn as nn
class PatchEmbed(nn.Module):
def __init__(self, img_size, patch_size, in_c=3, embed_dim=512):
super(PatchEmbed, self).__init__()
self.img_size = img_size
self.patch_size = patch_size
self.n_patches = (img_size // patch_size) ** 2
self.pro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AgamChopra/WGAN-GP | PatchEmbed | false | 1,926 | [
"MIT"
] | 0 | cbe15f4d2ef2ebaef477524103cbda0741098186 | https://github.com/AgamChopra/WGAN-GP/tree/cbe15f4d2ef2ebaef477524103cbda0741098186 |
MyLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
class MyLinear(nn.Module):
"""Linear layer with equalized learning rate and custom learning rate multiplier."""
def __init__(self, input_size, output_size, gain=2 ** 0.5, use_wscale=
False, lrmul=1, bias=True):
super().__init_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AleksiKnuutila/ganspace | MyLinear | false | 1,927 | [
"Apache-2.0"
] | 0 | 23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 | https://github.com/AleksiKnuutila/ganspace/tree/23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 |
AttLayer | import torch
import torch.nn as nn
import torch.nn.functional as fn
class AttLayer(nn.Module):
"""Calculate the attention signal(weight) according the input tensor.
Args:
infeatures (torch.FloatTensor): A 3D input tensor with shape of[batch_size, M, embed_dim].
Returns:
torch.FloatTensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ahren09/RecBole | AttLayer | false | 1,928 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
AGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
class AGRUCell(nn.Module):
' Attention based GRU (AGRU). AGRU uses the attention score to replace the update gate of GRU, and changes the\n hidden state directly.\n\n Formally:\n ..math: {h}_{t}^{\\prime}=\\left(1-a_{t}\right) * {h}_{... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Ahren09/RecBole | AGRUCell | false | 1,929 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
PEG | import torch
import torch.nn as nn
class Residual(nn.Module):
def __init__(self, fn):
super().__init__()
self.fn = fn
def forward(self, x, **kwargs):
return self.fn(x, **kwargs) + x
class PEG(nn.Module):
def __init__(self, dim, kernel_size=3):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AlansBoyHeart/vit-pytorch | PEG | false | 1,930 | [
"MIT"
] | 0 | 1959adae0bdd7801475bba34d7d61bdc529b4616 | https://github.com/AlansBoyHeart/vit-pytorch/tree/1959adae0bdd7801475bba34d7d61bdc529b4616 |
new_class | import torch
from torch import nn
class new_class(nn.Module):
def __init__(self):
super(new_class, self).__init__()
def forward(self, input):
return input + 1
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | AluminiumOxide/pytorch_base_-tutorial | new_class | false | 1,931 | [
"Apache-2.0"
] | 0 | a6d3bea6070c7c774dcd7c55d94b0a1441548c8b | https://github.com/AluminiumOxide/pytorch_base_-tutorial/tree/a6d3bea6070c7c774dcd7c55d94b0a1441548c8b |
Repeat_Explore_Mechanism | import torch
import torch.nn as nn
class Repeat_Explore_Mechanism(nn.Module):
def __init__(self, device, hidden_size, seq_len, dropout_prob):
super(Repeat_Explore_Mechanism, self).__init__()
self.dropout = nn.Dropout(dropout_prob)
self.hidden_size = hidden_size
self.device = devic... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ahren09/RecBole | Repeat_Explore_Mechanism | false | 1,932 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
Downsample | import torch
import torch.nn as nn
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, stride=2, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AkioHayakawa/SDEdit | Downsample | false | 1,933 | [
"MIT"
] | 0 | 54d793bc013ea99ae81c539bc559254fa8746e19 | https://github.com/AkioHayakawa/SDEdit/tree/54d793bc013ea99ae81c539bc559254fa8746e19 |
StyleMod | import torch
import torch.nn as nn
import torch.nn.functional as F
class MyLinear(nn.Module):
"""Linear layer with equalized learning rate and custom learning rate multiplier."""
def __init__(self, input_size, output_size, gain=2 ** 0.5, use_wscale=
False, lrmul=1, bias=True):
super().__init_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | AleksiKnuutila/ganspace | StyleMod | false | 1,934 | [
"Apache-2.0"
] | 0 | 23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 | https://github.com/AleksiKnuutila/ganspace/tree/23471a07c8b0d693fa7f1f2dfbb8b34ce22d9d38 |
CReLU | import torch
import torch.nn as nn
class CReLU(nn.Module):
def __init__(self):
super(CReLU, self).__init__()
self.relu = nn.ReLU()
def forward(self, x):
return torch.cat((self.relu(x), self.relu(-x)), 1)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs(... | 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... | And1210/FER_SSL | CReLU | false | 1,935 | [
"MIT"
] | 0 | 6cad839261667dce30a8b9db9638ef7334953063 | https://github.com/And1210/FER_SSL/tree/6cad839261667dce30a8b9db9638ef7334953063 |
AUGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
class AUGRUCell(nn.Module):
' Effect of GRU with attentional update gate (AUGRU). AUGRU combines attention mechanism and GRU seamlessly.\n\n Formally:\n ..math: \tilde{{u}}_{t}^{\\prime}=a_{t} * {u}_{t}^{\\prime} \\\n {h}_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Ahren09/RecBole | AUGRUCell | false | 1,936 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
GlobalAvgPool2d | import torch
from torch import nn
class GlobalAvgPool2d(nn.Module):
"""Performs global average pooling over the entire height and width of a batched 2D tensor
# Arguments
input: Input tensor
"""
def forward(self, input):
return nn.functional.avg_pool2d(input, kernel_size=input.size()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | AndreasLTeigen/few_shot_open_world | GlobalAvgPool2d | false | 1,937 | [
"MIT"
] | 0 | 3514824c4233fdff9af9c0b636435b2ff0fa6e09 | https://github.com/AndreasLTeigen/few_shot_open_world/tree/3514824c4233fdff9af9c0b636435b2ff0fa6e09 |
Upsample | import torch
import torch.nn as nn
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, stride=1, padding=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... | AkioHayakawa/SDEdit | Upsample | false | 1,938 | [
"MIT"
] | 0 | 54d793bc013ea99ae81c539bc559254fa8746e19 | https://github.com/AkioHayakawa/SDEdit/tree/54d793bc013ea99ae81c539bc559254fa8746e19 |
Model | from torch.nn import Module
import torch
from torch.nn import Linear
import torch.nn as nn
import torch.nn.functional as F
class Model(Module):
def __init__(self, input_shape, nb_classes, *args, **kwargs):
super(Model, self).__init__()
self.fc1 = Linear(input_shape[0], 25)
self.dropout1 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
f... | AishaAlaagib/machine-unlearning | Model | false | 1,939 | [
"MIT"
] | 0 | 28dd55792bacb1ffccda788b4f4dcce09e113b37 | https://github.com/AishaAlaagib/machine-unlearning/tree/28dd55792bacb1ffccda788b4f4dcce09e113b37 |
VAE | import torch
import torch.utils.data
from torch import nn
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(784, 400)
self.fc21 = nn.Linear(400, 20)
self.fc22 = nn.Linear(400, 20)
self.fc3 = nn.Linear(20, 400)
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.utils.data
from ... | AlexTaguchi/vae-example | VAE | false | 1,940 | [
"MIT"
] | 0 | 8c647f248cc6e017fc6c5e7bb17c4a552e50ee1d | https://github.com/AlexTaguchi/vae-example/tree/8c647f248cc6e017fc6c5e7bb17c4a552e50ee1d |
MLP | import torch
import torch.nn.functional as F
import torch.utils.data
class MLP(torch.nn.Module):
def __init__(self):
super(MLP, self).__init__()
self.fc1 = torch.nn.Linear(784, 512)
self.fc2 = torch.nn.Linear(512, 128)
self.fc3 = torch.nn.Linear(128, 10)
def forward(self, din... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AllenPu/DomainBed | MLP | false | 1,941 | [
"MIT"
] | 0 | 77519d71471e67f0356134abe0bf01a6dd2fdcfa | https://github.com/AllenPu/DomainBed/tree/77519d71471e67f0356134abe0bf01a6dd2fdcfa |
CVAE | import torch
import torch.utils.data
from torch import nn
class CVAE(nn.Module):
def __init__(self, conditional_size, hidden_size, latent_size):
super(CVAE, self).__init__()
self.fc1 = nn.Linear(28 * 28 + conditional_size, hidden_size)
self.fc21 = nn.Linear(hidden_size, latent_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | AlexTaguchi/vae-example | CVAE | false | 1,942 | [
"MIT"
] | 0 | 8c647f248cc6e017fc6c5e7bb17c4a552e50ee1d | https://github.com/AlexTaguchi/vae-example/tree/8c647f248cc6e017fc6c5e7bb17c4a552e50ee1d |
GlobalMaxPool1d | import torch
from torch import nn
class GlobalMaxPool1d(nn.Module):
"""Performs global max pooling over the entire length of a batched 1D tensor
# Arguments
input: Input tensor
"""
def forward(self, input):
return nn.functional.max_pool1d(input, kernel_size=input.size()[2:]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | AndreasLTeigen/few_shot_open_world | GlobalMaxPool1d | false | 1,943 | [
"MIT"
] | 0 | 3514824c4233fdff9af9c0b636435b2ff0fa6e09 | https://github.com/AndreasLTeigen/few_shot_open_world/tree/3514824c4233fdff9af9c0b636435b2ff0fa6e09 |
ConvNCFBPRLoss | import torch
import torch.nn as nn
class ConvNCFBPRLoss(nn.Module):
""" ConvNCFBPRLoss, based on Bayesian Personalized Ranking,
Shape:
- Pos_score: (N)
- Neg_score: (N), same shape as the Pos_score
- Output: scalar.
Examples::
>>> loss = ConvNCFBPRLoss()
>>> ... | 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
... | Ahren09/RecBole | ConvNCFBPRLoss | false | 1,944 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
MultiHeadAttention | import math
import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
"""
Multi-head Self-attention layers, a attention score dropout layer is introduced.
Args:
input_tensor (torch.Tensor): the input of the multi-head self-attention layer
attention_mask (torch.Tensor): the a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Ahren09/RecBole | MultiHeadAttention | false | 1,945 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
LeNet | import torch
from torch import nn
import torch.nn.functional as F
class LeNet(nn.Module):
def __init__(self):
super(LeNet, self).__init__()
self.conv1 = nn.Conv2d(3, 16, 5)
self.pool1 = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(16, 32, 5)
self.pool2 = 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 import nn
assert_s... | AluminiumOxide/pytorch_base_-tutorial | LeNet | false | 1,946 | [
"Apache-2.0"
] | 0 | a6d3bea6070c7c774dcd7c55d94b0a1441548c8b | https://github.com/AluminiumOxide/pytorch_base_-tutorial/tree/a6d3bea6070c7c774dcd7c55d94b0a1441548c8b |
Add | import torch
from typing import List
from torch import nn
from typing import Tuple
from typing import Union
class Add(nn.Module):
"""Add module for Kindle."""
def __init_(self):
"""Initialize module."""
super().__init__()
@classmethod
def forward(cls, x: 'Union[Tuple[torch.Tensor, ..... | 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... | Anon-Artist/kindle | Add | false | 1,947 | [
"MIT"
] | 0 | 7e62e370e0130e6c61db6cdd339a451d5f1f8985 | https://github.com/Anon-Artist/kindle/tree/7e62e370e0130e6c61db6cdd339a451d5f1f8985 |
LayerNorm | import torch
from torch import nn
import torch.utils.data
class LayerNorm(nn.Module):
def __init__(self, channels, eps=0.0001):
super().__init__()
self.channels = channels
self.eps = eps
self.gamma = nn.Parameter(torch.ones(channels))
self.beta = nn.Parameter(torch.zeros(c... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | AndreHe02/glow-tts | LayerNorm | false | 1,948 | [
"MIT"
] | 0 | 683f68f17790f2f46c23e9d3eadbcac352d82e2b | https://github.com/AndreHe02/glow-tts/tree/683f68f17790f2f46c23e9d3eadbcac352d82e2b |
ReviewClassifier | import torch
import torch.nn.functional as F
import torch.nn as nn
class ReviewClassifier(nn.Module):
def __init__(self, n_feature):
super(ReviewClassifier, self).__init__()
self.lf = nn.Linear(n_feature, 1, dtype=torch.float32)
def forward(self, x):
out = self.lf(x)
out = 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... | AnissHal/tal | ReviewClassifier | false | 1,949 | [
"MIT"
] | 0 | 6e96ffa367be6da54383ae9e6b0f56f7b5cf9a92 | https://github.com/AnissHal/tal/tree/6e96ffa367be6da54383ae9e6b0f56f7b5cf9a92 |
RegLoss | import torch
import torch.nn as nn
class RegLoss(nn.Module):
""" RegLoss, L2 regularization on model parameters
"""
def __init__(self):
super(RegLoss, self).__init__()
def forward(self, parameters):
reg_loss = None
for W in parameters:
if reg_loss is 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
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Ahren09/RecBole | RegLoss | false | 1,950 | [
"MIT"
] | 0 | b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 | https://github.com/Ahren09/RecBole/tree/b3921818dfbc1b81f9eda8d5e9f05bc9d9114089 |
AttentionUnit | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import init
class AttentionUnit(nn.Module):
def __init__(self, sDim, xDim, attDim):
"""
sDim, xDim -> attDim -> 1
Params:
- sDim: decoder的hidden layer dim
- xDim: encoder的output layer dim
- attDim: a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Annihilation7/aster | AttentionUnit | false | 1,951 | [
"MIT"
] | 0 | eab6946eb1f99e395abc56c3446cd05caa90e791 | https://github.com/Annihilation7/aster/tree/eab6946eb1f99e395abc56c3446cd05caa90e791 |
LossAttentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class LossAttentionLayer(nn.Module):
def __init__(self):
super(LossAttentionLayer, self).__init__()
def forward(self, features, W_1, b_1):
out_c = F.linear(features, W_1, b_1)
out = out_c - 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.... | AnetaKaczynska/ProtoPNet | LossAttentionLayer | false | 1,952 | [
"MIT"
] | 0 | 7de2aa57833586ccfd8e63dc835c8cc9db727a2f | https://github.com/AnetaKaczynska/ProtoPNet/tree/7de2aa57833586ccfd8e63dc835c8cc9db727a2f |
ShuffleCatAlt | import torch
import torch.nn as nn
class ShuffleCatAlt(nn.Module):
def forward(self, a, b):
assert a.size() == b.size()
n, c, h, w = a.size()
x = torch.zeros(n, c * 2, h, w, dtype=a.dtype, device=a.device)
x[:, ::2] = a
x[:, 1::2] = b
return x
def get_inputs():
... | 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... | AbhinandanVellanki/yolact_edge | ShuffleCatAlt | false | 1,953 | [
"MIT"
] | 0 | 06d6318cf70ef511b19aa1c14f0476e4ffac2722 | https://github.com/AbhinandanVellanki/yolact_edge/tree/06d6318cf70ef511b19aa1c14f0476e4ffac2722 |
ShuffleCat | import torch
import torch.nn as nn
class ShuffleCat(nn.Module):
def forward(self, a, b):
assert a.size() == b.size()
n, c, h, w = a.size()
a = a.permute(0, 2, 3, 1).contiguous().view(-1, c)
b = b.permute(0, 2, 3, 1).contiguous().view(-1, c)
x = torch.cat((a, b), dim=0).tra... | 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... | AbhinandanVellanki/yolact_edge | ShuffleCat | false | 1,954 | [
"MIT"
] | 0 | 06d6318cf70ef511b19aa1c14f0476e4ffac2722 | https://github.com/AbhinandanVellanki/yolact_edge/tree/06d6318cf70ef511b19aa1c14f0476e4ffac2722 |
Cat | import torch
import torch.nn as nn
class Cat(nn.Module):
def forward(self, a, b):
x = torch.cat((a, b), dim=1)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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... | AbhinandanVellanki/yolact_edge | Cat | false | 1,955 | [
"MIT"
] | 0 | 06d6318cf70ef511b19aa1c14f0476e4ffac2722 | https://github.com/AbhinandanVellanki/yolact_edge/tree/06d6318cf70ef511b19aa1c14f0476e4ffac2722 |
ShuffleCatChunk | import torch
import torch.nn as nn
class ShuffleCatChunk(nn.Module):
def forward(self, a, b):
assert a.size() == b.size()
_n, c, _h, _w = a.size()
a = torch.chunk(a, chunks=c, dim=1)
b = torch.chunk(b, chunks=c, dim=1)
x = [None] * (c * 2)
x[::2] = a
x[1::2... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AbhinandanVellanki/yolact_edge | ShuffleCatChunk | false | 1,956 | [
"MIT"
] | 0 | 06d6318cf70ef511b19aa1c14f0476e4ffac2722 | https://github.com/AbhinandanVellanki/yolact_edge/tree/06d6318cf70ef511b19aa1c14f0476e4ffac2722 |
UpsampleConvLayer | import torch
import torch.onnx
class UpsampleConvLayer(torch.nn.Module):
"""UpsampleConvLayer
Upsamples the input and then does a convolution. This method gives better results
compared to ConvTranspose2d.
ref: http://distill.pub/2016/deconv-checkerboard/
"""
def __init__(self, in_channels, ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | Ali-ry/azureml-examples | UpsampleConvLayer | false | 1,957 | [
"MIT"
] | 0 | 817ae89d2766dcafd70937a22cb3a80f100a2906 | https://github.com/Ali-ry/azureml-examples/tree/817ae89d2766dcafd70937a22cb3a80f100a2906 |
BehlerAngular | import torch
from torch import nn as nn
class BehlerAngular(nn.Module):
"""
Compute Behler type angular contribution of the angle spanned by three atoms:
:math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta`
Sets of zetas with lambdas of -1 and +1 are generated automatically.
A... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | AntonCh-G/schnetpack | BehlerAngular | false | 1,958 | [
"MIT"
] | 0 | 16f48d59b18415c18c9e324e3c3f9ebb24ce9f0d | https://github.com/AntonCh-G/schnetpack/tree/16f48d59b18415c18c9e324e3c3f9ebb24ce9f0d |
ScaledLeakyReLU | import math
import torch
from torch import nn
import torch.nn.functional as F
class ScaledLeakyReLU(nn.Module):
def __init__(self, negative_slope=0.2):
super().__init__()
self.negative_slope = negative_slope
def forward(self, input):
out = F.leaky_relu(input, negative_slope=self.nega... | 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... | ArashVahabpour/encoder4editing | ScaledLeakyReLU | false | 1,959 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
Aggregate | import torch
from torch import nn as nn
class Aggregate(nn.Module):
"""Pooling layer based on sum or average with optional masking.
Args:
axis (int): axis along which pooling is done.
mean (bool, optional): if True, use average instead for sum pooling.
keepdim (bool, optional): whethe... | 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | AntonCh-G/schnetpack | Aggregate | false | 1,960 | [
"MIT"
] | 0 | 16f48d59b18415c18c9e324e3c3f9ebb24ce9f0d | https://github.com/AntonCh-G/schnetpack/tree/16f48d59b18415c18c9e324e3c3f9ebb24ce9f0d |
LayerNorm | import torch
import torch.utils.data
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, d):
super().__init__()
self.a = nn.Parameter(torch.ones(d).unsqueeze(0).unsqueeze(0))
self.b = nn.Parameter(torch.zeros(d).unsqueeze(0).unsqueeze(0))
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dy... | AntoBcc/benchmarking-gnns | LayerNorm | false | 1,961 | [
"MIT"
] | 0 | c5750054b2f4ba0822f203fa18d382f6a3b16542 | https://github.com/AntoBcc/benchmarking-gnns/tree/c5750054b2f4ba0822f203fa18d382f6a3b16542 |
EgoAttention | import torch
import numpy as np
import torch.nn as nn
from torch.nn import functional as F
def activation_factory(activation_type):
if activation_type == 'RELU':
return F.relu
elif activation_type == 'TANH':
return torch.tanh
elif activation_type == 'ELU':
return nn.ELU()
else:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AmiEis/highway-env | EgoAttention | false | 1,962 | [
"MIT"
] | 0 | 7477d8234aa34447292ed92e7da547eac20f9d8e | https://github.com/AmiEis/highway-env/tree/7477d8234aa34447292ed92e7da547eac20f9d8e |
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... | ArashVahabpour/encoder4editing | PixelNorm | false | 1,963 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
RMSELoss | import torch
import torch.nn as nn
class RMSELoss(nn.Module):
def __init__(self):
super().__init__()
self.mse = nn.MSELoss()
def forward(self, x, y):
loss = torch.sqrt(self.mse(x, y))
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | Aquarium1222/Electricity-Forecasting | RMSELoss | false | 1,964 | [
"MIT"
] | 0 | 9f945d3fd8006e5d77da08ff7861577965109ec8 | https://github.com/Aquarium1222/Electricity-Forecasting/tree/9f945d3fd8006e5d77da08ff7861577965109ec8 |
CORblock_Z | import torch
import torch.utils.model_zoo
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class Identity(nn.Module):
"""
Helper module that stores the current tensor. Useful for accessing by name
"""
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
import torch.utils.model_zoo
... | AnnaTruzzi/cornet_analysis | CORblock_Z | false | 1,965 | [
"MIT"
] | 0 | 0a2fd0c5a6b09a80d3c8a47441b08fd6129f7a2d | https://github.com/AnnaTruzzi/cornet_analysis/tree/0a2fd0c5a6b09a80d3c8a47441b08fd6129f7a2d |
InstanceNorm | import torch
import torch.utils.data
from torch import nn
class InstanceNorm(nn.Module):
def __init__(self, epsilon=1e-08):
super(InstanceNorm, self).__init__()
self.epsilon = epsilon
def forward(self, x):
x = x - torch.mean(x, (2, 3), True)
tmp = torch.mul(x, x)
tmp ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyn... | Archjbald/PoseStylizer | InstanceNorm | false | 1,966 | [
"BSD-3-Clause"
] | 0 | 95aae02d1f4ac83536d91b8db5f78d12e7830f97 | https://github.com/Archjbald/PoseStylizer/tree/95aae02d1f4ac83536d91b8db5f78d12e7830f97 |
SkipConnection | import torch
import torch.utils.data
import torch.nn as nn
def _init_weights(layer):
"""
Init weights of the layer
:param layer:
:return:
"""
nn.init.xavier_uniform_(layer.weight)
if layer.bias is not None:
nn.init.zeros_(layer.bias)
class SkipConnection(nn.Module):
"""
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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | AntoBcc/benchmarking-gnns | SkipConnection | false | 1,967 | [
"MIT"
] | 0 | c5750054b2f4ba0822f203fa18d382f6a3b16542 | https://github.com/AntoBcc/benchmarking-gnns/tree/c5750054b2f4ba0822f203fa18d382f6a3b16542 |
DQN | import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
def __init__(self, n_in, n_out):
super(DQN, self).__init__()
self.ln1 = nn.Linear(n_in, 32)
self.ln2 = nn.Linear(32, 32)
self.ln4 = nn.Linear(32, 32)
self.out = nn.Linear(32, n_out)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AndrejHafner/tetris-reinforcement-learning | DQN | false | 1,968 | [
"MIT"
] | 0 | 52db5d8ce7f9162b15575456a0effc69dd7fb2bf | https://github.com/AndrejHafner/tetris-reinforcement-learning/tree/52db5d8ce7f9162b15575456a0effc69dd7fb2bf |
L2Norm | import torch
import torch.utils.data
import torch.nn as nn
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
self.eps = 1e-10
self.weight = nn.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
import torch.nn.init as init
asse... | Anonymous4604/Self-ADE_SSD | L2Norm | false | 1,969 | [
"MIT"
] | 0 | eb4107e17721e17f2dedbdae654a43fc5d291f8c | https://github.com/Anonymous4604/Self-ADE_SSD/tree/eb4107e17721e17f2dedbdae654a43fc5d291f8c |
EqualConv2d | import math
import torch
from torch import nn
import torch.nn.functional as F
class EqualConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_channel, in_channel,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dynamo.guards.as... | ArashVahabpour/encoder4editing | EqualConv2d | false | 1,970 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
NoiseInjection | import torch
from torch import nn
class NoiseInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = image.new... | 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... | ArashVahabpour/encoder4editing | NoiseInjection | false | 1,971 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
QuickGELU | import torch
from torch import nn
class QuickGELU(nn.Module):
def forward(self, x: 'torch.Tensor'):
return x * torch.sigmoid(1.702 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Artanic30/RentalPrediction | QuickGELU | false | 1,972 | [
"MIT"
] | 0 | 5804ab9b453d2a40bce2bb304c31efc98a803ed8 | https://github.com/Artanic30/RentalPrediction/tree/5804ab9b453d2a40bce2bb304c31efc98a803ed8 |
HuberLoss | import torch
import torch.nn as nn
import torch.utils.data
class HuberLoss(nn.Module):
def __init__(self, delta=1):
super().__init__()
self.huber_loss_delta1 = nn.SmoothL1Loss()
self.delta = delta
def forward(self, x, x_hat):
loss = self.huber_loss_delta1(x / self.delta, x_ha... | 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
... | ArashVahabpour/sog-gail | HuberLoss | false | 1,973 | [
"MIT"
] | 0 | 90ebdc5a051a015f3b6c801d4b16307d2fbac0ae | https://github.com/ArashVahabpour/sog-gail/tree/90ebdc5a051a015f3b6c801d4b16307d2fbac0ae |
PixelNorm | import torch
import torch.utils.data
from torch import nn
class PixelNorm(nn.Module):
def __init__(self, epsilon=1e-08):
super(PixelNorm, self).__init__()
self.epsilon = epsilon
def forward(self, x):
tmp = torch.mul(x, x)
tmp1 = torch.rsqrt(torch.mean(tmp, dim=1, keepdim=True... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyn... | Archjbald/PoseStylizer | PixelNorm | false | 1,974 | [
"BSD-3-Clause"
] | 0 | 95aae02d1f4ac83536d91b8db5f78d12e7830f97 | https://github.com/Archjbald/PoseStylizer/tree/95aae02d1f4ac83536d91b8db5f78d12e7830f97 |
SEModule | from torch.nn import Module
import torch
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import Sigmoid
from torch.nn import AdaptiveAvgPool2d
class SEModule(Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
self.avg_pool = AdaptiveAvgPool2d(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.nn import Module
f... | ArashVahabpour/encoder4editing | SEModule | false | 1,975 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
EqualLinear | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.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)
class FusedLeakyReLUFunctionBackward(Function):
@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.autograd import Function
import math
from torch import nn
assert_size... | ArashVahabpour/encoder4editing | EqualLinear | false | 1,976 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
Normalize | import torch
import torch.utils.data
from torch import nn
class Normalize(nn.Module):
def __init__(self, power=2):
super(Normalize, self).__init__()
self.power = power
def forward(self, x):
norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power)
out = x.div(norm +... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyn... | Archjbald/PoseStylizer | Normalize | false | 1,977 | [
"BSD-3-Clause"
] | 0 | 95aae02d1f4ac83536d91b8db5f78d12e7830f97 | https://github.com/Archjbald/PoseStylizer/tree/95aae02d1f4ac83536d91b8db5f78d12e7830f97 |
LayerNorm | import torch
import torch.nn as nn
import torch.utils.data
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
"""
def __init__(self, features, center=True, scale=False, eps=1e-06):
super().__init__()
self.center = center
self.scale = scale
self.eps = eps
if s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dy... | ArashVahabpour/sog-gail | LayerNorm | false | 1,978 | [
"MIT"
] | 0 | 90ebdc5a051a015f3b6c801d4b16307d2fbac0ae | https://github.com/ArashVahabpour/sog-gail/tree/90ebdc5a051a015f3b6c801d4b16307d2fbac0ae |
FC | import torch
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class FC(nn.Module):
def __init__(self, in_channels, out_channels, gain=2 ** 0.5, use_wscale
=False, lrmul=1.0, bias=True):
super(FC, self).__init__()
he_std = gain * in_channels ** -0.5
if u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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._dyna... | Archjbald/PoseStylizer | FC | false | 1,979 | [
"BSD-3-Clause"
] | 0 | 95aae02d1f4ac83536d91b8db5f78d12e7830f97 | https://github.com/Archjbald/PoseStylizer/tree/95aae02d1f4ac83536d91b8db5f78d12e7830f97 |
ApplyStyle | import torch
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class FC(nn.Module):
def __init__(self, in_channels, out_channels, gain=2 ** 0.5, use_wscale
=False, lrmul=1.0, bias=True):
super(FC, self).__init__()
he_std = gain * in_channels ** -0.5
if u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.functional as F
ass... | Archjbald/PoseStylizer | ApplyStyle | false | 1,980 | [
"BSD-3-Clause"
] | 0 | 95aae02d1f4ac83536d91b8db5f78d12e7830f97 | https://github.com/Archjbald/PoseStylizer/tree/95aae02d1f4ac83536d91b8db5f78d12e7830f97 |
MergeLayer | import torch
class MergeLayer(torch.nn.Module):
"""(dim1+dim2)->dim3->dim4"""
def __init__(self, dim1, dim2, dim3, dim4):
super().__init__()
self.fc1 = torch.nn.Linear(dim1 + dim2, dim3)
self.fc2 = torch.nn.Linear(dim3, dim4)
self.act = torch.nn.ReLU()
torch.nn.init.xa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | Aryn-VG/ASTGN-cDB | MergeLayer | false | 1,981 | [
"MIT"
] | 0 | a9977736a361adac9a7b6f8bad2b5317651be36a | https://github.com/Aryn-VG/ASTGN-cDB/tree/a9977736a361adac9a7b6f8bad2b5317651be36a |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handle fp16."""
def forward(self, x: 'torch.Tensor'):
orig_type = x.dtype
ret = super().forward(x.type(torch.float32))
return ret.type(orig_type)
def get_inputs():
return [torch.ran... | 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... | Artanic30/RentalPrediction | LayerNorm | false | 1,982 | [
"MIT"
] | 0 | 5804ab9b453d2a40bce2bb304c31efc98a803ed8 | https://github.com/Artanic30/RentalPrediction/tree/5804ab9b453d2a40bce2bb304c31efc98a803ed8 |
MaskedCrossEntropyCriterion | import torch
import torch.nn as nn
from torch.nn.modules.loss import _WeightedLoss
class MaskedCrossEntropyCriterion(_WeightedLoss):
def __init__(self, ignore_index=[-100], reduce=None):
super(MaskedCrossEntropyCriterion, self).__init__()
self.padding_idx = ignore_index
self.reduce = redu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.... | ArkanDH/Team5-Inverse-Cooking-Stuff | MaskedCrossEntropyCriterion | false | 1,983 | [
"MIT"
] | 0 | ec224918b25fb7a04aa09995e4d11804448df7dd | https://github.com/ArkanDH/Team5-Inverse-Cooking-Stuff/tree/ec224918b25fb7a04aa09995e4d11804448df7dd |
PrecomputedNorm | import torch
import torch.nn as nn
class PrecomputedNorm(nn.Module):
"""Normalization using Pre-computed Mean/Std.
Args:
stats: Precomputed (mean, std).
axis: Axis setting used to calculate mean/variance.
"""
def __init__(self, stats, axis=[1, 2]):
super().__init__()
s... | 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... | AyushExel/s3prl | PrecomputedNorm | false | 1,984 | [
"MIT"
] | 0 | 6531904e9621a778978b9cfef3ba9f582e56639a | https://github.com/AyushExel/s3prl/tree/6531904e9621a778978b9cfef3ba9f582e56639a |
AttentivePooling | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AyushExel/s3prl | AttentivePooling | false | 1,985 | [
"MIT"
] | 0 | 6531904e9621a778978b9cfef3ba9f582e56639a | https://github.com/AyushExel/s3prl/tree/6531904e9621a778978b9cfef3ba9f582e56639a |
ToRGB | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.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 make_kernel(k):
k = torch.tensor(k, dtype=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.autograd import Function
import math
from torch import nn
import torc... | ArashVahabpour/encoder4editing | ToRGB | false | 1,986 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
SoftmaxLoss | import torch
import torch.nn as nn
class SoftmaxLoss(nn.Module):
def __init__(self, hidden_dim, speaker_num, **kwargs):
"""
Softmax Loss
"""
super(SoftmaxLoss, self).__init__()
self.fc = nn.Linear(hidden_dim, speaker_num)
self.loss = nn.CrossEntropyLoss()
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AyushExel/s3prl | SoftmaxLoss | false | 1,987 | [
"MIT"
] | 0 | 6531904e9621a778978b9cfef3ba9f582e56639a | https://github.com/AyushExel/s3prl/tree/6531904e9621a778978b9cfef3ba9f582e56639a |
ScaledL2Norm | import torch
import torch.onnx
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledL2Norm(nn.Module):
def __init__(self, in_channels, initial_scale):
super(ScaledL2Norm, self).__init__()
self.in_channels = in_channels
self.scale = nn.Parameter(torch.Tensor(in_ch... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.onnx
import tor... | AndySer37/pytorch-ssd-mobile | ScaledL2Norm | false | 1,988 | [
"MIT"
] | 0 | ec4935940ffa374edc1e9a7009c279e727e548d7 | https://github.com/AndySer37/pytorch-ssd-mobile/tree/ec4935940ffa374edc1e9a7009c279e727e548d7 |
ChannelNorm | import torch
import torch.nn as nn
class ChannelNorm(nn.Module):
def __init__(self, numFeatures, epsilon=1e-05, affine=True):
super(ChannelNorm, self).__init__()
if affine:
self.weight = nn.parameter.Parameter(torch.Tensor(1,
numFeatures, 1))
self.bias = nn... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AyushExel/s3prl | ChannelNorm | false | 1,989 | [
"MIT"
] | 0 | 6531904e9621a778978b9cfef3ba9f582e56639a | https://github.com/AyushExel/s3prl/tree/6531904e9621a778978b9cfef3ba9f582e56639a |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
from torch import nn
import torch.nn.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 make_kernel(k):
k = torch.tensor(k, dtype=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.triton_helpers import libdevice
from torch.autograd... | ArashVahabpour/encoder4editing | ModulatedConv2d | false | 1,990 | [
"MIT"
] | 0 | 819b90ecd7397fbe2ab7cb30eb451dab0f3149fd | https://github.com/ArashVahabpour/encoder4editing/tree/819b90ecd7397fbe2ab7cb30eb451dab0f3149fd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.