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 |
|---|---|---|---|---|---|---|---|---|---|---|
ConvSig | import math
import torch
import torch.nn.functional as F
from torch.nn import Conv2d
from torch.nn import Sigmoid
class PadSameConv2d(torch.nn.Module):
def __init__(self, kernel_size, stride=1):
"""
Imitates padding_mode="same" from tensorflow.
:param kernel_size: Kernelsize of the convol... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn.functional as F
from torch.nn import Conv2d
from tor... | pc2005/MonoRec | ConvSig | false | 12,867 | [
"MIT"
] | 0 | 6e1628eeef9987b1acce3e5e8bb6a6a324fc8d2c | https://github.com/pc2005/MonoRec/tree/6e1628eeef9987b1acce3e5e8bb6a6a324fc8d2c |
ConvReLU | import math
import torch
import torch.nn.functional as F
from torch.nn import Conv2d
from torch.nn import LeakyReLU
class PadSameConv2d(torch.nn.Module):
def __init__(self, kernel_size, stride=1):
"""
Imitates padding_mode="same" from tensorflow.
:param kernel_size: Kernelsize of the conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn.functional as F
from torch.nn import Conv2d
from tor... | pc2005/MonoRec | ConvReLU | false | 12,868 | [
"MIT"
] | 0 | 6e1628eeef9987b1acce3e5e8bb6a6a324fc8d2c | https://github.com/pc2005/MonoRec/tree/6e1628eeef9987b1acce3e5e8bb6a6a324fc8d2c |
Block | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torch.nn import functional as F
class RWKV_TimeMix(nn.Module):
def __init__(self, config, layer_id):
super().__init__()
assert config.n_attn % config.n_head == 0
self.layer_id = layer_id
self.ctx... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ofooo/AI-Writer | Block | false | 12,869 | [
"BSD-3-Clause"
] | 0 | 1ba84894c15c9e5605d3c6cd7521d5c6dab6eb6d | https://github.com/ofooo/AI-Writer/tree/1ba84894c15c9e5605d3c6cd7521d5c6dab6eb6d |
Gaussian | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Gaussian(nn.Module):
def __init__(self, in_dim, z_dim):
super(Gaussian, self).__init__()
self.mu = nn.Linear(in_dim, z_dim)
self.var = nn.Linear(in_dim, z_dim)
def reparameterize(self, mu... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libd... | pclucas14/GMVAE | Gaussian | false | 12,870 | [
"MIT"
] | 0 | cdabcd636b70a47adf8c06e9dde4f34c46b68a5d | https://github.com/pclucas14/GMVAE/tree/cdabcd636b70a47adf8c06e9dde4f34c46b68a5d |
VitMlpHead | import torch
def get_args():
parser = argparse.ArgumentParser()
group = parser.add_argument_group(title='input data')
group.add_argument('--input', type=str, required=True, help=
'Path to input JSON')
group.add_argument('--json-keys', nargs='+', default=['text'], help=
'space separate ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
assert_size_stride ... | parsa-epfl/Megatron-LM | VitMlpHead | false | 12,871 | [
"MIT"
] | 0 | 0301c00ce60b7c75f315e7aa4ff38238186762b1 | https://github.com/parsa-epfl/Megatron-LM/tree/0301c00ce60b7c75f315e7aa4ff38238186762b1 |
Attention | import math
import torch
import torch as t
import torch.nn as nn
class Linear(nn.Module):
"""
Linear Module
"""
def __init__(self, in_dim, out_dim, bias=True, w_init='linear'):
"""
:param in_dim: dimension of input
:param out_dim: dimension of output
:param bias: boole... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | pandeydeep9/Attentive-Neural-Process | Attention | false | 12,872 | [
"Apache-2.0"
] | 0 | 7bbdc46d51ab0c891067e508d00a029c07d04802 | https://github.com/pandeydeep9/Attentive-Neural-Process/tree/7bbdc46d51ab0c891067e508d00a029c07d04802 |
ConvReLU2 | import math
import torch
import torch.nn.functional as F
from torch.nn import Conv2d
from torch.nn import LeakyReLU
class PadSameConv2d(torch.nn.Module):
def __init__(self, kernel_size, stride=1):
"""
Imitates padding_mode="same" from tensorflow.
:param kernel_size: Kernelsize of the conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn.functional as F
from torch.nn import Conv2d
from tor... | pc2005/MonoRec | ConvReLU2 | false | 12,873 | [
"MIT"
] | 0 | 6e1628eeef9987b1acce3e5e8bb6a6a324fc8d2c | https://github.com/pc2005/MonoRec/tree/6e1628eeef9987b1acce3e5e8bb6a6a324fc8d2c |
ShakeResNet | import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.size(0)).uniform_()
alp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 math
from torch import... | pemcconnell-anyvision/fast-autoaugment | ShakeResNet | false | 12,874 | [
"MIT"
] | 0 | 047cf4bb9ffb85d0e8266a425347cdfe99d16902 | https://github.com/pemcconnell-anyvision/fast-autoaugment/tree/047cf4bb9ffb85d0e8266a425347cdfe99d16902 |
ShakeResNeXt | import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeShake(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, training=True):
if training:
alpha = torch.FloatTensor(x1.size(0)).uniform_()
alp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 math
from torch import... | pemcconnell-anyvision/fast-autoaugment | ShakeResNeXt | false | 12,875 | [
"MIT"
] | 0 | 047cf4bb9ffb85d0e8266a425347cdfe99d16902 | https://github.com/pemcconnell-anyvision/fast-autoaugment/tree/047cf4bb9ffb85d0e8266a425347cdfe99d16902 |
GaussianKernel | import torch
from typing import Optional
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
class GaussianKernel(nn.Module):
"""Gaussian Kernel Matrix
Gaussian Kernel k is defined by
.. math::
k(x_1, x_2) = \\exp \\left( ... | 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 typing import Opt... | mstoelzle/Transfer-Learning-Library | GaussianKernel | false | 12,876 | [
"MIT"
] | 0 | 7d5022668cbe6d1bedbc7c386d44b9d89c272d6b | https://github.com/mstoelzle/Transfer-Learning-Library/tree/7d5022668cbe6d1bedbc7c386d44b9d89c272d6b |
Theta | from torch.autograd import Function
import torch
from typing import Optional
from typing import Tuple
import torch.nn as nn
from typing import Any
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
class GradientReverseFunction(Function):
@staticmethod
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
from typing import Optional
from typing impo... | mstoelzle/Transfer-Learning-Library | Theta | false | 12,877 | [
"MIT"
] | 0 | 7d5022668cbe6d1bedbc7c386d44b9d89c272d6b | https://github.com/mstoelzle/Transfer-Learning-Library/tree/7d5022668cbe6d1bedbc7c386d44b9d89c272d6b |
Minimum | import torch
import torch.nn as nn
from torch import optim as optim
class Minimum(nn.Module):
def forward(self, x, y):
return torch.minimum(x, y)
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from torch import optim as optim
assert_size_stride = torch._C._dyn... | pgruening/ConvNeXt | Minimum | false | 12,878 | [
"MIT"
] | 0 | e9a1beaf312f3a724f0c21d098efbe7db872b049 | https://github.com/pgruening/ConvNeXt/tree/e9a1beaf312f3a724f0c21d098efbe7db872b049 |
NormLoss | import torch
class NormLoss(torch.nn.Module):
"""
Norm penalty on function
parameters:
p - dimension of norm
"""
def __init__(self, p):
super(NormLoss, self).__init__()
self.p = p
def forward(self, beta):
return torch.norm(beta, p=self.p)
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
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | phernst/TopologyLayer | NormLoss | false | 12,879 | [
"MIT"
] | 0 | aad72704114235156a244ddaa14dc805530e3fc7 | https://github.com/phernst/TopologyLayer/tree/aad72704114235156a244ddaa14dc805530e3fc7 |
SobLoss | import torch
class SobLoss(torch.nn.Module):
"""
Sobolev norm penalty on function
(sum |x_{i} - x{i+1}|^p)^{1/p}
parameters:
p - dimension of norm
"""
def __init__(self, p):
super(SobLoss, self).__init__()
self.p = p
def forward(self, beta):
hdiff = beta[... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | phernst/TopologyLayer | SobLoss | false | 12,880 | [
"MIT"
] | 0 | aad72704114235156a244ddaa14dc805530e3fc7 | https://github.com/phernst/TopologyLayer/tree/aad72704114235156a244ddaa14dc805530e3fc7 |
Net | import torch
import torch.nn as nn
from time import *
class Net(nn.Module):
def __init__(self, input_size, output_size, hidden_size):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.relu = nn.ReLU()
self.softmax = nn.Softmax(dim=1)
self.fc2 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | pfontana96/smart-sailboat | Net | false | 12,881 | [
"MIT"
] | 0 | 25b2a524b2601b3f8e72092d7a34beb849b617db | https://github.com/pfontana96/smart-sailboat/tree/25b2a524b2601b3f8e72092d7a34beb849b617db |
DeepNeuralNetwork | import torch
import torch.nn as nn
class DeepNeuralNetwork(nn.Module):
def __init__(self, u):
super(DeepNeuralNetwork, self).__init__()
self.fc1 = nn.Linear(1, u)
self.fc2 = nn.Linear(u, u)
self.fc3 = nn.Linear(u, u)
self.fc4 = nn.Linear(u, 1)
self.ReLu = nn.ReLU()... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | peacefighter1996/PlantRecognisionFromVoxels | DeepNeuralNetwork | false | 12,882 | [
"MIT"
] | 0 | 4cc9a05dbe499d5ccdc6f933c4340c283a938b29 | https://github.com/peacefighter1996/PlantRecognisionFromVoxels/tree/4cc9a05dbe499d5ccdc6f933c4340c283a938b29 |
GAT | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=False
):
super(GraphAt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | omsrisagar/KG-A2C | GAT | false | 12,883 | [
"MIT"
] | 0 | c3ea64eabbfe090c2bb9f68999d0a68946f94b85 | https://github.com/omsrisagar/KG-A2C/tree/c3ea64eabbfe090c2bb9f68999d0a68946f94b85 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""Norm to 0-mean 1-std , then do a learned diagonal affine transform."""
def __init__(self, features, eps=1e-05):
super(LayerNorm, self).__init__()
self.scale = nn.Parameter(torch.ones(features))
self.shift = 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
assert_size_stride = torch._C._dynamo.guards.assert_size_... | mzz235711/IAM | LayerNorm | false | 12,884 | [
"Apache-2.0"
] | 0 | e42c2b766442b666224b107b671eeab65f9b8efd | https://github.com/mzz235711/IAM/tree/e42c2b766442b666224b107b671eeab65f9b8efd |
MarginDisparityDiscrepancy | import torch
from typing import Optional
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
def shift_log(x: 'torch.Tensor', offset: 'Optional[float]'=1e-06
) ->torch.Tensor:
"""
First shift, then ca... | 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 typing import Opt... | mstoelzle/Transfer-Learning-Library | MarginDisparityDiscrepancy | false | 12,885 | [
"MIT"
] | 0 | 7d5022668cbe6d1bedbc7c386d44b9d89c272d6b | https://github.com/mstoelzle/Transfer-Learning-Library/tree/7d5022668cbe6d1bedbc7c386d44b9d89c272d6b |
FeatClassifier | import torch
import torch.nn as nn
class FeatClassifier(nn.Module):
"""
This is the second downstream classifier working on the feature extracted
from the up stream feature.
"""
def __init__(self, input_dim, hidden_dim, activation_function):
super().__init__()
self.name = 'FeatCla... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | pilambdagammarho/Anomaly-Detection-Benchmarking | FeatClassifier | false | 12,886 | [
"MIT"
] | 0 | 7199b703f78fcfd66268323e594a4af135c0a7e7 | https://github.com/pilambdagammarho/Anomaly-Detection-Benchmarking/tree/7199b703f78fcfd66268323e594a4af135c0a7e7 |
LearnedPositionalEncoding | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class LearnedPositionalEncoding(nn.Module):
def __init__(self, context_size, embedding_dim, dropout=0):
super(LearnedPositionalEncoding, self).__init__()
self.pe = nn.Embedding(context_size, embedding_dim)
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
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | pltrdy/encoder-agnostic-adaptation | LearnedPositionalEncoding | false | 12,887 | [
"MIT"
] | 0 | e45d157f84804696e109e5952957570fd781e9b7 | https://github.com/pltrdy/encoder-agnostic-adaptation/tree/e45d157f84804696e109e5952957570fd781e9b7 |
SineODE | import math
import torch
class SineODE(torch.nn.Module):
def __init__(self, device):
super(SineODE, self).__init__()
def forward(self, t, y):
return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3
def y_exact(self, t):
return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * ... | 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 math
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | navaro1/parking_prediction | SineODE | false | 12,888 | [
"MIT"
] | 0 | c532a2f75155abc9c0d4be9c955eabe368591932 | https://github.com/navaro1/parking_prediction/tree/c532a2f75155abc9c0d4be9c955eabe368591932 |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_dim=4, obs_dim=2, nhidden=20):
super(Decoder, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.fc1 = nn.Linear(latent_dim, nhidden)
self.fc2 = nn.Linear(nhidden, obs_dim)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | navaro1/parking_prediction | Decoder | false | 12,889 | [
"MIT"
] | 0 | c532a2f75155abc9c0d4be9c955eabe368591932 | https://github.com/navaro1/parking_prediction/tree/c532a2f75155abc9c0d4be9c955eabe368591932 |
SimpleFusionGenerator | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class SimpleFusionGenerator(nn.Module):
def __init__(self, decoder_input_size, lm_input_size, output_size):
super(SimpleFusionGenerator, self).__init__()
self.decoder_linear = nn.Linear(decoder_input_size, output_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.... | pltrdy/encoder-agnostic-adaptation | SimpleFusionGenerator | false | 12,890 | [
"MIT"
] | 0 | e45d157f84804696e109e5952957570fd781e9b7 | https://github.com/pltrdy/encoder-agnostic-adaptation/tree/e45d157f84804696e109e5952957570fd781e9b7 |
ConstantODE | import torch
class ConstantODE(torch.nn.Module):
def __init__(self, device):
super(ConstantODE, self).__init__()
self.a = torch.nn.Parameter(torch.tensor(0.2))
self.b = torch.nn.Parameter(torch.tensor(3.0))
def forward(self, t, y):
return self.a + (y - (self.a * t + self.b)) ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | navaro1/parking_prediction | ConstantODE | false | 12,891 | [
"MIT"
] | 0 | c532a2f75155abc9c0d4be9c955eabe368591932 | https://github.com/navaro1/parking_prediction/tree/c532a2f75155abc9c0d4be9c955eabe368591932 |
Block | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
class LayerNorm(nn.Module):
""" LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | pgruening/ConvNeXt | Block | false | 12,892 | [
"MIT"
] | 0 | e9a1beaf312f3a724f0c21d098efbe7db872b049 | https://github.com/pgruening/ConvNeXt/tree/e9a1beaf312f3a724f0c21d098efbe7db872b049 |
NextMinMinusAbsBlockNoNorm | import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
class LayerNorm(nn.Module):
""" LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | pgruening/ConvNeXt | NextMinMinusAbsBlockNoNorm | false | 12,893 | [
"MIT"
] | 0 | e9a1beaf312f3a724f0c21d098efbe7db872b049 | https://github.com/pgruening/ConvNeXt/tree/e9a1beaf312f3a724f0c21d098efbe7db872b049 |
CeCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.alpha = alpha
... | 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.... | posuer/mt-dnn | CeCriterion | false | 12,894 | [
"MIT"
] | 0 | 5106083238654777838aaab5d1111b3b05c4ce04 | https://github.com/posuer/mt-dnn/tree/5106083238654777838aaab5d1111b3b05c4ce04 |
NextMinBlock | import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
class LayerNorm(nn.Module):
""" LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | pgruening/ConvNeXt | NextMinBlock | false | 12,895 | [
"MIT"
] | 0 | e9a1beaf312f3a724f0c21d098efbe7db872b049 | https://github.com/pgruening/ConvNeXt/tree/e9a1beaf312f3a724f0c21d098efbe7db872b049 |
BiLinearSim | from _paritybench_helpers import _mock_config
import torch
from torch.optim.lr_scheduler import *
class BiLinearSim(torch.nn.Module):
def __init__(self, config):
super().__init__()
self.linear = torch.nn.Linear(config.hidden_size, config.
hidden_size, bias=False)
def forward(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.optim.lr_scheduler import *
assert_size_stride = torch._C._dynamo.gua... | posuer/mt-dnn | BiLinearSim | false | 12,896 | [
"MIT"
] | 0 | 5106083238654777838aaab5d1111b3b05c4ce04 | https://github.com/posuer/mt-dnn/tree/5106083238654777838aaab5d1111b3b05c4ce04 |
ResBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ResBlock(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | navaro1/parking_prediction | ResBlock | false | 12,897 | [
"MIT"
] | 0 | c532a2f75155abc9c0d4be9c955eabe368591932 | https://github.com/navaro1/parking_prediction/tree/c532a2f75155abc9c0d4be9c955eabe368591932 |
SpatialRescaler | import torch
from functools import partial
import torch.nn as nn
class SpatialRescaler(nn.Module):
def __init__(self, n_stages=1, method='bilinear', multiplier=0.5,
in_channels=3, out_channels=None, bias=False):
super().__init__()
self.n_stages = n_stages
assert self.n_stages >= 0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from functools import partial
import torch.nn as nn
assert_size_stride = torch._C._dynamo... | poliver269/latent-diffusion | SpatialRescaler | false | 12,898 | [
"MIT"
] | 0 | 08e7c987ad423e3f93125b49980c36302ffe3d82 | https://github.com/poliver269/latent-diffusion/tree/08e7c987ad423e3f93125b49980c36302ffe3d82 |
Cosine | from _paritybench_helpers import _mock_config
import torch
from torch.optim.lr_scheduler import *
class Cosine(torch.nn.Module):
def __init__(self, config):
super().__init__()
def forward(self, src, tgt):
src = src.float()
tgt = tgt.float()
return (torch.matmul(src, tgt.trans... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.optim.lr... | posuer/mt-dnn | Cosine | false | 12,899 | [
"MIT"
] | 0 | 5106083238654777838aaab5d1111b3b05c4ce04 | https://github.com/posuer/mt-dnn/tree/5106083238654777838aaab5d1111b3b05c4ce04 |
TransposedUpsample | import torch
import torch.nn as nn
class TransposedUpsample(nn.Module):
"""Learned 2x upsampling without padding"""
def __init__(self, channels, out_channels=None, ks=5):
super().__init__()
self.channels = channels
self.out_channels = out_channels or channels
self.up = nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | poliver269/latent-diffusion | TransposedUpsample | false | 12,900 | [
"MIT"
] | 0 | 08e7c987ad423e3f93125b49980c36302ffe3d82 | https://github.com/poliver269/latent-diffusion/tree/08e7c987ad423e3f93125b49980c36302ffe3d82 |
RMSNorm | import torch
import torch.nn as nn
class RMSNorm(nn.Module):
def __init__(self, dim, eps=1e-08):
super().__init__()
self.scale = dim ** -0.5
self.eps = eps
self.g = nn.Parameter(torch.ones(dim))
def forward(self, x):
norm = torch.norm(x, dim=-1, keepdim=True) * self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | poliver269/latent-diffusion | RMSNorm | false | 12,901 | [
"MIT"
] | 0 | 08e7c987ad423e3f93125b49980c36302ffe3d82 | https://github.com/poliver269/latent-diffusion/tree/08e7c987ad423e3f93125b49980c36302ffe3d82 |
ChannelPool | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class ChannelPool(nn.Module):
def forward(self, x):
channel_out = torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.
mean(x, 1).unsqueeze(1)), dim=1)
return channel_out
def get_inputs():
return [torch.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch._C
import torch.serialization
assert_size_stride = tor... | pprp/mmsegmentation | ChannelPool | false | 12,902 | [
"Apache-2.0"
] | 0 | 5d615401358dea2d6527a033bef505a9c7e0f034 | https://github.com/pprp/mmsegmentation/tree/5d615401358dea2d6527a033bef505a9c7e0f034 |
PixelSort | import torch
from torch import nn
class PixelSort(nn.Module):
"""The inverse operation of PixelShuffle
Reduces the spatial resolution, increasing the number of channels.
Currently, scale 0.5 is supported only.
Later, torch.nn.functional.pixel_sort may be implemented.
Reference:
http://pyto... | 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... | pshn111/803-Project | PixelSort | false | 12,903 | [
"MIT"
] | 0 | 19430f25d91b31e4b9a7f1d864e2aa2851dcddf0 | https://github.com/pshn111/803-Project/tree/19430f25d91b31e4b9a7f1d864e2aa2851dcddf0 |
ScaleNorm | import torch
import torch.nn as nn
class ScaleNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.scale = dim ** -0.5
self.eps = eps
self.g = nn.Parameter(torch.ones(1))
def forward(self, x):
norm = torch.norm(x, dim=-1, keepdim=True) * self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | poliver269/latent-diffusion | ScaleNorm | false | 12,904 | [
"MIT"
] | 0 | 08e7c987ad423e3f93125b49980c36302ffe3d82 | https://github.com/poliver269/latent-diffusion/tree/08e7c987ad423e3f93125b49980c36302ffe3d82 |
CMlp | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class CMlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | pprp/mmsegmentation | CMlp | false | 12,905 | [
"Apache-2.0"
] | 0 | 5d615401358dea2d6527a033bef505a9c7e0f034 | https://github.com/pprp/mmsegmentation/tree/5d615401358dea2d6527a033bef505a9c7e0f034 |
KlCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.alpha = alpha
... | 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.... | posuer/mt-dnn | KlCriterion | false | 12,906 | [
"MIT"
] | 0 | 5106083238654777838aaab5d1111b3b05c4ce04 | https://github.com/posuer/mt-dnn/tree/5106083238654777838aaab5d1111b3b05c4ce04 |
MseCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.alpha = alpha
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
assert_siz... | posuer/mt-dnn | MseCriterion | false | 12,907 | [
"MIT"
] | 0 | 5106083238654777838aaab5d1111b3b05c4ce04 | https://github.com/posuer/mt-dnn/tree/5106083238654777838aaab5d1111b3b05c4ce04 |
SymKlCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.alpha = alpha
... | 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.... | posuer/mt-dnn | SymKlCriterion | false | 12,908 | [
"MIT"
] | 0 | 5106083238654777838aaab5d1111b3b05c4ce04 | https://github.com/posuer/mt-dnn/tree/5106083238654777838aaab5d1111b3b05c4ce04 |
Scale2D | import torch
import torch.nn as nn
class Scale2D(nn.Module):
def __init__(self, n):
super().__init__()
self.register_parameter('alpha', torch.nn.Parameter(torch.ones([1,
n, 1, 1])))
self.register_parameter('beta', torch.nn.Parameter(torch.ones([1, n,
1, 1])))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | rafapi/yolo3_pytorch | Scale2D | false | 12,909 | [
"MIT"
] | 0 | a936eb4fa5d4ddac97af8c835b6171d3b9c09b6a | https://github.com/rafapi/yolo3_pytorch/tree/a936eb4fa5d4ddac97af8c835b6171d3b9c09b6a |
MultiNonLinearClassifier | import torch
from torch import nn
class MultiNonLinearClassifier(nn.Module):
def __init__(self, hidden_size, num_label):
super(MultiNonLinearClassifier, self).__init__()
self.num_label = num_label
self.classifier1 = nn.Linear(hidden_size, int(hidden_size / 2))
self.classifier2 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | qhjqhj00/NLI | MultiNonLinearClassifier | false | 12,910 | [
"Apache-2.0"
] | 0 | a5baaf1903e6a22a7bdd1d68a4aaf1680c57d265 | https://github.com/qhjqhj00/NLI/tree/a5baaf1903e6a22a7bdd1d68a4aaf1680c57d265 |
LocalResponseNormLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class LocalResponseNormLayer(nn.Module):
def forward(self, tensor, size=5, alpha=9.999999747378752e-05, beta=
0.75, k=1.0):
return F.local_response_norm(tensor, size=size, alpha=alpha, beta=
beta, k=k)
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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | nicofirst1/lucent | LocalResponseNormLayer | false | 12,911 | [
"Apache-2.0"
] | 0 | 1e249918e91cc04117368826cd7a192bd8cf2046 | https://github.com/nicofirst1/lucent/tree/1e249918e91cc04117368826cd7a192bd8cf2046 |
Conv2 | import torch
from torch import nn
from torch.nn import Conv2d
from torch.nn import Conv3d
class Conv2(nn.Module):
def __init__(self):
super(Conv2, self).__init__()
self.conv1 = Conv2d(in_channels=10, out_channels=2, kernel_size=5,
padding=2, bias=True)
self.conv2 = Conv3d(in_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.nn import Conv2d
from torch.nn import Conv3d
ass... | pvgladkov/abstraction-and-reasoning-challenge | Conv2 | false | 12,912 | [
"MIT"
] | 0 | 0dfe16b5044f5aba0d5f53397dc615400e61aa69 | https://github.com/pvgladkov/abstraction-and-reasoning-challenge/tree/0dfe16b5044f5aba0d5f53397dc615400e61aa69 |
SoftMaxLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftMaxLayer(nn.Module):
def forward(self, tensor, dim=1):
return F.softmax(tensor, dim=dim)
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 math as tl_math
import torch.nn as nn
... | nicofirst1/lucent | SoftMaxLayer | false | 12,913 | [
"Apache-2.0"
] | 0 | 1e249918e91cc04117368826cd7a192bd8cf2046 | https://github.com/nicofirst1/lucent/tree/1e249918e91cc04117368826cd7a192bd8cf2046 |
Actor | import torch
import torch.nn.functional as F
import torch.nn as nn
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=200,
fc2_units=150):
"""Initialize parameters and build model.
Params
======
state_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rafapi/continuous-control-ddpg | Actor | false | 12,914 | [
"MIT"
] | 0 | ef3a1f4dbc4e7659dc6b720a95f7af463b600f2c | https://github.com/rafapi/continuous-control-ddpg/tree/ef3a1f4dbc4e7659dc6b720a95f7af463b600f2c |
MaxPool2dLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPool2dLayer(nn.Module):
def forward(self, tensor, kernel_size=(3, 3), stride=(1, 1), padding=0,
ceil_mode=False):
return F.max_pool2d(tensor, kernel_size, stride=stride, padding=
padding, ceil_mode=ceil_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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | nicofirst1/lucent | MaxPool2dLayer | false | 12,915 | [
"Apache-2.0"
] | 0 | 1e249918e91cc04117368826cd7a192bd8cf2046 | https://github.com/nicofirst1/lucent/tree/1e249918e91cc04117368826cd7a192bd8cf2046 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, image_features_dim, decoder_hidden_state_dim,
attention_dim):
super(Attention, self).__init__()
self.attention_dim = attention_dim
self.U = nn.Linear(in_features=image... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ppujol76/-Pere_Transformers | Attention | false | 12,916 | [
"MIT"
] | 0 | e267bcc6559c998accaed647cacbff253031f8b0 | https://github.com/ppujol76/-Pere_Transformers/tree/e267bcc6559c998accaed647cacbff253031f8b0 |
h_sigmoid | import torch
import torch.nn as nn
class h_sigmoid(nn.Module):
def __init__(self, inplace=True, h_max=1):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
self.h_max = h_max
def forward(self, x):
return self.relu(x + 3) * self.h_max / 6
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... | rahulmangalampalli/esvit | h_sigmoid | false | 12,917 | [
"MIT"
] | 0 | 5caf6e36b088ae2e7aaa4100b307eec991078e3e | https://github.com/rahulmangalampalli/esvit/tree/5caf6e36b088ae2e7aaa4100b307eec991078e3e |
PatchMerging | import torch
import torch.nn as nn
from math import sqrt
import torch.nn.functional as F
import torch.functional as F
class PatchMerging(nn.Module):
"""Patch Merging Layer.
Args:
input_resolution (tuple[int]): Resolution of input feature.
dim (int): Number of input channels.
norm_laye... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | rahulmangalampalli/esvit | PatchMerging | false | 12,918 | [
"MIT"
] | 0 | 5caf6e36b088ae2e7aaa4100b307eec991078e3e | https://github.com/rahulmangalampalli/esvit/tree/5caf6e36b088ae2e7aaa4100b307eec991078e3e |
ScaledDotProductAttention | import torch
import numpy as np
from torch import nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionality of queries and keys... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | quanha72/mesh-memory-transformer | ScaledDotProductAttention | false | 12,919 | [
"BSD-3-Clause"
] | 0 | 0eeae459efdb8e85926ce8595536409fdbfc4f99 | https://github.com/quanha72/mesh-memory-transformer/tree/0eeae459efdb8e85926ce8595536409fdbfc4f99 |
TransformerGPTEncoderLayer | import math
import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
def generate_relative_positions_matrix(length, max_relative_positions,
cache=False):
"""Generate the... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | pltrdy/encoder-agnostic-adaptation | TransformerGPTEncoderLayer | false | 12,920 | [
"MIT"
] | 0 | e45d157f84804696e109e5952957570fd781e9b7 | https://github.com/pltrdy/encoder-agnostic-adaptation/tree/e45d157f84804696e109e5952957570fd781e9b7 |
CompositeActivation | import torch
class CompositeActivation(torch.nn.Module):
def forward(self, x):
x = torch.atan(x)
return torch.cat([x / 0.67, x * x / 0.6], 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._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | nicofirst1/lucent | CompositeActivation | false | 12,921 | [
"Apache-2.0"
] | 0 | 1e249918e91cc04117368826cd7a192bd8cf2046 | https://github.com/nicofirst1/lucent/tree/1e249918e91cc04117368826cd7a192bd8cf2046 |
SELayer_ECA | import torch
import torch.nn as nn
class SELayer_ECA(nn.Module):
"""Constructs a ECA module.
Args:
channel: Number of channels of the input feature map
k_size: Adaptive selection of kernel size
"""
def __init__(self, channel, k_size=3):
super(SELayer_ECA, 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... | rahulmangalampalli/esvit | SELayer_ECA | false | 12,922 | [
"MIT"
] | 0 | 5caf6e36b088ae2e7aaa4100b307eec991078e3e | https://github.com/rahulmangalampalli/esvit/tree/5caf6e36b088ae2e7aaa4100b307eec991078e3e |
ScaledDotProductAttentionMemory | import torch
import numpy as np
from torch import nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, d_model, d_k, d_v, h, m):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionalit... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | quanha72/mesh-memory-transformer | ScaledDotProductAttentionMemory | false | 12,923 | [
"BSD-3-Clause"
] | 0 | 0eeae459efdb8e85926ce8595536409fdbfc4f99 | https://github.com/quanha72/mesh-memory-transformer/tree/0eeae459efdb8e85926ce8595536409fdbfc4f99 |
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... | rbli-john/yolact_edge | ShuffleCat | false | 12,924 | [
"MIT"
] | 0 | 48305b45baf2154c336884aeb8a98cfc2c0a8cee | https://github.com/rbli-john/yolact_edge/tree/48305b45baf2154c336884aeb8a98cfc2c0a8cee |
ActNorm | import torch
import torch.nn as nn
class ActNorm(nn.Module):
"""
ActNorm layer.
[Kingma and Dhariwal, 2018.]
"""
def __init__(self, dim):
super().__init__()
self.dim = dim
self.mu = nn.Parameter(torch.zeros(dim, dtype=torch.float))
self.log_sigma = 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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | ralphc1212/normalizing-flows | ActNorm | false | 12,925 | [
"MIT"
] | 0 | 40353bca33d80400201b0bf29d72ca68de2757dd | https://github.com/ralphc1212/normalizing-flows/tree/40353bca33d80400201b0bf29d72ca68de2757dd |
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... | rbli-john/yolact_edge | ShuffleCatAlt | false | 12,926 | [
"MIT"
] | 0 | 48305b45baf2154c336884aeb8a98cfc2c0a8cee | https://github.com/rbli-john/yolact_edge/tree/48305b45baf2154c336884aeb8a98cfc2c0a8cee |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | rbak/deep-rl-udacity-project-3 | Critic | false | 12,927 | [
"MIT"
] | 0 | 4bf2aec6b0ef27636ebd11dfd4b442554208cffb | https://github.com/rbak/deep-rl-udacity-project-3/tree/4bf2aec6b0ef27636ebd11dfd4b442554208cffb |
NextMinMinusLambdaBlock | import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
class LayerNorm(nn.Module):
""" LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | pgruening/ConvNeXt | NextMinMinusLambdaBlock | false | 12,928 | [
"MIT"
] | 0 | e9a1beaf312f3a724f0c21d098efbe7db872b049 | https://github.com/pgruening/ConvNeXt/tree/e9a1beaf312f3a724f0c21d098efbe7db872b049 |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
from torch import nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimens... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | quanha72/mesh-memory-transformer | MultiHeadAttention | false | 12,929 | [
"BSD-3-Clause"
] | 0 | 0eeae459efdb8e85926ce8595536409fdbfc4f99 | https://github.com/quanha72/mesh-memory-transformer/tree/0eeae459efdb8e85926ce8595536409fdbfc4f99 |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, 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.triton_helpers import libdevice
import numpy as np
... | rbak/deep-rl-udacity-project-3 | Actor | false | 12,930 | [
"MIT"
] | 0 | 4bf2aec6b0ef27636ebd11dfd4b442554208cffb | https://github.com/rbak/deep-rl-udacity-project-3/tree/4bf2aec6b0ef27636ebd11dfd4b442554208cffb |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.data
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rahul-art/DeepSpeedExamples | BertAttention | false | 12,931 | [
"MIT"
] | 0 | f6b901516a336f91ee2a2dd735b9d20ab2c87d85 | https://github.com/rahul-art/DeepSpeedExamples/tree/f6b901516a336f91ee2a2dd735b9d20ab2c87d85 |
distLinear | import torch
import torch.nn as nn
from torch.nn.utils.weight_norm import WeightNorm
class distLinear(nn.Module):
def __init__(self, indim, outdim):
super(distLinear, self).__init__()
self.L = nn.Linear(indim, outdim, bias=False)
self.class_wise_learnable_norm = True
if self.class... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | raphael-baena/clean-train | distLinear | false | 12,932 | [
"MIT"
] | 0 | f65fcecc11203b12f27d14964944db6941b513cc | https://github.com/raphael-baena/clean-train/tree/f65fcecc11203b12f27d14964944db6941b513cc |
ncm_output | import torch
import torch.nn as nn
class ncm_output(nn.Module):
def __init__(self, indim, outdim):
super(ncm_output, self).__init__()
self.linear = nn.Linear(indim, outdim)
def forward(self, x):
return -1 * torch.norm(x.reshape(x.shape[0], 1, -1) - self.linear.
weight.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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | raphael-baena/clean-train | ncm_output | false | 12,933 | [
"MIT"
] | 0 | f65fcecc11203b12f27d14964944db6941b513cc | https://github.com/raphael-baena/clean-train/tree/f65fcecc11203b12f27d14964944db6941b513cc |
Resizer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.functional as F
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class DWConv(nn.Module):
"""
Depthwise separable 1d convolution
"""
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 math
import torch.nn as nn
import torch.nn.functional as F
import torch.f... | remzawi/squad | Resizer | false | 12,934 | [
"MIT"
] | 0 | 234eaea858969f4f1fe58504b8fae19e42306296 | https://github.com/remzawi/squad/tree/234eaea858969f4f1fe58504b8fae19e42306296 |
DeconvBlock | import torch
import torch.nn as nn
class DeconvBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(DeconvBlock, self).__init__()
self.conv = nn.ConvTranspose2d(in_channels, out_channels,
kernel_size=3, stride=2, padding=1, output_padding=0)
self.pad = nn.Ref... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | richardlyf/FeatDepth | DeconvBlock | false | 12,935 | [
"MIT"
] | 0 | 6739ee0ded5a91a97d6cea1aa259c64f8b520fcd | https://github.com/richardlyf/FeatDepth/tree/6739ee0ded5a91a97d6cea1aa259c64f8b520fcd |
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... | rbli-john/yolact_edge | ShuffleCatChunk | false | 12,936 | [
"MIT"
] | 0 | 48305b45baf2154c336884aeb8a98cfc2c0a8cee | https://github.com/rbli-john/yolact_edge/tree/48305b45baf2154c336884aeb8a98cfc2c0a8cee |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, loss_weight=1.0):
super(DiceLoss, self).__init__()
self.loss_weight = loss_weight
def forward(self, input, target, mask, reduce=True):
batch_size = input.size(0)
input = torch.sigmoid(input)
... | 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... | rigvedsah000/PAN- | DiceLoss | false | 12,937 | [
"Apache-2.0"
] | 0 | 16f8482886c5eccecf29fe072025ba54c64e4b9d | https://github.com/rigvedsah000/PAN-/tree/16f8482886c5eccecf29fe072025ba54c64e4b9d |
LayerNorm | import torch
from torch import 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):
var = torch.var(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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | psemchyshyn/diffusion_reconstruction | LayerNorm | false | 12,938 | [
"MIT"
] | 0 | c7ccc8c9f47c858606a46c2c29fcb64016565b4e | https://github.com/psemchyshyn/diffusion_reconstruction/tree/c7ccc8c9f47c858606a46c2c29fcb64016565b4e |
MLP | import torch
from abc import *
import torch.nn.functional as F
from torch.optim import *
def orthogonal_init(layer, nonlinearity='relu'):
if isinstance(nonlinearity, str):
if nonlinearity == 'policy':
gain = 0.01
else:
gain = torch.nn.init.calculate_gain(nonlinearity)
e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 abc import *
from torch.... | ramanuzan/JORLDY | MLP | false | 12,939 | [
"Apache-2.0"
] | 0 | be371ad0607e5dba5d5082101c38c6a9f2c96767 | https://github.com/ramanuzan/JORLDY/tree/be371ad0607e5dba5d5082101c38c6a9f2c96767 |
MLP | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn import Tanh
from torch.nn.init import kaiming_uniform_
from torch.nn.init import xavier_uniform_
class MLP(Module):
"""
Summary: 1 hidden layer NN
@param n_inputs (int): number of inputs in the current environment
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn impor... | roee89871324/Evolutionary_Selective_Imitation | MLP | false | 12,940 | [
"MIT"
] | 0 | 84b31fce6dcd6d79686244b9b53cde584a713723 | https://github.com/roee89871324/Evolutionary_Selective_Imitation/tree/84b31fce6dcd6d79686244b9b53cde584a713723 |
eca_layer | import torch
import torch.nn as nn
import torch.optim
class eca_layer(nn.Module):
"""Constructs a ECA module.
Args:
channel: Number of channels of the input feature map
k_size: Adaptive selection of kernel size
"""
def __init__(self, channel, k_size=3):
super(eca_layer, self).... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.optim
assert_size_stride = torch._C._dynamo.g... | purbayankar/PyTorch-Zero-Shot-Super-Resolution | eca_layer | false | 12,941 | [
"MIT"
] | 0 | 434fe5e84e166eef1f8c03880fc83c7e8749c49c | https://github.com/purbayankar/PyTorch-Zero-Shot-Super-Resolution/tree/434fe5e84e166eef1f8c03880fc83c7e8749c49c |
GridPredictionModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class GridPredictionModel(nn.Module):
def __init__(self):
super(GridPredictionModel, self).__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=100, kernel_size
=3, padding=2)
self.conv2 = nn.Conv2d(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
import torch.nn as nn
assert_... | rickmarson/game_of_life_nn | GridPredictionModel | false | 12,942 | [
"MIT"
] | 0 | 728bb009b9d54268e96f33bb752a3e5ba1ae15d1 | https://github.com/rickmarson/game_of_life_nn/tree/728bb009b9d54268e96f33bb752a3e5ba1ae15d1 |
Conv5x5 | import torch
import torch.nn as nn
class Conv5x5(nn.Module):
def __init__(self, in_channels, out_channels, use_refl=True):
super(Conv5x5, self).__init__()
if use_refl:
self.pad = nn.ReflectionPad2d(2)
else:
self.pad = nn.ZeroPad2d(2)
self.conv = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | richardlyf/FeatDepth | Conv5x5 | false | 12,943 | [
"MIT"
] | 0 | 6739ee0ded5a91a97d6cea1aa259c64f8b520fcd | https://github.com/richardlyf/FeatDepth/tree/6739ee0ded5a91a97d6cea1aa259c64f8b520fcd |
pHAbsModel | import torch
import numpy as np
from torch import nn
class pHAbsLayer(nn.Module):
"""Custom pHAbs Layer: Amax/(1+e^(pKa-pH)/phi)"""
def __init__(self):
super().__init__()
weights = np.random.normal([1, 7.6, 0.5], [0.2, 0.5, 0.1])
weights = torch.from_numpy(weights)
self.weight... | 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 numpy as np
from torch import nn
assert_size_stride = torch._C._dy... | rokapre/Nonlinear_Regression | pHAbsModel | false | 12,944 | [
"MIT"
] | 0 | d705f6a010fc0bf000531c967ffcf8ed79a5f92e | https://github.com/rokapre/Nonlinear_Regression/tree/d705f6a010fc0bf000531c967ffcf8ed79a5f92e |
LR_PAD | import torch
import torch.nn as nn
def lr_pad(x, padding=1):
return torch.cat([x[..., -padding:], x, x[..., :padding]], dim=3)
class LR_PAD(nn.Module):
def __init__(self, padding=1):
super(LR_PAD, self).__init__()
self.padding = padding
def forward(self, x):
return lr_pad(x, se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | roxyrypler/HorizonNet | LR_PAD | false | 12,945 | [
"MIT"
] | 0 | 303322deb652d0985936f084ba9a08d232a60427 | https://github.com/roxyrypler/HorizonNet/tree/303322deb652d0985936f084ba9a08d232a60427 |
BiInteractionPooling | import torch
import torch.nn as nn
from sklearn.metrics import *
class BiInteractionPooling(nn.Module):
"""Bi-Interaction Layer used in Neural FM,compress the
pairwise element-wise product of features into one single vector.
Input shape
- A 3D tensor with shape:``(batch_size,field_size,embeddi... | 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 sklearn.metrics import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | liyunrui/DeepCTR-Torch | BiInteractionPooling | false | 12,946 | [
"Apache-2.0"
] | 0 | 392fd6d39d9ca0ac854022136cdb4d5c68e3a592 | https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592 |
Decoder | import math
import torch
from torch import nn
def overlap_and_add(signal, frame_step):
outer_dimensions = signal.size()[:-2]
frames, frame_length = signal.size()[-2:]
subframe_length = math.gcd(frame_length, frame_step)
subframe_step = frame_step // subframe_length
subframes_per_frame = frame_leng... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | roger-tseng/demucs | Decoder | false | 12,947 | [
"MIT"
] | 0 | 4a54a3c523a86345df294798994b60c8194e0a43 | https://github.com/roger-tseng/demucs/tree/4a54a3c523a86345df294798994b60c8194e0a43 |
DiceCoefMultilabelLoss | import torch
from torch import nn
class DiceCoefMultilabelLoss(nn.Module):
def __init__(self, cuda=True):
super().__init__()
self.one = torch.tensor(1.0, dtype=torch.float32)
self.activation = torch.nn.Softmax2d()
def dice_loss(self, predict, target):
predict = predict.contig... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | rominashirazi/SpineSegmentation | DiceCoefMultilabelLoss | false | 12,948 | [
"MIT"
] | 0 | fb08122ac6d9a598b60aecb4f1a1a2a31fba96ab | https://github.com/rominashirazi/SpineSegmentation/tree/fb08122ac6d9a598b60aecb4f1a1a2a31fba96ab |
PositionWiseFFN | import torch
from torch import nn
from torch.nn.functional import relu
class PositionWiseFFN(nn.Module):
def __init__(self, model_dim, dropout=0.0):
super().__init__()
dff = model_dim * 4
self.l = nn.Linear(model_dim, dff)
self.o = nn.Linear(dff, model_dim)
self.dropout = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ruifan831/NLP-Tutorials | PositionWiseFFN | false | 12,949 | [
"MIT"
] | 0 | d1fe27b2891156be4d8054022b762f758e9113a9 | https://github.com/ruifan831/NLP-Tutorials/tree/d1fe27b2891156be4d8054022b762f758e9113a9 |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rondagdag/onnx-pected | CNN | false | 12,950 | [
"MIT"
] | 0 | 63eb1c7edf2ddb3127073dc6c09b8edba32a9530 | https://github.com/rondagdag/onnx-pected/tree/63eb1c7edf2ddb3127073dc6c09b8edba32a9530 |
InnerProductLayer | import torch
import torch.nn as nn
from sklearn.metrics import *
class InnerProductLayer(nn.Module):
"""InnerProduct Layer used in PNN that compute the element-wise
product or inner product between feature vectors.
Input shape
- a list of 3D tensor with shape: ``(batch_size,1,embedding_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
import torch.nn as nn
from sklearn.metrics import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | liyunrui/DeepCTR-Torch | InnerProductLayer | false | 12,951 | [
"Apache-2.0"
] | 0 | 392fd6d39d9ca0ac854022136cdb4d5c68e3a592 | https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592 |
MultiHeadAttentionLayer | import math
import torch
import torch.nn as nn
class MultiHeadAttentionLayer(nn.Module):
def __init__(self, hidden_dim, n_heads, dropout=0.1):
super().__init__()
assert hidden_dim % n_heads == 0
self.hidden_dim = hidden_dim
self.n_heads = n_heads
self.head_dim = hidden_dim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rigvedsah000/PAN- | MultiHeadAttentionLayer | false | 12,952 | [
"Apache-2.0"
] | 0 | 16f8482886c5eccecf29fe072025ba54c64e4b9d | https://github.com/rigvedsah000/PAN-/tree/16f8482886c5eccecf29fe072025ba54c64e4b9d |
SharedLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
class SharedLinear(nn.Linear):
def __init__(self, in_features, out_features, share_weight=False):
super(SharedLinear, self).__init__(in_features, out_features, bias=True
)
if share_weight:
self.weight = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | sdw95927/deconvGAN | SharedLinear | false | 12,954 | [
"MIT"
] | 0 | 49dbbfe4827ed8366242870877165482d4ec1e75 | https://github.com/sdw95927/deconvGAN/tree/49dbbfe4827ed8366242870877165482d4ec1e75 |
DiceLoss | import torch
class DiceLoss(torch.nn.Module):
def __init__(self, weight=None, size_average=True, per_image=False, eps
=1e-06):
super().__init__()
self.size_average = size_average
self.register_buffer('weight', weight)
self.per_image = per_image
self.eps = eps
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | sebasmos/Spacenet7TRDP | DiceLoss | false | 12,955 | [
"Apache-2.0"
] | 0 | 03b5819321108017f8f8c2d359264c8e18d9e38a | https://github.com/sebasmos/Spacenet7TRDP/tree/03b5819321108017f8f8c2d359264c8e18d9e38a |
IoU | import torch
import torch.nn as nn
class IoU(nn.Module):
def __init__(self, mode='iou', axis=1, eps=0.0):
""" Return a matrix of [batch * num_classes].
Note: In order to separate from iou=0, function WILL return NaN if both
y_true and y_pred are 0. Need further treatment to remo... | 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... | sdw95927/deconvGAN | IoU | false | 12,956 | [
"MIT"
] | 0 | 49dbbfe4827ed8366242870877165482d4ec1e75 | https://github.com/sdw95927/deconvGAN/tree/49dbbfe4827ed8366242870877165482d4ec1e75 |
DiceLoss_TRDP | import torch
from torch.nn.modules.loss import _Loss
class DiceLoss_TRDP(_Loss):
def __init__(self, per_image=False):
super(DiceLoss_TRDP, self).__init__()
self.per_image = per_image
def forward(self, y_pred, y_true):
"""
:param y_pred: NxCxHxW
:param y_true: NxCxHxW
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn.modules.loss import _Loss
assert_size_stride = torch._C._dynamo.guards.asse... | sebasmos/Spacenet7TRDP | DiceLoss_TRDP | false | 12,957 | [
"Apache-2.0"
] | 0 | 03b5819321108017f8f8c2d359264c8e18d9e38a | https://github.com/sebasmos/Spacenet7TRDP/tree/03b5819321108017f8f8c2d359264c8e18d9e38a |
TemporalPooling | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class TemporalPooling(nn.Module):
def __init__(self, frames, kernel_size=3, stride=2, mode='avg'):
"""
Parameters
----------
frames (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
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
assert_size_st... | peter-yys-yoon/traditional-dance-recognition | TemporalPooling | false | 12,958 | [
"Apache-2.0"
] | 0 | be4939d53b838624a04dba0826532c65421d1325 | https://github.com/peter-yys-yoon/traditional-dance-recognition/tree/be4939d53b838624a04dba0826532c65421d1325 |
SoftDiceLoss | import torch
import numpy as np
import torch.nn as nn
class IoU(nn.Module):
def __init__(self, mode='iou', axis=1, eps=0.0):
""" Return a matrix of [batch * num_classes].
Note: In order to separate from iou=0, function WILL return NaN if both
y_true and y_pred are 0. Need furthe... | 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 numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | sdw95927/deconvGAN | SoftDiceLoss | false | 12,959 | [
"MIT"
] | 0 | 49dbbfe4827ed8366242870877165482d4ec1e75 | https://github.com/sdw95927/deconvGAN/tree/49dbbfe4827ed8366242870877165482d4ec1e75 |
TAM | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class SEModule(nn.Module):
def __init__(self, channels, dw_conv):
super().__init__()
ks = 1
pad = (ks - 1) // 2
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | peter-yys-yoon/traditional-dance-recognition | TAM | false | 12,960 | [
"Apache-2.0"
] | 0 | be4939d53b838624a04dba0826532c65421d1325 | https://github.com/peter-yys-yoon/traditional-dance-recognition/tree/be4939d53b838624a04dba0826532c65421d1325 |
_Enc | import torch
class _NestedEnc(torch.nn.Module):
def __init__(self, f):
super().__init__()
self.f = f
def forward(self, x):
return self.f(x)
class _Enc(torch.nn.Module):
def __init__(self):
super().__init__()
self.e1 = _NestedEnc(torch.nn.Linear(4, 2))
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | pminervini/higher | _Enc | false | 12,961 | [
"Apache-2.0"
] | 0 | c4a7697a013f7b909b3c3453fd56401d6bb91fab | https://github.com/pminervini/higher/tree/c4a7697a013f7b909b3c3453fd56401d6bb91fab |
MultiHeadAttention | import math
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
def __init__(self, heads, d_model):
super(MultiHeadAttention, self).__init__()
assert d_model % heads == 0
self.d_k = d_model // heads
self.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 import triton_helpers
from torch._inductor.runtime.... | sd2001/seqModeling | MultiHeadAttention | false | 12,962 | [
"MIT"
] | 0 | 393f680de711ea8477e5450633b492298d253368 | https://github.com/sd2001/seqModeling/tree/393f680de711ea8477e5450633b492298d253368 |
TransformerDecoderLayer | from torch.nn import Module
import torch
from torch import Tensor
from typing import Optional
import torch.nn.functional as F
from torch.nn.modules import Module
from torch.nn.modules.activation import MultiheadAttention
from torch.nn.modules import Dropout
from torch.nn.modules import Linear
from torch.nn.modules impo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ruiguo-bio/smer | TransformerDecoderLayer | false | 12,963 | [
"MIT"
] | 0 | e50c814629d02d9e0892b705d5b6273a3537cb11 | https://github.com/ruiguo-bio/smer/tree/e50c814629d02d9e0892b705d5b6273a3537cb11 |
LinearScalerModel | import torch
import torch.utils.data
import torch.nn as nn
class LinearScalerModel(nn.Module):
def __init__(self, load_from: 'dict'=None):
super().__init__()
initial = torch.zeros(4)
initial[2] = 1
initial[3] = 10
self.params = nn.Parameter(initial, requires_grad=False)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | sergiolib/pytorch-CycleGAN-and-pix2pix | LinearScalerModel | false | 12,964 | [
"BSD-3-Clause"
] | 0 | cd3058a6a0522a0ed9178682b06cda538947e335 | https://github.com/sergiolib/pytorch-CycleGAN-and-pix2pix/tree/cd3058a6a0522a0ed9178682b06cda538947e335 |
StackTime | import torch
import torch.nn as nn
import torch.utils.data
import torch.jit
import torch.optim
import torch.utils.collect_env
import torch.nn.parallel
import torch.utils.data.distributed
class StackTime(nn.Module):
def __init__(self, factor):
super().__init__()
self.factor = int(factor)
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
import torch.nn as nn
import torch.utils.data
import torch.jit
import torch.optim
import torch.utils.collect_env
import torch.nn.parallel
im... | sharathts/training | StackTime | false | 12,965 | [
"Apache-2.0"
] | 0 | f294d135a6b1ac12a19ea68c1f0e42e8acc39401 | https://github.com/sharathts/training/tree/f294d135a6b1ac12a19ea68c1f0e42e8acc39401 |
Block | import torch
from torch import nn
from torch.nn import functional as F
def get_conv(in_dim, out_dim, kernel_size, stride, padding, zero_bias=True,
zero_weights=False, groups=1, scaled=False):
c = nn.Conv2d(in_dim, out_dim, kernel_size, stride, padding, groups=groups)
if zero_bias:
c.bias.data *= 0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | seunghyukcho/vdvae | Block | false | 12,966 | [
"MIT"
] | 0 | 3a552d80351d670fdbde8302c556a6e668d33762 | https://github.com/seunghyukcho/vdvae/tree/3a552d80351d670fdbde8302c556a6e668d33762 |
VirtualBatchNorm | import torch
import torch.nn as nn
class VirtualBatchNorm(nn.Module):
"""Virtual Batch Normalization Module as proposed in the paper
`"Improved Techniques for Training GANs by Salimans et. al." <https://arxiv.org/abs/1805.08318>`_
Performs Normalizes the features of a batch based on the statistics collec... | 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_... | shi-weili/torchgan | VirtualBatchNorm | false | 12,967 | [
"MIT"
] | 0 | 28ffd4026b8c0db2217b667d30a222d6758bfc41 | https://github.com/shi-weili/torchgan/tree/28ffd4026b8c0db2217b667d30a222d6758bfc41 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.