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 |
|---|---|---|---|---|---|---|---|---|---|---|
Network | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.init as I
class Network(nn.Module):
"""
Q-network
"""
def __init__(self, state_size, action_size, seed, fc1_units=64,
fc2_units=32):
"""
Build model and Intialize it
Params
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | tae-yeop/Udacity_DRLND_navigation | Network | false | 10,839 | [
"MIT"
] | 0 | dd4a4609c5fe3e00cb4deea3ebd9922dd0772447 | https://github.com/tae-yeop/Udacity_DRLND_navigation/tree/dd4a4609c5fe3e00cb4deea3ebd9922dd0772447 |
AffineGridGen | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.nn
from torch.nn.modules.module import Module
class AffineGridGen(Module):
def __init__(self, out_h=240, out_w=240, out_ch=3, use_cuda=True):
super(AffineGridGen, self).__init__()
self.out_h = out_h
self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn
from torch.nn.modules.module import Module
assert_size_stride = torch._C._dynamo.guards.assert_s... | sebastian-echeverria/ncnet | AffineGridGen | false | 10,840 | [
"MIT"
] | 0 | c7249fe8f908813bab6443ebfa4590bd362a0dc2 | https://github.com/sebastian-echeverria/ncnet/tree/c7249fe8f908813bab6443ebfa4590bd362a0dc2 |
BahdanauAttn | import torch
import torch.nn as nn
class BahdanauAttn(nn.Module):
"""Bahdabau attention mechanism"""
def __init__(self, size):
super(BahdanauAttn, self).__init__()
self.query_layer = nn.Linear(size, size, bias=False)
self.tanh = nn.Tanh()
self.v = nn.Linear(size, 1, bias=False... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | seo3650/Tacotron-pytorch | BahdanauAttn | false | 10,841 | [
"MIT"
] | 0 | 223e4f39a3624c409484a1ad55edab1563cf8c87 | https://github.com/seo3650/Tacotron-pytorch/tree/223e4f39a3624c409484a1ad55edab1563cf8c87 |
StackTime | import torch
import torch.onnx
class StackTime(torch.nn.Module):
__constants__ = ['factor']
def __init__(self, factor):
super().__init__()
self.factor = int(factor)
def forward(self, x, x_lens):
seq = [x]
for i in range(1, self.factor):
tmp = torch.zeros_like(... | 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.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | swiftdiaries/inference | StackTime | false | 10,842 | [
"Apache-2.0"
] | 0 | dbb39947d4515449b1a3393cde39ca0dba935b1d | https://github.com/swiftdiaries/inference/tree/dbb39947d4515449b1a3393cde39ca0dba935b1d |
ShiftedConv | import math
import torch
import torch.nn as nn
from numpy import prod
def getLayerNormalizationFactor(x):
"""
Get He's constant for the given layer
https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf
"""
size = x.weight.size()
fan_in = 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 math
import torch.nn as nn
from numpy import prod
assert_size_stride = to... | raphaelreme/CPC_audio | ShiftedConv | false | 10,843 | [
"MIT"
] | 0 | a2b045d5f03f4a73beaab9b481244e454edacbaa | https://github.com/raphaelreme/CPC_audio/tree/a2b045d5f03f4a73beaab9b481244e454edacbaa |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, smooth: 'float'=1.0, apply_sigmoid: 'bool'=False):
super().__init__()
self.smooth = smooth
self.apply_sigmoid = apply_sigmoid
def forward(self, y_pred: 'torch.Tensor', y_true: '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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | tfmoraes/deep_heart_torch | DiceLoss | false | 10,844 | [
"MIT"
] | 0 | 4168ce01d600e69baf82c752a3e57af86861b6ea | https://github.com/tfmoraes/deep_heart_torch/tree/4168ce01d600e69baf82c752a3e57af86861b6ea |
NAC | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
class NAC(Module):
"""Neural Accumulator: :math:`y = Wx` where :math:`W = \\tanh(\\hat{W}) * \\sigma(\\hat{M})`
Args:
in_features: size of each input sample
out_featur... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | tanbur/pytorch-nalu | NAC | false | 10,845 | [
"MIT"
] | 0 | 91cb036230144b166137a8f3533850f2d4123d4f | https://github.com/tanbur/pytorch-nalu/tree/91cb036230144b166137a8f3533850f2d4123d4f |
UNETAdd | import torch
from torch import nn
class UNETAdd(nn.Module):
"""UNET Without concatenation during decoding"""
def __init__(self):
super(UNETAdd, self).__init__()
self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=16,
kernel_size=3, stride=1, padding=1)
self.conv1_2 = nn.C... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | quenting44/semantic_segmentation | UNETAdd | false | 10,846 | [
"MIT"
] | 0 | bd197ddda3c6891d69ff7e552a0c224c7ec1269a | https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a |
NALU | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
class NAC(Module):
"""Neural Accumulator: :math:`y = Wx` where :math:`W = \\tanh(\\hat{W}) * \\sigma(\\hat{M})`
Args:
in_features: size of each input sample
out_featur... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
fr... | tanbur/pytorch-nalu | NALU | false | 10,847 | [
"MIT"
] | 0 | 91cb036230144b166137a8f3533850f2d4123d4f | https://github.com/tanbur/pytorch-nalu/tree/91cb036230144b166137a8f3533850f2d4123d4f |
TripletLoss | import torch
from torch.nn.modules.distance import PairwiseDistance
class TripletLoss(torch.nn.Module):
def __init__(self, margin):
super(TripletLoss, self).__init__()
self.margin = margin
self.pdist = PairwiseDistance(2)
def forward(self, anchor, positive, negative):
pos_dis... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn.modules.distan... | tobysuwindra/Bird-Similarity | TripletLoss | false | 10,848 | [
"MIT"
] | 0 | 92f182fe89645f6ce6dd4e99f12c1185f52d5d9e | https://github.com/tobysuwindra/Bird-Similarity/tree/92f182fe89645f6ce6dd4e99f12c1185f52d5d9e |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, n_states, n_actions, n_hidden):
super(Net, self).__init__()
self.fc1 = nn.Linear(n_states, n_hidden)
self.fc2 = nn.Linear(n_hidden, n_hidden * 2)
self.fc3 = nn.Linear(n_hidd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | tom99763/implement-DQN-on-maze-game | Net | false | 10,849 | [
"BSD-2-Clause"
] | 0 | 24135a06e348b6f8b88a22c58b4a2c930bf7d7b6 | https://github.com/tom99763/implement-DQN-on-maze-game/tree/24135a06e348b6f8b88a22c58b4a2c930bf7d7b6 |
SimpleNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleNN(nn.Module):
def __init__(self, in_values, out_values):
super().__init__()
self.dense1 = nn.Linear(in_values, 12673)
self.drop1 = nn.Dropout()
self.dense2 = nn.Linear(12673, 4000)
self.drop2 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | sboomi/cp1 | SimpleNN | false | 10,850 | [
"MIT"
] | 0 | 7f7aa96e8ba9cfe00802028a61bfba5e90c999f6 | https://github.com/sboomi/cp1/tree/7f7aa96e8ba9cfe00802028a61bfba5e90c999f6 |
PositionwiseFeedForward | import math
import torch
from torch import nn
class GELU(nn.Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.pow(x, 3))))
class PositionwiseFeedForward(nn.Module):
def __init__(self, d_model, d_ff, dropout=0.1):
sup... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | tnat410/smiles-transformer | PositionwiseFeedForward | false | 10,851 | [
"MIT"
] | 0 | e64196945ed44cfce529484bcc8b6c77b662cdc8 | https://github.com/tnat410/smiles-transformer/tree/e64196945ed44cfce529484bcc8b6c77b662cdc8 |
FFN | import torch
import torch.nn as nn
import torch.utils.data
class Conv(nn.Module):
"""
Convolution Module
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='linear'):
"""
:param in_channels: dimension of input
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | stefantaubert/FastSpeech | FFN | false | 10,852 | [
"MIT"
] | 0 | 4ef8ce2ff8f6a69f9b52ef9bd5b37f8e2783c17e | https://github.com/stefantaubert/FastSpeech/tree/4ef8ce2ff8f6a69f9b52ef9bd5b37f8e2783c17e |
DiceBCELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
def __init__(self, smooth: 'float'=1.0, apply_sigmoid: 'bool'=False):
super().__init__()
self.smooth = smooth
self.apply_sigmoid = apply_sigmoid
def forward(self, y_pred: 'torch.Tensor', y_t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | tfmoraes/deep_heart_torch | DiceBCELoss | false | 10,853 | [
"MIT"
] | 0 | 4168ce01d600e69baf82c752a3e57af86861b6ea | https://github.com/tfmoraes/deep_heart_torch/tree/4168ce01d600e69baf82c752a3e57af86861b6ea |
WorldNet | import torch
class WorldNet(torch.nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super(WorldNet, self).__init__()
self.fc_in = torch.nn.Linear(input_dim, hidden_dim)
self.fc_1 = torch.nn.Linear(hidden_dim, hidden_dim)
self.fc_2 = torch.nn.Linear(hidden_dim, 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | tim-ts-chu/mbpo | WorldNet | false | 10,854 | [
"MIT"
] | 0 | 0d98e6e80499a82812d3361658e0707c0b489fc5 | https://github.com/tim-ts-chu/mbpo/tree/0d98e6e80499a82812d3361658e0707c0b489fc5 |
ConvLayer | import torch
import torch.nn as nn
class ConvLayer(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride, norm
='instance'):
super(ConvLayer, self).__init__()
padding_size = kernel_size // 2
self.reflection_pad = nn.ReflectionPad2d(padding_size)
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.triton_helpers import libdevice, math as tl_math
im... | suryawanshishantanu6/Multi-Style-Transfer | ConvLayer | false | 10,855 | [
"MIT"
] | 0 | c5c211847de676596580a8a9afda940ac76abbb1 | https://github.com/suryawanshishantanu6/Multi-Style-Transfer/tree/c5c211847de676596580a8a9afda940ac76abbb1 |
DotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class DotProductAttention(nn.Module):
"""Dot product attention.
Given a set of vector values, and a vector query, attention is a technique
to compute a weighted sum of the values, dependent on the query.
NOTE: Here we use the terminolo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | tompoek/Listen-Attend-Spell-v2 | DotProductAttention | false | 10,856 | [
"MIT"
] | 0 | aa19543c9d23256a007d6e7a98d9cbc571e89f7f | https://github.com/tompoek/Listen-Attend-Spell-v2/tree/aa19543c9d23256a007d6e7a98d9cbc571e89f7f |
DPRNNCell | import math
import torch
from torch import Tensor
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from typing import Optional
class RNNLinear(nn.Linear):
"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b`
This module is 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.triton_helpers import libdevice
import math
import ... | romovpa/opacus | DPRNNCell | false | 10,857 | [
"Apache-2.0"
] | 0 | 9cda8072e52049a06afba7ab524276bb6613a727 | https://github.com/romovpa/opacus/tree/9cda8072e52049a06afba7ab524276bb6613a727 |
MonotonicMin | import torch
import torch.nn as nn
class MonotonicMin(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return torch.min(x, dim=1)[0].unsqueeze(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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | tiwalayo/monotonic-mlp | MonotonicMin | false | 10,858 | [
"MIT"
] | 0 | 2f519797a753f7f297fac1365125c6da79f7b890 | https://github.com/tiwalayo/monotonic-mlp/tree/2f519797a753f7f297fac1365125c6da79f7b890 |
DPGRUCell | import math
import torch
from torch import Tensor
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from typing import Optional
class RNNLinear(nn.Linear):
"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b`
This module is 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.triton_helpers import libdevice
import math
import ... | romovpa/opacus | DPGRUCell | false | 10,859 | [
"Apache-2.0"
] | 0 | 9cda8072e52049a06afba7ab524276bb6613a727 | https://github.com/romovpa/opacus/tree/9cda8072e52049a06afba7ab524276bb6613a727 |
DPLSTMCell | import math
import torch
from torch import Tensor
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from typing import Optional
from typing import Tuple
class RNNLinear(nn.Linear):
"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | romovpa/opacus | DPLSTMCell | false | 10,860 | [
"Apache-2.0"
] | 0 | 9cda8072e52049a06afba7ab524276bb6613a727 | https://github.com/romovpa/opacus/tree/9cda8072e52049a06afba7ab524276bb6613a727 |
FeatureAssembler | import torch
from typing import Optional
import torch.nn as nn
class FeatureAssembler(nn.Module):
def __init__(self, T: 'int', embed_static: 'Optional[FeatureEmbedder]'=
None, embed_dynamic: 'Optional[FeatureEmbedder]'=None) ->None:
super().__init__()
self.T = T
self.embeddings = ... | 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 typing import Optional
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch... | ssmall41/pytorch-ts | FeatureAssembler | false | 10,861 | [
"Apache-2.0",
"MIT"
] | 0 | d0be718d443f8d676640b3aa75a7a154edad5dce | https://github.com/ssmall41/pytorch-ts/tree/d0be718d443f8d676640b3aa75a7a154edad5dce |
ResidualLayer | import torch
import torch.nn as nn
class ConvLayer(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride, norm
='instance'):
super(ConvLayer, self).__init__()
padding_size = kernel_size // 2
self.reflection_pad = nn.ReflectionPad2d(padding_size)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | suryawanshishantanu6/Multi-Style-Transfer | ResidualLayer | false | 10,862 | [
"MIT"
] | 0 | c5c211847de676596580a8a9afda940ac76abbb1 | https://github.com/suryawanshishantanu6/Multi-Style-Transfer/tree/c5c211847de676596580a8a9afda940ac76abbb1 |
MonotonicMax | import torch
import torch.nn as nn
class MonotonicMax(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return torch.cat(tuple(torch.max(i, dim=1)[0].unsqueeze(1) for i in
x), dim=1)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_i... | 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... | tiwalayo/monotonic-mlp | MonotonicMax | false | 10,863 | [
"MIT"
] | 0 | 2f519797a753f7f297fac1365125c6da79f7b890 | https://github.com/tiwalayo/monotonic-mlp/tree/2f519797a753f7f297fac1365125c6da79f7b890 |
Encoder | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
""" VAE encoder """
def __init__(self, img_channels, latent_size):
super(Encoder, self).__init__()
self.latent_size = latent_size
self.img_channels = img_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | susanwe/world-models | Encoder | false | 10,864 | [
"MIT"
] | 0 | 0f246a430683e6ab741726df0a97f35830044356 | https://github.com/susanwe/world-models/tree/0f246a430683e6ab741726df0a97f35830044356 |
LRN | import torch
import torch.nn as nn
class LRN(nn.Module):
def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True
):
super(LRN, self).__init__()
self.ACROSS_CHANNELS = ACROSS_CHANNELS
if ACROSS_CHANNELS:
self.average = nn.AvgPool3d(kernel_size=(local... | 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_... | txsing/dissect | LRN | false | 10,865 | [
"MIT"
] | 0 | 3564605f7be9672c2cfc2ee19ca42225398a6e01 | https://github.com/txsing/dissect/tree/3564605f7be9672c2cfc2ee19ca42225398a6e01 |
AdaptiveAvgMaxPool2d | import torch
import torch.nn as nn
class FastGlobalAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastGlobalAvgPool2d, self).__init__()
self.flatten = flatten
def forward(self, x):
if self.flatten:
in_size = x.size()
return x.view((in_size[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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | tenghehan/reid_without_id | AdaptiveAvgMaxPool2d | false | 10,866 | [
"MIT"
] | 0 | d1d0ff273b1ef19fc6da8cbbf210527779b37455 | https://github.com/tenghehan/reid_without_id/tree/d1d0ff273b1ef19fc6da8cbbf210527779b37455 |
Decoder | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Decoder(nn.Module):
""" VAE decoder """
def __init__(self, img_channels, latent_size):
super(Decoder, self).__init__()
self.latent_size = latent_size
self.img_channels = img_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | susanwe/world-models | Decoder | false | 10,867 | [
"MIT"
] | 0 | 0f246a430683e6ab741726df0a97f35830044356 | https://github.com/susanwe/world-models/tree/0f246a430683e6ab741726df0a97f35830044356 |
GeneralizedMeanPooling | import torch
import torch.nn as nn
class GeneralizedMeanPooling(nn.Module):
"""Applies a 2D power-average adaptive pooling over an input signal composed of several input planes.
The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)`
- At p = infinity, one gets Max Pooling
- At p = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | tenghehan/reid_without_id | GeneralizedMeanPooling | false | 10,868 | [
"MIT"
] | 0 | d1d0ff273b1ef19fc6da8cbbf210527779b37455 | https://github.com/tenghehan/reid_without_id/tree/d1d0ff273b1ef19fc6da8cbbf210527779b37455 |
LearnedPositionalEmbedding | import torch
import torch.nn as nn
import torch.nn.functional as F
class LearnedPositionalEmbedding(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size.
Padding ids are ignored by either offsetting based on padding_idx
or by setting padding_idx to None and ensuring t... | 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... | sohrabi1/esm | LearnedPositionalEmbedding | false | 10,869 | [
"MIT"
] | 0 | e1f60a66b5c351d9d0011926549890b6744903c1 | https://github.com/sohrabi1/esm/tree/e1f60a66b5c351d9d0011926549890b6744903c1 |
LogSTFTMagnitudeLoss | import torch
import torch.nn.functional as F
import torch.utils.data
class LogSTFTMagnitudeLoss(torch.nn.Module):
"""Log STFT magnitude loss module."""
def __init__(self):
"""Initilize los STFT magnitude loss module."""
super(LogSTFTMagnitudeLoss, self).__init__()
def forward(self, x_mag... | 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.utils.dat... | tebin/Fre-GAN-pytorch | LogSTFTMagnitudeLoss | false | 10,870 | [
"MIT"
] | 0 | e2f51317ae3953f10b8a0d112fc14991a02ebe91 | https://github.com/tebin/Fre-GAN-pytorch/tree/e2f51317ae3953f10b8a0d112fc14991a02ebe91 |
SpectralConvergengeLoss | import torch
import torch.utils.data
class SpectralConvergengeLoss(torch.nn.Module):
"""Spectral convergence loss module."""
def __init__(self):
"""Initilize spectral convergence loss module."""
super(SpectralConvergengeLoss, self).__init__()
def forward(self, x_mag, y_mag):
"""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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
asse... | tebin/Fre-GAN-pytorch | SpectralConvergengeLoss | false | 10,871 | [
"MIT"
] | 0 | e2f51317ae3953f10b8a0d112fc14991a02ebe91 | https://github.com/tebin/Fre-GAN-pytorch/tree/e2f51317ae3953f10b8a0d112fc14991a02ebe91 |
ClipGlobalAvgPool2d | import torch
import torch.nn as nn
class FastGlobalAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastGlobalAvgPool2d, self).__init__()
self.flatten = flatten
def forward(self, x):
if self.flatten:
in_size = x.size()
return x.view((in_size[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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | tenghehan/reid_without_id | ClipGlobalAvgPool2d | false | 10,872 | [
"MIT"
] | 0 | d1d0ff273b1ef19fc6da8cbbf210527779b37455 | https://github.com/tenghehan/reid_without_id/tree/d1d0ff273b1ef19fc6da8cbbf210527779b37455 |
AttentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionLayer(nn.Module):
def __init__(self, hidden_size):
super(AttentionLayer, self).__init__()
self.hidden_size = hidden_size
def dot_product_attention(self, hidden, encoder_output):
return torch.sum(hidden ... | 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
... | u7javed/AI-Chatbot | AttentionLayer | false | 10,873 | [
"MIT"
] | 0 | d86916537e7b0b9a45f11d0fe0367fe9f66721e7 | https://github.com/u7javed/AI-Chatbot/tree/d86916537e7b0b9a45f11d0fe0367fe9f66721e7 |
NormScaleFeature | import torch
from torch import nn
class NormScaleFeature(nn.Module):
def __init__(self, init_value=1):
super().__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
magnitudes = 1e-06 + torch.sqrt(torch.sum(input ** 2, axis=1,
kee... | 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... | uncbiag/FeatureMapICON | NormScaleFeature | false | 10,874 | [
"Apache-2.0"
] | 0 | 04160d0ce4e8f7615e1c59a1be5c6b8340b5b6e5 | https://github.com/uncbiag/FeatureMapICON/tree/04160d0ce4e8f7615e1c59a1be5c6b8340b5b6e5 |
Scaled_Dot_Product_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
Args:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | tianjiansmile/Chinese-Text-Classification-Pytorch | Scaled_Dot_Product_Attention | false | 10,875 | [
"MIT"
] | 0 | 05cc211b161f61e6bb32ab185dadcffec2f5b5de | https://github.com/tianjiansmile/Chinese-Text-Classification-Pytorch/tree/05cc211b161f61e6bb32ab185dadcffec2f5b5de |
UNETMax | import torch
from torch import nn
class UNETMax(nn.Module):
"""UNET Without concatenation during decoding"""
def __init__(self):
super(UNETMax, self).__init__()
self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=16,
kernel_size=3, stride=1, padding=1)
self.conv1_2 = nn.C... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | quenting44/semantic_segmentation | UNETMax | false | 10,876 | [
"MIT"
] | 0 | bd197ddda3c6891d69ff7e552a0c224c7ec1269a | https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a |
PositionwiseFeedForward | import torch
from abc import ABC
import torch.nn as nn
class PositionwiseFeedForward(nn.Module, ABC):
def __init__(self, d_in, d_hidden, dropout=0.1):
super().__init__()
self.w_1 = nn.Linear(d_in, d_hidden)
self.w_2 = nn.Linear(d_hidden, d_in)
self.layer_norm = nn.LayerNorm(d_in, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | superMC5657/transformer | PositionwiseFeedForward | false | 10,877 | [
"MIT"
] | 0 | b9d9ca3a5f307f6587330a8235e8d5a2a3650510 | https://github.com/superMC5657/transformer/tree/b9d9ca3a5f307f6587330a8235e8d5a2a3650510 |
GCN | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.modules.loss
class GraphConvolution1(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/16... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | thilinicooray/pygcn | GCN | false | 10,878 | [
"MIT"
] | 0 | a7d4f12f31898a3b386736215a6d5fe5cb857387 | https://github.com/thilinicooray/pygcn/tree/a7d4f12f31898a3b386736215a6d5fe5cb857387 |
LocalVariation | import torch
import torch.nn as nn
class LocalVariation(nn.Module):
"""Layer to compute the LocalVariation of an image
"""
def __init__(self, k_size=5):
super(LocalVariation, self).__init__()
self.mu_x_pool = nn.AvgPool2d(k_size, 1)
self.mu_y_pool = nn.AvgPool2d(k_size, 1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | shlomi-amitai/myDIFFNet | LocalVariation | false | 10,879 | [
"MIT"
] | 0 | 39dead457f10c82caae2a12ea152f2339188014c | https://github.com/shlomi-amitai/myDIFFNet/tree/39dead457f10c82caae2a12ea152f2339188014c |
Project3D | import torch
import torch.nn as nn
class Project3D(nn.Module):
"""Layer which projects 3D points into a camera with intrinsics K and at position T
"""
def __init__(self, batch_size, height, width, eps=1e-07):
super(Project3D, self).__init__()
self.batch_size = batch_size
self.heig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | shlomi-amitai/myDIFFNet | Project3D | false | 10,880 | [
"MIT"
] | 0 | 39dead457f10c82caae2a12ea152f2339188014c | https://github.com/shlomi-amitai/myDIFFNet/tree/39dead457f10c82caae2a12ea152f2339188014c |
SSIM | import torch
import torch.nn as nn
class SSIM(nn.Module):
"""Layer to compute the SSIM loss between a pair of images
"""
def __init__(self):
super(SSIM, self).__init__()
self.mu_x_pool = nn.AvgPool2d(3, 1)
self.mu_y_pool = nn.AvgPool2d(3, 1)
self.sig_x_pool = nn.AvgPool2d(... | 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
... | shlomi-amitai/myDIFFNet | SSIM | false | 10,881 | [
"MIT"
] | 0 | 39dead457f10c82caae2a12ea152f2339188014c | https://github.com/shlomi-amitai/myDIFFNet/tree/39dead457f10c82caae2a12ea152f2339188014c |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 16, 3, 1)
self.conv2 = nn.Conv2d(16, 40, 2, 1)
self.fc1 = nn.Linear(3 * 3 * 40, 400)
self.f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | tkhkaeio/PyTorch-GAN | Net | false | 10,882 | [
"MIT"
] | 0 | 565c67cae168a42c6822c787562a1f7a5b35a2ab | https://github.com/tkhkaeio/PyTorch-GAN/tree/565c67cae168a42c6822c787562a1f7a5b35a2ab |
CoAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class CoAttention(nn.Module):
"""
CoAttention encoder
in Dynamic Coattention Networks For Question Answering (https://arxiv.org/abs/1611.01604)
check the Figure 2 in paper
* Args:
embed_dim: the number of input embedd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | srlee-ai/claf | CoAttention | false | 10,883 | [
"MIT"
] | 0 | 89b3e5c5ec0486886876ea3bac381508c6a6bf58 | https://github.com/srlee-ai/claf/tree/89b3e5c5ec0486886876ea3bac381508c6a6bf58 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PointwiseConv(nn.Module):
"""
Pointwise Convolution (1x1 Conv)
Convolution 1 Dimension (Faster version)
(cf. https://github.com/huggingface/pytorch-openai-transformer-lm/blob/ eafc28abdfadfa0732f03a0fc65805c5bfb2ffe7/mode... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | srlee-ai/claf | PositionwiseFeedForward | false | 10,884 | [
"MIT"
] | 0 | 89b3e5c5ec0486886876ea3bac381508c6a6bf58 | https://github.com/srlee-ai/claf/tree/89b3e5c5ec0486886876ea3bac381508c6a6bf58 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""
Layer Normalization
(https://arxiv.org/abs/1607.06450)
"""
def __init__(self, normalized_shape, eps=1e-05):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(normalized_shape))
self.bet... | 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_... | srlee-ai/claf | LayerNorm | false | 10,885 | [
"MIT"
] | 0 | 89b3e5c5ec0486886876ea3bac381508c6a6bf58 | https://github.com/srlee-ai/claf/tree/89b3e5c5ec0486886876ea3bac381508c6a6bf58 |
MultiHeadAttention | import torch
from abc import ABC
import torch.nn as nn
from torch import matmul
class ScaledDotProductAttention(nn.Module, ABC):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | superMC5657/transformer | MultiHeadAttention | false | 10,886 | [
"MIT"
] | 0 | b9d9ca3a5f307f6587330a8235e8d5a2a3650510 | https://github.com/superMC5657/transformer/tree/b9d9ca3a5f307f6587330a8235e8d5a2a3650510 |
Multi_Head_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
Args:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | tianjiansmile/Chinese-Text-Classification-Pytorch | Multi_Head_Attention | false | 10,887 | [
"MIT"
] | 0 | 05cc211b161f61e6bb32ab185dadcffec2f5b5de | https://github.com/tianjiansmile/Chinese-Text-Classification-Pytorch/tree/05cc211b161f61e6bb32ab185dadcffec2f5b5de |
Bilinear | import torch
import torch.nn as nn
class Bilinear(nn.Module):
def __init__(self, dim_left, dim_right, dim_out):
super().__init__()
self.dim_left = dim_left
self.dim_right = dim_right
self.dim_out = dim_out
self.bilinear = nn.Bilinear(dim_left, dim_right, dim_out)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | tpimentelms/dep-parser | Bilinear | false | 10,888 | [
"MIT"
] | 0 | be622cdd9a8b0ba85a28c39129ae2cdbfef03901 | https://github.com/tpimentelms/dep-parser/tree/be622cdd9a8b0ba85a28c39129ae2cdbfef03901 |
EncoderLayer | import torch
from abc import ABC
import torch.nn as nn
from torch import matmul
class ScaledDotProductAttention(nn.Module, ABC):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | superMC5657/transformer | EncoderLayer | false | 10,889 | [
"MIT"
] | 0 | b9d9ca3a5f307f6587330a8235e8d5a2a3650510 | https://github.com/superMC5657/transformer/tree/b9d9ca3a5f307f6587330a8235e8d5a2a3650510 |
Conv | import torch
import torch.nn as nn
class Conv(nn.Module):
def __init__(self, chn_in, chn_out, ker_sz=3):
super().__init__()
self.c = nn.Conv2d(chn_in, chn_out, ker_sz, padding=ker_sz // 2,
padding_mode='circular', bias=False)
self.a = nn.ReLU()
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.nn as nn
assert_... | tuxedcat/A2C | Conv | false | 10,890 | [
"Apache-2.0"
] | 0 | 4a6686af05667f8760f2731f184e1845a2d11c6f | https://github.com/tuxedcat/A2C/tree/4a6686af05667f8760f2731f184e1845a2d11c6f |
BiAvg | import torch
from torch import nn
class BiAvg(nn.AvgPool1d):
def forward(self, x):
x = x.transpose(1, 2)
x = super().forward(x)
return x.transpose(1, 2)
def get_inputs():
return [torch.rand([4, 4, 4])]
def get_init_inputs():
return [[], {'kernel_size': 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | urchade/urchade-byte_search | BiAvg | false | 10,891 | [
"MIT"
] | 0 | 5155adb1550dcab873db4e9b124c42da24c99b8e | https://github.com/urchade/urchade-byte_search/tree/5155adb1550dcab873db4e9b124c42da24c99b8e |
DecoderLayer | import torch
from abc import ABC
import torch.nn as nn
from torch import matmul
class ScaledDotProductAttention(nn.Module, ABC):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | superMC5657/transformer | DecoderLayer | false | 10,892 | [
"MIT"
] | 0 | b9d9ca3a5f307f6587330a8235e8d5a2a3650510 | https://github.com/superMC5657/transformer/tree/b9d9ca3a5f307f6587330a8235e8d5a2a3650510 |
Biaffine | import torch
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, dim_left, dim_right):
super().__init__()
self.dim_left = dim_left
self.dim_right = dim_right
self.matrix = nn.Parameter(torch.Tensor(dim_left, dim_right))
self.bias = nn.Parameter(torch.Tensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | tpimentelms/dep-parser | Biaffine | false | 10,893 | [
"MIT"
] | 0 | be622cdd9a8b0ba85a28c39129ae2cdbfef03901 | https://github.com/tpimentelms/dep-parser/tree/be622cdd9a8b0ba85a28c39129ae2cdbfef03901 |
SelfAttn | import torch
import torch.nn.functional as F
from torch import nn
class SelfAttn(nn.Module):
"""
self-attention with learnable parameters
"""
def __init__(self, dhid):
super().__init__()
self.scorer = nn.Linear(dhid, 1)
def forward(self, inp):
scores = F.softmax(self.scor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | uyeongkim/moca | SelfAttn | false | 10,894 | [
"MIT"
] | 0 | 8a5870898b6d59258ce1064bab440b7e8107e9b4 | https://github.com/uyeongkim/moca/tree/8a5870898b6d59258ce1064bab440b7e8107e9b4 |
SeqAttnMatch | import torch
import torch.nn as nn
import torch.nn.functional as F
class SeqAttnMatch(nn.Module):
"""
Given sequences X and Y, match sequence Y to each element in X.
* o_i = sum(alpha_j * y_j) for i in X
* alpha_j = softmax(y_j * x_i)
"""
def __init__(self, embed_dim, identity=False):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | srlee-ai/claf | SeqAttnMatch | false | 10,895 | [
"MIT"
] | 0 | 89b3e5c5ec0486886876ea3bac381508c6a6bf58 | https://github.com/srlee-ai/claf/tree/89b3e5c5ec0486886876ea3bac381508c6a6bf58 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd
class Critic(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Critic, self).__init__()
self.linear1 = nn.Linear(input_size, hidden_size)
self.linear2 = nn.Linear(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
import torch.nn as nn
import ... | vivekagra/Biplane-Quadrotor | Critic | false | 10,896 | [
"BSD-3-Clause"
] | 0 | afe69216494842f5bfe16cbcc0cdcc6ef0de7769 | https://github.com/vivekagra/Biplane-Quadrotor/tree/afe69216494842f5bfe16cbcc0cdcc6ef0de7769 |
Simple_nn | import torch
class Simple_nn(torch.nn.Module):
def __init__(self, dims_in, hidden):
super(Simple_nn, self).__init__()
self.linear1 = torch.nn.Linear(dims_in, hidden)
self.linear2 = torch.nn.Linear(hidden, 2)
self.output = torch.nn.LogSoftmax()
def forward(self, x):
hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | urbanriskmap/timeseries-analysis | Simple_nn | false | 10,897 | [
"MIT"
] | 0 | 6b9a8d1a916ff784cb0de93d6997cd072d1ca6ae | https://github.com/urbanriskmap/timeseries-analysis/tree/6b9a8d1a916ff784cb0de93d6997cd072d1ca6ae |
model | import torch
import torch.nn as nn
class model(nn.Module):
def __init__(self, input_shape=28 * 28, nr_classes=10):
super(model, self).__init__()
self.input_shape = input_shape
self.fc1 = nn.Linear(input_shape, 200)
self.fc2 = nn.Linear(200, nr_classes)
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.... | vishal-keshav/pytorch-project-template | model | false | 10,898 | [
"MIT"
] | 0 | 526dd5b1036ed9cf592172301a2c85e8425cd154 | https://github.com/vishal-keshav/pytorch-project-template/tree/526dd5b1036ed9cf592172301a2c85e8425cd154 |
ThreeNet | import torch
import torch.nn as nn
class ThreeNet(nn.Module):
"""
A network with three layers. This is used for testing a network with more
than one operation. The network has a convolution layer followed by two
fully connected layers.
"""
def __init__(self, input_dim: 'int', conv_dim: 'int',... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | synthara/M-SFV-SyntharaFVcore | ThreeNet | false | 10,899 | [
"Apache-2.0"
] | 0 | b4d2167a110aaecf3df442f58793ca2cb7b028ba | https://github.com/synthara/M-SFV-SyntharaFVcore/tree/b4d2167a110aaecf3df442f58793ca2cb7b028ba |
SmallConvNet | import torch
from typing import Tuple
import torch.nn as nn
from numpy import prod
class SmallConvNet(nn.Module):
"""
A network with three conv layers. This is used for testing convolution
layers for activation count.
"""
def __init__(self, input_dim: 'int') ->None:
super(SmallConvNet, se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from typing import Tuple
import torch.nn as nn
from numpy import prod
assert_siz... | synthara/M-SFV-SyntharaFVcore | SmallConvNet | false | 10,900 | [
"Apache-2.0"
] | 0 | b4d2167a110aaecf3df442f58793ca2cb7b028ba | https://github.com/synthara/M-SFV-SyntharaFVcore/tree/b4d2167a110aaecf3df442f58793ca2cb7b028ba |
Discrete | import torch
import torch.nn as nn
class Discrete(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return nn.functional.softmax(x, dim=0)
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
... | wandb/cli | Discrete | false | 10,901 | [
"MIT"
] | 0 | 4a21c2c0c9944734f4c30a8e1453aaf45609e415 | https://github.com/wandb/cli/tree/4a21c2c0c9944734f4c30a8e1453aaf45609e415 |
NestedNetInnerModule | import torch
import torch.nn as nn
from typing import Counter
from collections import Counter
class NestedNetInnerModule(nn.Module):
"""
A submodule for the nested net test module below.
"""
def __init__(self, lin_op: 'str'='addmm') ->None:
super().__init__()
conv_input_size = 2, 5
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from typing import Counter
from collections import Counter... | synthara/M-SFV-SyntharaFVcore | NestedNetInnerModule | false | 10,902 | [
"Apache-2.0"
] | 0 | b4d2167a110aaecf3df442f58793ca2cb7b028ba | https://github.com/synthara/M-SFV-SyntharaFVcore/tree/b4d2167a110aaecf3df442f58793ca2cb7b028ba |
Complex_nn | import torch
import torch.nn.functional as F
class Complex_nn(torch.nn.Module):
def __init__(self, dims_in, hidden):
super(Complex_nn, self).__init__()
self.fc1 = torch.nn.Linear(dims_in, hidden)
self.fc2 = torch.nn.Linear(hidden, hidden)
self.fc3 = torch.nn.Linear(hidden, 2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | urbanriskmap/timeseries-analysis | Complex_nn | false | 10,903 | [
"MIT"
] | 0 | 6b9a8d1a916ff784cb0de93d6997cd072d1ca6ae | https://github.com/urbanriskmap/timeseries-analysis/tree/6b9a8d1a916ff784cb0de93d6997cd072d1ca6ae |
DilatedResidualLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class DilatedResidualLayer(nn.Module):
def __init__(self, dilation, in_channels, out_channels):
super(DilatedResidualLayer, self).__init__()
self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding
=dilation... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | tonnidas/sign-segmentation | DilatedResidualLayer | false | 10,904 | [
"MIT"
] | 0 | 5332ccd1dbef311daa594ed6faa45cbd618a76a0 | https://github.com/tonnidas/sign-segmentation/tree/5332ccd1dbef311daa594ed6faa45cbd618a76a0 |
Upconv | import math
import torch
import torch.nn.functional as F
from torch.nn import Conv2d
from torch.nn import Upsample
class PadSameConv2d(torch.nn.Module):
def __init__(self, kernel_size, stride=1):
"""
Imitates padding_mode="same" from tensorflow.
:param kernel_size: Kernelsize of the convo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | shlomi-amitai/monorec | Upconv | false | 10,905 | [
"MIT"
] | 0 | 74571c6cd8d06ae4fb15cbee5a41147c54c78556 | https://github.com/shlomi-amitai/monorec/tree/74571c6cd8d06ae4fb15cbee5a41147c54c78556 |
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... | shlomi-amitai/monorec | ConvReLU | false | 10,906 | [
"MIT"
] | 0 | 74571c6cd8d06ae4fb15cbee5a41147c54c78556 | https://github.com/shlomi-amitai/monorec/tree/74571c6cd8d06ae4fb15cbee5a41147c54c78556 |
VAE | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Decoder(nn.Module):
""" VAE decoder """
def __init__(self, img_channels, latent_size):
super(Decoder, self).__init__()
self.latent_size = latent_size
self.img_channels = img_channels
... | 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 import triton_helpers
from... | susanwe/world-models | VAE | false | 10,907 | [
"MIT"
] | 0 | 0f246a430683e6ab741726df0a97f35830044356 | https://github.com/susanwe/world-models/tree/0f246a430683e6ab741726df0a97f35830044356 |
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... | shlomi-amitai/monorec | ConvSig | false | 10,908 | [
"MIT"
] | 0 | 74571c6cd8d06ae4fb15cbee5a41147c54c78556 | https://github.com/shlomi-amitai/monorec/tree/74571c6cd8d06ae4fb15cbee5a41147c54c78556 |
GlobalAttention_text | import torch
import torch.nn as nn
import torch.nn.parallel
class GlobalAttention_text(nn.Module):
def __init__(self, idf, cdf):
super(GlobalAttention_text, self).__init__()
self.conv_context = nn.Conv1d(cdf, idf, kernel_size=1, stride=1,
padding=0)
self.sm = nn.Softmax()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ts170/T2I_CL | GlobalAttention_text | false | 10,909 | [
"MIT"
] | 0 | 8754bea1101aabcbf8108b95e722f7aaeb385869 | https://github.com/ts170/T2I_CL/tree/8754bea1101aabcbf8108b95e722f7aaeb385869 |
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... | shlomi-amitai/monorec | ConvReLU2 | false | 10,910 | [
"MIT"
] | 0 | 74571c6cd8d06ae4fb15cbee5a41147c54c78556 | https://github.com/shlomi-amitai/monorec/tree/74571c6cd8d06ae4fb15cbee5a41147c54c78556 |
GlobalAttentionGeneral | import torch
import torch.nn as nn
import torch.nn.parallel
class GlobalAttentionGeneral(nn.Module):
def __init__(self, idf, cdf):
super(GlobalAttentionGeneral, self).__init__()
self.sm = nn.Softmax()
self.mask = None
def applyMask(self, mask):
self.mask = mask
def forwa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ts170/T2I_CL | GlobalAttentionGeneral | false | 10,911 | [
"MIT"
] | 0 | 8754bea1101aabcbf8108b95e722f7aaeb385869 | https://github.com/ts170/T2I_CL/tree/8754bea1101aabcbf8108b95e722f7aaeb385869 |
Memory | import torch
import torch.nn as nn
import torch.nn.parallel
class Memory(nn.Module):
def __init__(self):
super(Memory, self).__init__()
self.sm = nn.Softmax()
self.mask = None
def applyMask(self, mask):
self.mask = mask
def forward(self, input, context_key, content_value... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ts170/T2I_CL | Memory | false | 10,912 | [
"MIT"
] | 0 | 8754bea1101aabcbf8108b95e722f7aaeb385869 | https://github.com/ts170/T2I_CL/tree/8754bea1101aabcbf8108b95e722f7aaeb385869 |
Backprojection | import torch
import torch.nn as nn
class Backprojection(nn.Module):
def __init__(self, batch_size, height, width):
super(Backprojection, self).__init__()
self.N, self.H, self.W = batch_size, height, width
yy, xx = torch.meshgrid([torch.arange(0.0, float(self.H)), torch.
arange... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | shlomi-amitai/monorec | Backprojection | false | 10,913 | [
"MIT"
] | 0 | 74571c6cd8d06ae4fb15cbee5a41147c54c78556 | https://github.com/shlomi-amitai/monorec/tree/74571c6cd8d06ae4fb15cbee5a41147c54c78556 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
Args:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | tianjiansmile/Chinese-Text-Classification-Pytorch | Encoder | false | 10,914 | [
"MIT"
] | 0 | 05cc211b161f61e6bb32ab185dadcffec2f5b5de | https://github.com/tianjiansmile/Chinese-Text-Classification-Pytorch/tree/05cc211b161f61e6bb32ab185dadcffec2f5b5de |
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... | tony23545/yolact_edge | ShuffleCatAlt | false | 10,915 | [
"MIT"
] | 0 | 11840512ab46f22dce6aea37a7823110175adffa | https://github.com/tony23545/yolact_edge/tree/11840512ab46f22dce6aea37a7823110175adffa |
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... | tony23545/yolact_edge | ShuffleCatChunk | false | 10,916 | [
"MIT"
] | 0 | 11840512ab46f22dce6aea37a7823110175adffa | https://github.com/tony23545/yolact_edge/tree/11840512ab46f22dce6aea37a7823110175adffa |
MuLawDecoding | import torch
from torch import Tensor
import torchaudio.functional as F
class MuLawDecoding(torch.nn.Module):
"""Decode mu-law encoded signal. For more info see the
`Wikipedia Entry <https://en.wikipedia.org/wiki/%CE%9C-law_algorithm>`_
This expects an input with values between 0 and quantization_channe... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | tbright17/audio | MuLawDecoding | false | 10,917 | [
"BSD-2-Clause"
] | 0 | 00d38203e401b8d9472a8f8394a10e2c309be02c | https://github.com/tbright17/audio/tree/00d38203e401b8d9472a8f8394a10e2c309be02c |
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... | transat/latent-diffusion | TransposedUpsample | false | 10,918 | [
"MIT"
] | 0 | 1ea0d5bb3fb0fe3f7e8c42cbae91423780977f83 | https://github.com/transat/latent-diffusion/tree/1ea0d5bb3fb0fe3f7e8c42cbae91423780977f83 |
MuLawEncoding | import torch
from torch import Tensor
import torchaudio.functional as F
class MuLawEncoding(torch.nn.Module):
"""Encode signal based on mu-law companding. For more info see the
`Wikipedia Entry <https://en.wikipedia.org/wiki/%CE%9C-law_algorithm>`_
This algorithm assumes the signal has been scaled to be... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | tbright17/audio | MuLawEncoding | false | 10,919 | [
"BSD-2-Clause"
] | 0 | 00d38203e401b8d9472a8f8394a10e2c309be02c | https://github.com/tbright17/audio/tree/00d38203e401b8d9472a8f8394a10e2c309be02c |
SlidingWindowCmn | import torch
from torch import Tensor
import torchaudio.functional as F
class SlidingWindowCmn(torch.nn.Module):
"""
Apply sliding-window cepstral mean (and optionally variance) normalization per utterance.
Args:
cmn_window (int, optional): Window in frames for running average CMN computation (in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret... | tbright17/audio | SlidingWindowCmn | false | 10,920 | [
"BSD-2-Clause"
] | 0 | 00d38203e401b8d9472a8f8394a10e2c309be02c | https://github.com/tbright17/audio/tree/00d38203e401b8d9472a8f8394a10e2c309be02c |
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... | tony23545/yolact_edge | ShuffleCat | false | 10,921 | [
"MIT"
] | 0 | 11840512ab46f22dce6aea37a7823110175adffa | https://github.com/tony23545/yolact_edge/tree/11840512ab46f22dce6aea37a7823110175adffa |
AmplitudeToDB | import math
import torch
from torch import Tensor
import torchaudio.functional as F
from typing import Optional
class AmplitudeToDB(torch.nn.Module):
"""Turn a tensor from the power/amplitude scale to the decibel scale.
This output depends on the maximum value in the input tensor, and so
may return diffe... | 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 math
from typing impo... | tbright17/audio | AmplitudeToDB | false | 10,922 | [
"BSD-2-Clause"
] | 0 | 00d38203e401b8d9472a8f8394a10e2c309be02c | https://github.com/tbright17/audio/tree/00d38203e401b8d9472a8f8394a10e2c309be02c |
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... | transat/latent-diffusion | SpatialRescaler | false | 10,923 | [
"MIT"
] | 0 | 1ea0d5bb3fb0fe3f7e8c42cbae91423780977f83 | https://github.com/transat/latent-diffusion/tree/1ea0d5bb3fb0fe3f7e8c42cbae91423780977f83 |
hsigmoid | import torch
import torch.onnx
import torch
import torch.nn as nn
import torch.nn.functional as F
class hsigmoid(nn.Module):
def forward(self, x):
out = F.relu6(x + 3, inplace=True) / 6
return out
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
import torch.onnx
import torch
import torch.nn as nn
assert_size_stride = torch._C._dynam... | tomy-0000/pytorch-ssd | hsigmoid | false | 10,924 | [
"MIT"
] | 0 | 620c0020bbd418001d10263559406bb464139419 | https://github.com/tomy-0000/pytorch-ssd/tree/620c0020bbd418001d10263559406bb464139419 |
BiaffineAttention | import torch
import torch.nn as nn
class BiaffineAttention(nn.Module):
def __init__(self, in_features, out_features):
super(BiaffineAttention, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.bilinear = torch.nn.Bilinear(in_features, in_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | vietbt/ViTextnormASR | BiaffineAttention | false | 10,925 | [
"Apache-2.0"
] | 0 | 57444aa7247c67b2628d1802e9ed53dae4857ee4 | https://github.com/vietbt/ViTextnormASR/tree/57444aa7247c67b2628d1802e9ed53dae4857ee4 |
GEGLU | import torch
import torch.nn.functional as F
import torch.nn as nn
class GEGLU(nn.Module):
def __init__(self, dim_in, dim_out):
super().__init__()
self.proj = nn.Linear(dim_in, dim_out * 2)
def forward(self, x):
x, gate = self.proj(x).chunk(2, dim=-1)
return x * F.gelu(gate)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | transat/latent-diffusion | GEGLU | false | 10,926 | [
"MIT"
] | 0 | 1ea0d5bb3fb0fe3f7e8c42cbae91423780977f83 | https://github.com/transat/latent-diffusion/tree/1ea0d5bb3fb0fe3f7e8c42cbae91423780977f83 |
Vol | import math
import torch
from torch import Tensor
import torchaudio.functional as F
class Vol(torch.nn.Module):
"""Add a volume to an waveform.
Args:
gain (float): Interpreted according to the given gain_type:
If ``gain_type`` = ``amplitude``, ``gain`` is a positive amplitude ratio.
... | 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... | tbright17/audio | Vol | false | 10,927 | [
"BSD-2-Clause"
] | 0 | 00d38203e401b8d9472a8f8394a10e2c309be02c | https://github.com/tbright17/audio/tree/00d38203e401b8d9472a8f8394a10e2c309be02c |
ImageGradients | import torch
import torch as th
import torch.utils.data
class ImageGradients(th.nn.Module):
def __init__(self, c_in):
super(ImageGradients, self).__init__()
self.dx = th.nn.Conv2d(c_in, c_in, [3, 3], padding=1, bias=False,
groups=c_in)
self.dy = th.nn.Conv2d(c_in, c_in, [3, 3]... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch as th
import torch.utils.data
assert_size_stride = torch._C._dynamo... | sutkarsh/ttools | ImageGradients | false | 10,928 | [
"MIT"
] | 0 | a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 | https://github.com/sutkarsh/ttools/tree/a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 |
Sparsemax | import torch
import torch.utils.data
import torch.nn as nn
class Sparsemax(nn.Module):
"""Sparsemax function."""
def __init__(self, dim=None):
"""Initialize sparsemax activation
Args:
dim (int, optional): The dimension over which to apply the sparsemax function.
"... | 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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | tkc-morita/secl | Sparsemax | false | 10,929 | [
"MIT"
] | 0 | d0156cea4fd95ea5071126dbf076a6da69752a37 | https://github.com/tkc-morita/secl/tree/d0156cea4fd95ea5071126dbf076a6da69752a37 |
ConvChain | import torch
import torch.utils.data
import torch.nn as nn
def _get_activation(activation):
valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid']
assert activation in valid, 'activation should be one of {}'.format(valid)
if activation == 'relu':
return nn.ReLU(inplace=True)
if activation ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | sutkarsh/ttools | ConvChain | false | 10,930 | [
"MIT"
] | 0 | a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 | https://github.com/sutkarsh/ttools/tree/a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 |
DiscreteCrossEntropyLoss | import torch
import torch.utils.data
class DiscreteCrossEntropyLoss(torch.nn.Module):
def __init__(self, in_features, num_classes):
super(DiscreteCrossEntropyLoss, self).__init__()
self.in_features = in_features
self.num_classes = num_classes
self.fc = torch.nn.Linear(in_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 import triton_helpers
from torch._inductor.runtime.... | tkc-morita/secl | DiscreteCrossEntropyLoss | false | 10,931 | [
"MIT"
] | 0 | d0156cea4fd95ea5071126dbf076a6da69752a37 | https://github.com/tkc-morita/secl/tree/d0156cea4fd95ea5071126dbf076a6da69752a37 |
Net | import torch
import torch.nn.functional as F
class Net(torch.nn.Module):
def __init__(self, n_feature, n_hidden, n_output):
super(Net, self).__init__()
self.hidden = torch.nn.Linear(n_feature, n_hidden)
self.predict = torch.nn.Linear(n_hidden, n_output)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | wikeex/pytorch-learning | Net | false | 10,932 | [
"MIT"
] | 0 | 8cd710d65a52b58b1593fbba6c4134e08ea18d9f | https://github.com/wikeex/pytorch-learning/tree/8cd710d65a52b58b1593fbba6c4134e08ea18d9f |
PSNR | import torch
import torch as th
import torch.utils.data
class PSNR(th.nn.Module):
def __init__(self):
super(PSNR, self).__init__()
self.mse = th.nn.MSELoss()
def forward(self, out, ref):
mse = self.mse(out, ref)
return -10 * th.log10(mse + 1e-12)
def get_inputs():
retur... | 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 as th
import to... | sutkarsh/ttools | PSNR | false | 10,933 | [
"MIT"
] | 0 | a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 | https://github.com/sutkarsh/ttools/tree/a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 |
FCNet | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class FCNet(nn.Module):
def __init__(self, input_size, output_size):
super().__init__()
self.l1 = nn.Linear(input_size, 5)
self.relu = nn.ReLU()
self.l2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | rmfan/nni | FCNet | false | 10,934 | [
"MIT"
] | 0 | 727ee1ce47e070061fe3dab8a2da5d3cd5e55546 | https://github.com/rmfan/nni/tree/727ee1ce47e070061fe3dab8a2da5d3cd5e55546 |
FCChain | import torch
import torch.utils.data
import torch.nn as nn
def _get_activation(activation):
valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid']
assert activation in valid, 'activation should be one of {}'.format(valid)
if activation == 'relu':
return nn.ReLU(inplace=True)
if activation ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | sutkarsh/ttools | FCChain | false | 10,935 | [
"MIT"
] | 0 | a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 | https://github.com/sutkarsh/ttools/tree/a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 |
FixupBasicBlock | import torch
import torch as th
import torch.utils.data
import torch.nn as nn
def _get_activation(activation):
valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid']
assert activation in valid, 'activation should be one of {}'.format(valid)
if activation == 'relu':
return nn.ReLU(inplace=True)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch as th
import tor... | sutkarsh/ttools | FixupBasicBlock | false | 10,936 | [
"MIT"
] | 0 | a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 | https://github.com/sutkarsh/ttools/tree/a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 |
PFLDLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class PFLDLoss(nn.Module):
"""Weighted loss of L2 distance with the pose angle for PFLD."""
def __init__(self):
super(PFLDLoss, self).__init__()
def forward(self, landmark_... | 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
import torch.nn.parallel
import torch.optim
import ... | rmfan/nni | PFLDLoss | false | 10,937 | [
"MIT"
] | 0 | 727ee1ce47e070061fe3dab8a2da5d3cd5e55546 | https://github.com/rmfan/nni/tree/727ee1ce47e070061fe3dab8a2da5d3cd5e55546 |
ComputeDeltas | import torch
from torch import Tensor
import torchaudio.functional as F
class ComputeDeltas(torch.nn.Module):
"""Compute delta coefficients of a tensor, usually a spectrogram.
See `torchaudio.functional.compute_deltas` for more details.
Args:
win_length (int): The window length used for computin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | tbright17/audio | ComputeDeltas | false | 10,938 | [
"BSD-2-Clause"
] | 0 | 00d38203e401b8d9472a8f8394a10e2c309be02c | https://github.com/tbright17/audio/tree/00d38203e401b8d9472a8f8394a10e2c309be02c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.