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 |
|---|---|---|---|---|---|---|---|---|---|---|
FixupResidualChain | import torch
import numpy as np
import torch as th
import torch.utils.data
import torch.nn as nn
from collections import OrderedDict
def _get_activation(activation):
valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid']
assert activation in valid, 'activation should be one of {}'.format(valid)
if act... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | sutkarsh/ttools | FixupResidualChain | false | 10,939 | [
"MIT"
] | 0 | a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 | https://github.com/sutkarsh/ttools/tree/a2e5fbf308566c0c54ab9d6ad1d9f8bc63f8fe99 |
TransformerLayer | import math
import torch
import uuid
from torch import Tensor
import torch.nn as nn
from typing import Tuple
import torch.nn.functional as F
from typing import Optional
from typing import Dict
from torch.nn import Parameter
def gelu(x):
"""Implementation of the gelu activation function.
For information: Open... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | sohrabi1/esm | TransformerLayer | false | 10,940 | [
"MIT"
] | 0 | e1f60a66b5c351d9d0011926549890b6744903c1 | https://github.com/sohrabi1/esm/tree/e1f60a66b5c351d9d0011926549890b6744903c1 |
Pooling | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class ReLUConvBN(nn.Module):
"""
Parameters
---
C_in: int
the number of input channels
C_out: int
the number of output channels
stride: int
stride... | 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
from typing import *
assert_size_stride = torch._C... | rmfan/nni | Pooling | false | 10,941 | [
"MIT"
] | 0 | 727ee1ce47e070061fe3dab8a2da5d3cd5e55546 | https://github.com/rmfan/nni/tree/727ee1ce47e070061fe3dab8a2da5d3cd5e55546 |
ResidualBlock | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.channels = 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.nn as nn
import ... | vanthq/EarRecognition | ResidualBlock | false | 10,942 | [
"MIT"
] | 0 | 7decddc97c4b27cd8457308b3d3836388936e7a8 | https://github.com/vanthq/EarRecognition/tree/7decddc97c4b27cd8457308b3d3836388936e7a8 |
ProdAttention | import math
import torch
import torch.nn as nn
import torch.optim
class ProdAttention(nn.Module):
def __init__(self, log_t=False):
super(ProdAttention, self).__init__()
self.log_t = log_t
def forward(self, eh, dhx, ax=None):
pax = eh * dhx
pax = torch.sum(pax, dim=2)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | wgfi110/speech | ProdAttention | false | 10,943 | [
"Apache-2.0"
] | 0 | 59a3e2d8d2d99d31cf32e06c1a0751eb36a3c02b | https://github.com/wgfi110/speech/tree/59a3e2d8d2d99d31cf32e06c1a0751eb36a3c02b |
BackboneModel1 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class BackboneModel1(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 1, 1, 1)
def forward(self, x):
return self.conv1(x)
def get_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.u... | rmfan/nni | BackboneModel1 | false | 10,944 | [
"MIT"
] | 0 | 727ee1ce47e070061fe3dab8a2da5d3cd5e55546 | https://github.com/rmfan/nni/tree/727ee1ce47e070061fe3dab8a2da5d3cd5e55546 |
BCE_LOSS | import math
import torch
from torch.nn.modules.loss import _Loss
import torch.optim
import torch.nn
class BCE_LOSS(_Loss):
def __init__(self):
super().__init__()
self.bce_loss = torch.nn.BCEWithLogitsLoss()
def forward(self, input, label):
one_hot = torch.zeros_like(input)
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, math as tl_math
from torch.... | www516717402/EOD | BCE_LOSS | false | 10,945 | [
"Apache-2.0"
] | 0 | 89ee81a0cb5a5f64a8f788248e2bb3eccee7006d | https://github.com/www516717402/EOD/tree/89ee81a0cb5a5f64a8f788248e2bb3eccee7006d |
Conv2dLocal | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
from torch.nn.modules.utils import _pair
from torch.nn.functional import unfold
from torch.nn import Parameter
def conv2d_local(input: 'torch.Tensor', weight: 'torch.Tensor', bias=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.nn import Module
import math
from torch.nn.parameter import Parameter... | vluzko/keras_to_pytorch | Conv2dLocal | false | 10,946 | [
"MIT"
] | 0 | eefb3f77024b3a3b75e918b93316c12bb9338f1c | https://github.com/vluzko/keras_to_pytorch/tree/eefb3f77024b3a3b75e918b93316c12bb9338f1c |
InceptionA | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
class InceptionA(nn.Module):
def __init__(self, in_channels):
super(InceptionA, self).__init__()
self.branch1x1 = 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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | vanthq/EarRecognition | InceptionA | false | 10,947 | [
"MIT"
] | 0 | 7decddc97c4b27cd8457308b3d3836388936e7a8 | https://github.com/vanthq/EarRecognition/tree/7decddc97c4b27cd8457308b3d3836388936e7a8 |
FreqEncoder | import torch
import torch.nn as nn
class FreqEncoder(nn.Module):
def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True,
include_input=True, periodic_fns=(torch.sin, torch.cos)):
super().__init__()
self.input_dim = input_dim
self.include_input = include_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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | wx-b/torch-ngp | FreqEncoder | false | 10,948 | [
"MIT"
] | 0 | b5799e90dca4e188b14f8c77abf0d420c0bac915 | https://github.com/wx-b/torch-ngp/tree/b5799e90dca4e188b14f8c77abf0d420c0bac915 |
AsymmetricalFocalLoss | import torch
import torch.nn as nn
class AsymmetricalFocalLoss(nn.Module):
def __init__(self, gamma=0, zeta=0):
super(AsymmetricalFocalLoss, self).__init__()
self.gamma = gamma
self.zeta = zeta
def forward(self, pred, target):
losses = -((1 - pred) ** self.gamma * target * to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | venisehannoyer/Hear-me-GirlsInAI-team1 | AsymmetricalFocalLoss | false | 10,949 | [
"Apache-2.0"
] | 0 | 664b3af4befe9b73c28d4362969699bc2254bdf9 | https://github.com/venisehannoyer/Hear-me-GirlsInAI-team1/tree/664b3af4befe9b73c28d4362969699bc2254bdf9 |
ContextGating | import torch
import torch.nn as nn
class ContextGating(nn.Module):
def __init__(self, in_dim):
super(ContextGating, self).__init__()
self.sigmoid = nn.Sigmoid()
self.sigmoid = nn.Sigmoid()
self.linear = nn.Linear(in_dim, in_dim)
def forward(self, x):
lin = self.linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | venisehannoyer/Hear-me-GirlsInAI-team1 | ContextGating | false | 10,950 | [
"Apache-2.0"
] | 0 | 664b3af4befe9b73c28d4362969699bc2254bdf9 | https://github.com/venisehannoyer/Hear-me-GirlsInAI-team1/tree/664b3af4befe9b73c28d4362969699bc2254bdf9 |
InterProbCrossEntropyLoss | import torch
import torch.utils.data
class InterProbCrossEntropyLoss(torch.nn.Module):
def __init__(self, in_features, num_classes):
super(InterProbCrossEntropyLoss, self).__init__()
self.in_features = in_features
self.num_classes = num_classes
self.fc = torch.nn.Linear(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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | tkc-morita/secl | InterProbCrossEntropyLoss | false | 10,951 | [
"MIT"
] | 0 | d0156cea4fd95ea5071126dbf076a6da69752a37 | https://github.com/tkc-morita/secl/tree/d0156cea4fd95ea5071126dbf076a6da69752a37 |
_MCLSTMCell | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from typing import Tuple
class _Gate(nn.Module):
"""Utility class to implement a standard sigmoid gate"""
def __init__(self, in_features: 'int', out_features: 'int'):
super(_Gate, self).__init__()
self.fc = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rro2q2/transfer-learning-aaai21 | _MCLSTMCell | false | 10,952 | [
"BSD-3-Clause"
] | 0 | f1960540d0608ce1e4d1d64bb4abd29d953f250f | https://github.com/rro2q2/transfer-learning-aaai21/tree/f1960540d0608ce1e4d1d64bb4abd29d953f250f |
SoftTargetCrossEntropy | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
class SoftTargetCrossEntropy(nn.Module):
"""
The native CE loss with soft target
input: x is output of model, target is ground truth
return: loss
"""
def __init__(self):
super(SoftTargetCrossEn... | 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
... | xuewengeophysics/volo | SoftTargetCrossEntropy | false | 10,953 | [
"Apache-2.0"
] | 0 | 411f367c617b556fd0df450e7844e57541695c4d | https://github.com/xuewengeophysics/volo/tree/411f367c617b556fd0df450e7844e57541695c4d |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, n_h):
super().__init__()
self.f_k = nn.Bilinear(n_h, n_h, 1)
for m in self.modules():
self.weights_init(m)
def weights_init(self, m):
if isinstance(m, nn.Bilinear):
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... | usherbob/dgcnn.pytorch | Discriminator | false | 10,954 | [
"MIT"
] | 0 | fdf5f7a470123b292ac7642f65fd4f693d9b010d | https://github.com/usherbob/dgcnn.pytorch/tree/fdf5f7a470123b292ac7642f65fd4f693d9b010d |
AttentionLayer | import torch
import numpy as np
import torch.nn as nn
def init_xavier_normal(tensor):
param = nn.Parameter(tensor)
nn.init.xavier_normal_(param)
return param
class AttentionLayer(nn.Module):
def __init__(self, input_dim, hidden_dim=64, n_heads=3, dropout=0.5):
super(AttentionLayer, self).__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | vietbt/ViTextnormASR | AttentionLayer | false | 10,955 | [
"Apache-2.0"
] | 0 | 57444aa7247c67b2628d1802e9ed53dae4857ee4 | https://github.com/vietbt/ViTextnormASR/tree/57444aa7247c67b2628d1802e9ed53dae4857ee4 |
DiscrimNet | import torch
import torch.nn as nn
from torch.nn.init import kaiming_uniform_
def weight_init(m):
if m.__class__.__name__ == 'Linear':
m.weight.data.copy_(kaiming_uniform_(m.weight.data))
m.bias.data.fill_(0)
class DiscrimNet(nn.Module):
def __init__(self, ob_space, ac_space, h1=32, h2=32):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | ven-kyoshiro/PILCO-1 | DiscrimNet | false | 10,956 | [
"MIT"
] | 0 | 61c4ef18a6bbecbeb6a10784a7925d31f46dd23b | https://github.com/ven-kyoshiro/PILCO-1/tree/61c4ef18a6bbecbeb6a10784a7925d31f46dd23b |
Transformer | import torch
import torch.nn as nn
import torch.nn.functional as F
class Transformer(nn.Module):
def __init__(self, input_size):
super(Transformer, self).__init__()
self.fc1 = nn.Linear(input_size, 256)
self.fc2 = nn.Linear(256, 512)
self.parametrized_layers = [self.fc1, 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
import torch.nn as nn
assert_... | xuewanqi/RestoreNet | Transformer | false | 10,957 | [
"Apache-2.0"
] | 0 | fc313dc36965c2fab2c4cea9bf1227de75319439 | https://github.com/xuewanqi/RestoreNet/tree/fc313dc36965c2fab2c4cea9bf1227de75319439 |
LinearAdd | import torch
from torch import nn
import torch.cuda
import torch.backends.cudnn
import torch.backends.mkl
import torch.backends.cuda
import torch.backends.quantized
class LinearAdd(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(LinearAdd, self).__init__()
seed = 2018
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.cuda
import torch.backends.cudnn
import torch.... | yangw1234/intel-extension-for-pytorch | LinearAdd | false | 10,958 | [
"Apache-2.0"
] | 0 | 571e31578605ab3999dcebbb4d66a0ee2253a464 | https://github.com/yangw1234/intel-extension-for-pytorch/tree/571e31578605ab3999dcebbb4d66a0ee2253a464 |
KnowledgeDistillationKLDivLoss | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss ten... | 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 func... | xiangn95/mmclassification | KnowledgeDistillationKLDivLoss | false | 10,959 | [
"Apache-2.0"
] | 0 | 3a3307cd222fe5156a703cf5573e54dbb6692b10 | https://github.com/xiangn95/mmclassification/tree/3a3307cd222fe5156a703cf5573e54dbb6692b10 |
VNet | import torch
import torch.nn as nn
from torch.nn.init import kaiming_uniform_
import torch.nn.functional as F
def weight_init(m):
if m.__class__.__name__ == 'Linear':
m.weight.data.copy_(kaiming_uniform_(m.weight.data))
m.bias.data.fill_(0)
class VNet(nn.Module):
def __init__(self, ob_space... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | ven-kyoshiro/PILCO-1 | VNet | false | 10,960 | [
"MIT"
] | 0 | 61c4ef18a6bbecbeb6a10784a7925d31f46dd23b | https://github.com/ven-kyoshiro/PILCO-1/tree/61c4ef18a6bbecbeb6a10784a7925d31f46dd23b |
BinaryLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
class LearnableBias(nn.Module):
def __init__(self, out_chn):
super(LearnableBias, self).__init__()
self.bias = nn.Parameter(torch.zeros(out_chn), requires_grad=True)
def forward(self, x):
out = x + self.bias.expand_as... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | uzair789/pytorch-retinanet | BinaryLinear | false | 10,961 | [
"Apache-2.0"
] | 0 | cabac159a9877825ef04ab06d3b9a63bdfa4f306 | https://github.com/uzair789/pytorch-retinanet/tree/cabac159a9877825ef04ab06d3b9a63bdfa4f306 |
ModelNet | import torch
import torch.nn as nn
from torch.nn.init import kaiming_uniform_
import torch.nn.functional as F
def weight_init(m):
if m.__class__.__name__ == 'Linear':
m.weight.data.copy_(kaiming_uniform_(m.weight.data))
m.bias.data.fill_(0)
class ModelNet(nn.Module):
def __init__(self, ob_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | ven-kyoshiro/PILCO-1 | ModelNet | false | 10,962 | [
"MIT"
] | 0 | 61c4ef18a6bbecbeb6a10784a7925d31f46dd23b | https://github.com/ven-kyoshiro/PILCO-1/tree/61c4ef18a6bbecbeb6a10784a7925d31f46dd23b |
CausalSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
from torch.nn import functional as F
class CausalSelfAttention(nn.Module):
"""
A vanilla multi-head masked self-attention layer with a projection at the end.
It is possible to use torch.nn.MultiheadAttention here ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | wangyanqing7590/DeepLayout | CausalSelfAttention | false | 10,963 | [
"Apache-2.0"
] | 0 | cb181c725007e4e6c9710c4f6a15d246ee3e4f61 | https://github.com/wangyanqing7590/DeepLayout/tree/cb181c725007e4e6c9710c4f6a15d246ee3e4f61 |
HardBinaryConv | import torch
import torch.nn as nn
import torch.nn.functional as F
class HardBinaryConv(nn.Module):
def __init__(self, in_chn, out_chn, kernel_size=3, stride=1, padding=1):
super(HardBinaryConv, self).__init__()
self.stride = stride
self.padding = padding
self.number_of_weights = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | uzair789/pytorch-retinanet | HardBinaryConv | false | 10,964 | [
"Apache-2.0"
] | 0 | cabac159a9877825ef04ab06d3b9a63bdfa4f306 | https://github.com/uzair789/pytorch-retinanet/tree/cabac159a9877825ef04ab06d3b9a63bdfa4f306 |
BinaryActivation | import torch
import torch.nn as nn
class BinaryActivation(nn.Module):
def __init__(self):
super(BinaryActivation, self).__init__()
def forward(self, x):
out_forward = torch.sign(x)
mask1 = x < -1
mask2 = x < 0
mask3 = x < 1
out1 = -1 * mask1.type(torch.float32... | 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... | uzair789/pytorch-retinanet | BinaryActivation | false | 10,965 | [
"Apache-2.0"
] | 0 | cabac159a9877825ef04ab06d3b9a63bdfa4f306 | https://github.com/uzair789/pytorch-retinanet/tree/cabac159a9877825ef04ab06d3b9a63bdfa4f306 |
QNet | import torch
import torch.nn as nn
from torch.nn.init import kaiming_uniform_
from torch.nn.init import uniform_
import torch.nn.functional as F
def mini_weight_init(m):
if m.__class__.__name__ == 'Linear':
m.weight.data.copy_(uniform_(m.weight.data, -0.003, 0.003))
m.bias.data.fill_(0)
def weig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | ven-kyoshiro/PILCO-1 | QNet | false | 10,966 | [
"MIT"
] | 0 | 61c4ef18a6bbecbeb6a10784a7925d31f46dd23b | https://github.com/ven-kyoshiro/PILCO-1/tree/61c4ef18a6bbecbeb6a10784a7925d31f46dd23b |
SEModule | import torch
from torch import nn
import torch.utils.data
class SEModule(nn.Module):
def __init__(self, channel, reduction=4):
super().__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv1 = nn.Conv2d(in_channels=channel, out_channels=channel //
reduction, kernel_size=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | wangjian123799/L-DETR | SEModule | false | 10,967 | [
"Apache-2.0"
] | 0 | 5c21117666d31b45e94019f0a206f82a5cdefafc | https://github.com/wangjian123799/L-DETR/tree/5c21117666d31b45e94019f0a206f82a5cdefafc |
GlobalAvgPool2d | import torch
import torch.nn as nn
class GlobalAvgPool2d(nn.Module):
def __init__(self):
"""Global average pooling over the input's spatial dimensions"""
super(GlobalAvgPool2d, self).__init__()
def forward(self, inputs):
in_size = inputs.size()
inputs = inputs.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | tim885/DeepDepthRefiner | GlobalAvgPool2d | false | 10,968 | [
"MIT"
] | 0 | a59f376b5b0ff01b0d166ec8d946a20c81a6b190 | https://github.com/tim885/DeepDepthRefiner/tree/a59f376b5b0ff01b0d166ec8d946a20c81a6b190 |
ActorCritic | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class ActorCritic(nn.Module):
def __init__(self, num_states, num_actions, hidden_size):
super(ActorCritic, self).__init__()
self.num_actions ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rmfan/nni | ActorCritic | false | 10,969 | [
"MIT"
] | 0 | 727ee1ce47e070061fe3dab8a2da5d3cd5e55546 | https://github.com/rmfan/nni/tree/727ee1ce47e070061fe3dab8a2da5d3cd5e55546 |
BasicResidualBlock | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, bias=True, normalization=None, activation='prelu'):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | xiqi98/HRDN | BasicResidualBlock | false | 10,970 | [
"MIT"
] | 0 | 2140700ab5f3ab2e66678e808203cda68a137207 | https://github.com/xiqi98/HRDN/tree/2140700ab5f3ab2e66678e808203cda68a137207 |
linear_module | import torch
import torch.nn as nn
class linear_module(nn.Module):
"""Module of the linear model. Inherited from nn.Module"""
def __init__(self):
"""linear module init"""
super(linear_module, self).__init__()
self.a = nn.Parameter(torch.tensor(10.0))
self.b = nn.Parameter(torc... | 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... | yelingqun/toolkit_demos | linear_module | false | 10,971 | [
"MIT"
] | 0 | 12dd9431b2e306312c3b6059356be9a91b68409a | https://github.com/yelingqun/toolkit_demos/tree/12dd9431b2e306312c3b6059356be9a91b68409a |
PositionalEmbedding | import math
import torch
class PositionalEmbedding(torch.nn.Module):
def __init__(self):
super(PositionalEmbedding, self).__init__()
def forward(self, inputs):
if inputs.dim() != 3:
raise ValueError('The rank of input must be 3.')
length = inputs.shape[1]
channels... | 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... | yafuly/PromptNMT | PositionalEmbedding | false | 10,972 | [
"BSD-3-Clause"
] | 0 | 07b1daa7c7609d6f9035b4ac71b962c3c07b2f96 | https://github.com/yafuly/PromptNMT/tree/07b1daa7c7609d6f9035b4ac71b962c3c07b2f96 |
RGBDiff | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class RGBDiff(nn.Module):
def __init__(self, dim=1):
super().__init__()
self.dim = dim
def forward(self, image):
"""
Args:
image (torch.Tensor): (N x T 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 import nn
from torchvision import models as models
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards... | krodyush/training_extensions | RGBDiff | false | 10,973 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
ESA | import torch
from torch import nn
import torch.nn.functional as F
class ESA(nn.Module):
def __init__(self, channel=64, reduction=4, bias=True):
super(ESA, self).__init__()
self.r_nc = channel // reduction
self.conv1 = nn.Conv2d(channel, self.r_nc, kernel_size=1)
self.conv21 = 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... | samuro95/Prox-PnP | ESA | false | 10,974 | [
"MIT"
] | 0 | c05a48a586f0ef27c8ddc14e0a4c2c3d6814f8c9 | https://github.com/samuro95/Prox-PnP/tree/c05a48a586f0ef27c8ddc14e0a4c2c3d6814f8c9 |
GatedLinearUnit | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.dropout = nn.Dropout(dropout)
self.w4 = nn.Linear(input_size, outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torchvision import models as models
import torch.onnx
... | krodyush/training_extensions | GatedLinearUnit | false | 10,975 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.cuda
class Bottle(nn.Module):
def forward(self, input):
if len(input.size()) <= 2:
return super(Bottle, self).forward(input)
size = input.size()[:2]
out = super(Bottle, self).forward(input.view(size[0] * size[1], -1))
ret... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | wenh06/OpenAttack | PositionwiseFeedForward | false | 10,976 | [
"MIT"
] | 0 | 412d1b2777dea5009fe97ac264044bfda65dfa5d | https://github.com/wenh06/OpenAttack/tree/412d1b2777dea5009fe97ac264044bfda65dfa5d |
ScaledDotProductAttention | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout=0, scale=True):
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.softmax = nn.Softmax(dim=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.... | krodyush/training_extensions | ScaledDotProductAttention | false | 10,977 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
GLU | import torch
import torch.nn as nn
class GLU(nn.Module):
def __init__(self, in_dim):
super(GLU, self).__init__()
self.sigmoid = nn.Sigmoid()
self.linear = nn.Linear(in_dim, in_dim)
def forward(self, x):
lin = self.linear(x.permute(0, 2, 3, 1))
lin = lin.permute(0, 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | venisehannoyer/Hear-me-GirlsInAI-team1 | GLU | false | 10,978 | [
"Apache-2.0"
] | 0 | 664b3af4befe9b73c28d4362969699bc2254bdf9 | https://github.com/venisehannoyer/Hear-me-GirlsInAI-team1/tree/664b3af4befe9b73c28d4362969699bc2254bdf9 |
LengthPredictor | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class LengthPredictionLoss(nn.Module):
def __init__(self, max_delta=50):
super().__init__()
self.max_delta = max_delta
def forward(self, logits, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import function... | krodyush/training_extensions | LengthPredictor | false | 10,979 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
K1TemporalBlock | import torch
from torch import nn
from torch.nn.utils import weight_norm
class K1TemporalBlock(nn.Module):
def __init__(self, n_inputs, n_outputs, dropout=0.2):
super(K1TemporalBlock, self).__init__()
self.conv1 = weight_norm(nn.Conv1d(n_inputs, n_outputs, 1))
self.relu1 = 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.... | whdc/TCN | K1TemporalBlock | false | 10,980 | [
"MIT"
] | 0 | 182a57da7790a8ddb3a94cc3c33e1476551e0b54 | https://github.com/whdc/TCN/tree/182a57da7790a8ddb3a94cc3c33e1476551e0b54 |
PositionwiseFeedForward | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class Identity(nn.Module):
def forward(self, input_):
return input_
class LayerNormalization(nn.Module):
""" Layer normalization module """
def __init__(self, d_hid, eps=0.001):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | krodyush/training_extensions | PositionwiseFeedForward | false | 10,981 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
StateInitZero | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class StateInitZero(nn.Module):
def __init__(self, hidden_size, num_layers=1, batch_first=False):
super(StateInitZero, self).__init__()
self.hidden_size = hidden_size
self.num_laye... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards... | krodyush/training_extensions | StateInitZero | false | 10,982 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
CustomLSTMCell | import torch
import torch.nn as nn
class CustomLSTMCell(nn.Module):
def __init__(self, input_size, hidden_size):
super().__init__()
self.lstm = nn.LSTMCell(input_size, hidden_size)
def forward(self, x):
output = self.lstm(x)
return output[0]
def get_inputs():
return [to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | vr100/rl-trading | CustomLSTMCell | false | 10,983 | [
"MIT"
] | 0 | 0e3383e383bdfd46c40df65f3c709ba88169153c | https://github.com/vr100/rl-trading/tree/0e3383e383bdfd46c40df65f3c709ba88169153c |
GateAddNorm | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.dropout = nn.Dropout(dropout)
self.w4 = nn.Linear(input_size, outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | krodyush/training_extensions | GateAddNorm | false | 10,984 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
SpatialAttention | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class SpatialAttention(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.activation = nn.Sigmoid()
self.maxpool = nn.MaxPool2d((1, in_channels))
self.avg... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | krodyush/training_extensions | SpatialAttention | false | 10,985 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
LogitKLDivLoss | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class LogitKLDivLoss(nn.Module):
"""Kullback–Leibler divergence loss. Inputs predicted and ground truth logits.
Args:
T (float): Softmax temperature.
"... | 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 ... | krodyush/training_extensions | LogitKLDivLoss | false | 10,986 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
ResBlock | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class ResBlock(nn.Module):
def __init__(self, num_of_channels):
super(ResBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels=num_of_channels, out_channels=
num_of_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | krodyush/training_extensions | ResBlock | false | 10,987 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
DQN_RAM | import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN_RAM(nn.Module):
def __init__(self, in_features=4, num_actions=18):
"""
Initialize a deep Q-learning network for testing algorithm
in_features: number of features of input.
num_actions: number of a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | yepw/DQN-Atari | DQN_RAM | false | 10,988 | [
"MIT"
] | 0 | 4ea9f687cbfdbc25a241e9b8f26b86d56291278b | https://github.com/yepw/DQN-Atari/tree/4ea9f687cbfdbc25a241e9b8f26b86d56291278b |
CategoricalPolicyTwoLayer | import torch
import torch.nn.functional as F
import torch.distributions as td
import torch.nn as nn
class PolicyNetwork(nn.Module):
"""Base class for stochastic policy networks."""
def __init__(self):
super().__init__()
def forward(self, state):
"""Take state as input, then output the pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.distributions as... | wessle/costaware | CategoricalPolicyTwoLayer | false | 10,989 | [
"MIT"
] | 0 | 151502308411528eaa703d353d138fc809e59d8e | https://github.com/wessle/costaware/tree/151502308411528eaa703d353d138fc809e59d8e |
Mask | import torch
import torch.nn as nn
import torch.utils.data
class Mask(nn.Module):
def forward(self, seq, mask):
seq_mask = torch.unsqueeze(mask, 2)
seq_mask = torch.transpose(seq_mask.repeat(1, 1, seq.size()[1]), 1, 2)
return seq.where(torch.eq(seq_mask, 1), torch.zeros_like(seq))
def g... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | pkuyym/nni | Mask | false | 10,990 | [
"MIT"
] | 0 | fe533e3bc65ea27997e16250adb503638548d500 | https://github.com/pkuyym/nni/tree/fe533e3bc65ea27997e16250adb503638548d500 |
LinearARD | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Parameter
class LinearARD(nn.Module):
"""
Dense layer implementation with weights ARD-prior (arxiv:1701.05369)
"""
def __init__(self, in_features, out_features, bias=True, thresh=3,
ard_init=-10):
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | x-zho14/pytorch_ard | LinearARD | false | 10,991 | [
"MIT"
] | 0 | 5a9b790f33bf0340b2b3a2108c45d97786a2be86 | https://github.com/x-zho14/pytorch_ard/tree/5a9b790f33bf0340b2b3a2108c45d97786a2be86 |
Net | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 10, kernel_size=3)
self.conv2 = nn.Conv2d(10, 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.... | krodyush/training_extensions | Net | false | 10,992 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
CFRB | import torch
from torch import nn
from collections import OrderedDict
import torch.nn.functional as F
def sequential(*args):
"""Advanced nn.Sequential.
Args:
nn.Sequential, nn.Module
Returns:
nn.Sequential
"""
if len(args) == 1:
if isinstance(args[0], OrderedDict):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from col... | samuro95/Prox-PnP | CFRB | false | 10,993 | [
"MIT"
] | 0 | c05a48a586f0ef27c8ddc14e0a4c2c3d6814f8c9 | https://github.com/samuro95/Prox-PnP/tree/c05a48a586f0ef27c8ddc14e0a4c2c3d6814f8c9 |
ZeroLayer | import torch
import torch.nn as nn
import torch.utils.data
class ZeroLayer(nn.Module):
def __init__(self, stride):
super(ZeroLayer, self).__init__()
self.stride = stride
def forward(self, x):
"""n, c, h, w = x.size()
h //= self.stride
w //= self.stride
device ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | pkuyym/nni | ZeroLayer | false | 10,994 | [
"MIT"
] | 0 | fe533e3bc65ea27997e16250adb503638548d500 | https://github.com/pkuyym/nni/tree/fe533e3bc65ea27997e16250adb503638548d500 |
context_embedding | import torch
import torch.nn.functional as F
class CausalConv1d(torch.nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1, groups=1, bias=True):
super(CausalConv1d, self).__init__(in_channels, out_channels,
kernel_size=kernel_size, stride=stride... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.fun... | xingtaodhu/logdeep | context_embedding | false | 10,995 | [
"MIT"
] | 0 | 9626fa4b3345799940cb293c7aedb34dd33b5637 | https://github.com/xingtaodhu/logdeep/tree/9626fa4b3345799940cb293c7aedb34dd33b5637 |
SmallBlock | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class SmallBlock(nn.Module):
def __init__(self, channels):
super(SmallBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels=channels, out_channels=channels,
kernel_size=3,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | krodyush/training_extensions | SmallBlock | false | 10,996 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
DirichletPolicyTwoLayer | import torch
import numpy as np
import torch.nn.functional as F
import torch.distributions as td
import torch.nn as nn
class PolicyNetwork(nn.Module):
"""Base class for stochastic policy networks."""
def __init__(self):
super().__init__()
def forward(self, state):
"""Take state as 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
import numpy as np
import tor... | wessle/costaware | DirichletPolicyTwoLayer | false | 10,997 | [
"MIT"
] | 0 | 151502308411528eaa703d353d138fc809e59d8e | https://github.com/wessle/costaware/tree/151502308411528eaa703d353d138fc809e59d8e |
CausalConv1d | import torch
import torch.nn.functional as F
class CausalConv1d(torch.nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1, groups=1, bias=True):
super(CausalConv1d, self).__init__(in_channels, out_channels,
kernel_size=kernel_size, stride=stride... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | xingtaodhu/logdeep | CausalConv1d | false | 10,998 | [
"MIT"
] | 0 | 9626fa4b3345799940cb293c7aedb34dd33b5637 | https://github.com/xingtaodhu/logdeep/tree/9626fa4b3345799940cb293c7aedb34dd33b5637 |
LinearCombine | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class LinearCombine(nn.Module):
def __init__(self, layers_num, trainable=True, input_aware=False,
word_level=False):
super(LinearCombine, self).__init__()
self.input_aware = input_aware
self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch.... | pkuyym/nni | LinearCombine | false | 10,999 | [
"MIT"
] | 0 | fe533e3bc65ea27997e16250adb503638548d500 | https://github.com/pkuyym/nni/tree/fe533e3bc65ea27997e16250adb503638548d500 |
ToRGB | import torch
import torch.nn as nn
class ToRGB(nn.Module):
"""Some Information about ToRGB"""
def __init__(self, channels):
super(ToRGB, self).__init__()
self.conv = nn.Conv2d(channels, 3, kernel_size=1, stride=1, padding
=0, bias=True)
self.sigmoid = nn.Sigmoid()
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 torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | uthree/gan-image-generator | ToRGB | false | 11,000 | [
"MIT"
] | 0 | 85585e389b5a494393da0789d82824f8c811e263 | https://github.com/uthree/gan-image-generator/tree/85585e389b5a494393da0789d82824f8c811e263 |
FromRGB | import torch
import torch.nn as nn
class FromRGB(nn.Module):
"""Some Information about FromRGB"""
def __init__(self, channels):
super(FromRGB, self).__init__()
self.conv = nn.Conv2d(3, channels, kernel_size=1, stride=1, padding
=0, bias=True)
def forward(self, x):
ret... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | uthree/gan-image-generator | FromRGB | false | 11,001 | [
"MIT"
] | 0 | 85585e389b5a494393da0789d82824f8c811e263 | https://github.com/uthree/gan-image-generator/tree/85585e389b5a494393da0789d82824f8c811e263 |
GatedResidualNetwork | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.dropout = nn.Dropout(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.triton_helpers import libdevice
from torch import n... | krodyush/training_extensions | GatedResidualNetwork | false | 11,002 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
LearnableBias | import torch
import torch.nn as nn
class LearnableBias(nn.Module):
def __init__(self, out_chn):
super(LearnableBias, self).__init__()
self.bias = nn.Parameter(torch.zeros(out_chn), requires_grad=True)
def forward(self, x):
out = x + self.bias.expand_as(x)
return out
def get... | 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... | uzair789/pytorch-retinanet | LearnableBias | false | 11,003 | [
"Apache-2.0"
] | 0 | cabac159a9877825ef04ab06d3b9a63bdfa4f306 | https://github.com/uzair789/pytorch-retinanet/tree/cabac159a9877825ef04ab06d3b9a63bdfa4f306 |
DirichletPolicySingleLayer | import torch
import numpy as np
import torch.nn.functional as F
import torch.distributions as td
import torch.nn as nn
class PolicyNetwork(nn.Module):
"""Base class for stochastic policy networks."""
def __init__(self):
super().__init__()
def forward(self, state):
"""Take state as 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
import numpy as np
import tor... | wessle/costaware | DirichletPolicySingleLayer | false | 11,004 | [
"MIT"
] | 0 | 151502308411528eaa703d353d138fc809e59d8e | https://github.com/wessle/costaware/tree/151502308411528eaa703d353d138fc809e59d8e |
PinballLoss | import torch
import torch.nn as nn
class PinballLoss(nn.Module):
""" Pinball Loss
Computes the pinball loss between y and y_hat.
Parameters
----------
y: tensor
actual values in torch tensor.
y_hat: tensor (same shape as y)
predicted values in torch tensor.
tau: float, between 0 and 1
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | venkatkorapaty/esrnn | PinballLoss | false | 11,005 | [
"MIT"
] | 0 | 411d3191e7e12f29e521e06bc18f9b9b0fdf0f0c | https://github.com/venkatkorapaty/esrnn/tree/411d3191e7e12f29e521e06bc18f9b9b0fdf0f0c |
AdaptiveInstanceNormalization | import torch
import torch.nn as nn
class AdaptiveInstanceNormalization(nn.Module):
"""Some Information about AdaptiveInstanceNormalization"""
def __init__(self, channels, style_dim):
super(AdaptiveInstanceNormalization, self).__init__()
self.affine = nn.Linear(style_dim, channels * 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.triton_helpers import libdevice
import torch.nn as ... | uthree/gan-image-generator | AdaptiveInstanceNormalization | false | 11,006 | [
"MIT"
] | 0 | 85585e389b5a494393da0789d82824f8c811e263 | https://github.com/uthree/gan-image-generator/tree/85585e389b5a494393da0789d82824f8c811e263 |
upsampleBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def swish(x):
return x * F.sigmoid(x)
class upsampleBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(upsampleBlock, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
as... | tomron27/srganus | upsampleBlock | false | 11,007 | [
"Apache-2.0"
] | 0 | 5dab73540535138375203bf31e31246cd203f3c0 | https://github.com/tomron27/srganus/tree/5dab73540535138375203bf31e31246cd203f3c0 |
DisaggregatedPinballLoss | import torch
import torch.nn as nn
class DisaggregatedPinballLoss(nn.Module):
""" Pinball Loss
Computes the pinball loss between y and y_hat.
Parameters
----------
y: tensor
actual values in torch tensor.
y_hat: tensor (same shape as y)
predicted values in torch tensor.
tau: float, between 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... | venkatkorapaty/esrnn | DisaggregatedPinballLoss | false | 11,008 | [
"MIT"
] | 0 | 411d3191e7e12f29e521e06bc18f9b9b0fdf0f0c | https://github.com/venkatkorapaty/esrnn/tree/411d3191e7e12f29e521e06bc18f9b9b0fdf0f0c |
MegatronGelu | import torch
import torch.nn
import torch.onnx
class MegatronGelu(torch.nn.Module):
def forward(self, x):
return x * 0.5 * (torch.erf(x / 1.41421) + 1.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.triton_helpers import libdevice
import torch.nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.... | thilow/onnxruntime | MegatronGelu | false | 11,009 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
InteractiveKLLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class InteractiveKLLoss(nn.Module):
def __init__(self, temperature):
super().__init__()
self.temperature = temperature
self.kl_loss = nn.KLDivLoss()
def forward(self, student, teacher):
... | 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... | pkuyym/nni | InteractiveKLLoss | false | 11,010 | [
"MIT"
] | 0 | fe533e3bc65ea27997e16250adb503638548d500 | https://github.com/pkuyym/nni/tree/fe533e3bc65ea27997e16250adb503638548d500 |
LevelVariabilityLoss | import torch
import torch.nn as nn
class LevelVariabilityLoss(nn.Module):
""" Level Variability Loss
Computes the variability penalty for the level.
Parameters
----------
levels: tensor with shape (batch, n_time)
levels obtained from exponential smoothing component of ESRNN
level_variability_penalt... | 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... | venkatkorapaty/esrnn | LevelVariabilityLoss | false | 11,011 | [
"MIT"
] | 0 | 411d3191e7e12f29e521e06bc18f9b9b0fdf0f0c | https://github.com/venkatkorapaty/esrnn/tree/411d3191e7e12f29e521e06bc18f9b9b0fdf0f0c |
L1ExactPenaltyConstraintLoss | import torch
from torch import nn
from torch.nn import functional as F
class L1ExactPenaltyConstraintLoss(nn.Module):
def __init__(self):
super(L1ExactPenaltyConstraintLoss, self).__init__()
def forward(self, x):
gap_constraint = F.relu(x)
return torch.norm(gap_constraint, p=1)
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | ykt345/fairtorch | L1ExactPenaltyConstraintLoss | false | 11,012 | [
"MIT"
] | 0 | fe7e0cfaec3de0fc2b9c92943bb02639acd46bb4 | https://github.com/ykt345/fairtorch/tree/fe7e0cfaec3de0fc2b9c92943bb02639acd46bb4 |
L2PenaltyConstraintLoss | import torch
from torch import nn
from torch.nn import functional as F
class L2PenaltyConstraintLoss(nn.Module):
def __init__(self):
super(L2PenaltyConstraintLoss, self).__init__()
def forward(self, x):
gap_constraint = F.relu(x)
return torch.norm(gap_constraint, p=2)
def get_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | ykt345/fairtorch | L2PenaltyConstraintLoss | false | 11,013 | [
"MIT"
] | 0 | fe7e0cfaec3de0fc2b9c92943bb02639acd46bb4 | https://github.com/ykt345/fairtorch/tree/fe7e0cfaec3de0fc2b9c92943bb02639acd46bb4 |
MegatronFastGelu | import torch
import torch.nn
import torch.onnx
class MegatronFastGelu(torch.nn.Module):
def forward(self, x):
return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 +
0.044715 * x * x)))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.... | thilow/onnxruntime | MegatronFastGelu | false | 11,014 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
UpsampleBLock | import torch
import torch.nn as nn
import torch.utils.data
class UpsampleBLock(nn.Module):
def __init__(self, in_channels):
super(UpsampleBLock, self).__init__()
self.conv = nn.Conv2d(in_channels, in_channels * 2 ** 2,
kernel_size=3, padding=1)
self.pixel_shuffle = nn.PixelShu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dyn... | tomron27/srganus | UpsampleBLock | false | 11,015 | [
"Apache-2.0"
] | 0 | 5dab73540535138375203bf31e31246cd203f3c0 | https://github.com/tomron27/srganus/tree/5dab73540535138375203bf31e31246cd203f3c0 |
HuggingfaceFastGelu | import torch
import torch.nn
import torch.onnx
class HuggingfaceFastGelu(torch.nn.Module):
def forward(self, x):
return 0.5 * x * (1.0 + torch.tanh(x * 0.7978845608 * (1.0 +
0.044715 * x * x)))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[],... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.... | thilow/onnxruntime | HuggingfaceFastGelu | false | 11,016 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
NeuralNetNonDifferentiableOutput | import torch
import torch.nn
import torch.onnx
class NeuralNetNonDifferentiableOutput(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNetNonDifferentiableOutput, self).__init__()
self.fc1 = torch.nn.Linear(input_size, hidden_size)
self.relu = torch.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn
import torch.... | thilow/onnxruntime | NeuralNetNonDifferentiableOutput | false | 11,017 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
TemperatureHolder | import torch
from torch import nn
class TemperatureHolder(nn.Module):
"""Module that holds a temperature as a learnable value.
Args:
initial_log_temperature (float): Initial value of log(temperature).
"""
def __init__(self, initial_log_temperature=0):
super().__init__()
self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | tarokiritani/pfrl | TemperatureHolder | false | 11,018 | [
"MIT"
] | 0 | 284ed1f43b32654a2ec1569b16a0f6b9acbd5e79 | https://github.com/tarokiritani/pfrl/tree/284ed1f43b32654a2ec1569b16a0f6b9acbd5e79 |
NeuralNetMultiplePositionalArguments | import torch
import torch.nn
import torch.onnx
class NeuralNetMultiplePositionalArguments(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNetMultiplePositionalArguments, self).__init__()
self.fc1 = torch.nn.Linear(input_size, hidden_size)
self.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
import torch.nn
import torch.... | thilow/onnxruntime | NeuralNetMultiplePositionalArguments | false | 11,019 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency | import torch
import torch.nn
import torch.onnx
class NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency(torch
.nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn
import torch.... | thilow/onnxruntime | NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency | false | 11,020 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
FeedForwardLayer | import torch
from torch import nn
class FeedForwardLayer(nn.Module):
def __init__(self, hidden_size):
super(FeedForwardLayer, self).__init__()
self.linear_1 = nn.Linear(hidden_size, 4 * hidden_size)
self.linear_2 = nn.Linear(4 * hidden_size, hidden_size)
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 import nn
assert_s... | yongho94/Transformers_NMT | FeedForwardLayer | false | 11,021 | [
"MIT"
] | 0 | 14fb08a6b1391da4d49f199dc16d7beb37620c98 | https://github.com/yongho94/Transformers_NMT/tree/14fb08a6b1391da4d49f199dc16d7beb37620c98 |
NeuralNetPartialNoGradModel | import torch
import torch.nn
import torch.onnx
class NeuralNetPartialNoGradModel(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNetPartialNoGradModel, self).__init__()
self.fc1 = torch.nn.Linear(input_size, hidden_size).requires_grad_(
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
import torch.nn
import torch.... | thilow/onnxruntime | NeuralNetPartialNoGradModel | false | 11,022 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
ModMSELoss | import torch
class ModMSELoss(torch.nn.Module):
def __init__(self, shape_r_gt, shape_c_gt):
super(ModMSELoss, self).__init__()
self.shape_r_gt = shape_r_gt
self.shape_c_gt = shape_c_gt
def forward(self, output, label, prior):
prior_size = prior.shape
output_max = torc... | 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... | yyuting/learning_from_program_trace | ModMSELoss | false | 11,023 | [
"MIT"
] | 0 | e0e4ac9bc2d4069eef64bdc2de64a87a735fa508 | https://github.com/yyuting/learning_from_program_trace/tree/e0e4ac9bc2d4069eef64bdc2de64a87a735fa508 |
PositionWiseFeedForward | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.dropout = nn.Dropout(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.triton_helpers import libdevice
from torch.nn impor... | krodyush/training_extensions | PositionWiseFeedForward | false | 11,024 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency | import torch
import torch.nn
import torch.onnx
class NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency(torch.
nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency,
self).__init__()
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn
import torch.... | thilow/onnxruntime | NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency | false | 11,025 | [
"MIT"
] | 0 | 1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 | https://github.com/thilow/onnxruntime/tree/1a3ddf0714e1bdf9b807a342eee5f6e160ad1ec9 |
BertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""LayerNormalization層です。
学習済みモデルをそのままロードするため、学習済みモデルの変数名に変えています。
オリジナルのGitHubの実装から変数名を変えています。
weight→gamma、bias→beta
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Cyndi-Tokyotech/Fin_Text_Analysis_ML | BertOutput | false | 11,026 | [
"MIT"
] | 0 | 7f9b6c1ea78f8e6f32c003b2de32809722df88d4 | https://github.com/Cyndi-Tokyotech/Fin_Text_Analysis_ML/tree/7f9b6c1ea78f8e6f32c003b2de32809722df88d4 |
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.... | wenjunyoung/PAN_PLUS | MultiHeadAttentionLayer | false | 11,027 | [
"Apache-2.0"
] | 0 | c893ff4775c8ff137a21c15d34fb93b9394dbfe5 | https://github.com/wenjunyoung/PAN_PLUS/tree/c893ff4775c8ff137a21c15d34fb93b9394dbfe5 |
UpsampleConvLayer | import torch
class UpsampleConvLayer(torch.nn.Module):
"""UpsampleConvLayer
Upsamples the input and then does a convolution. This method gives better results
compared to ConvTranspose2d.
ref: http://distill.pub/2016/deconv-checkerboard/
"""
def __init__(self, in_channels, out_channels, kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | yuweiliandrew/openrtist | UpsampleConvLayer | false | 11,028 | [
"Apache-2.0"
] | 0 | 4b6b17e77587751593d5e529b154e60513de3236 | https://github.com/yuweiliandrew/openrtist/tree/4b6b17e77587751593d5e529b154e60513de3236 |
Attention | import torch
def activation_func(name):
name = name.lower()
if name == 'sigmoid':
return torch.nn.Sigmoid()
elif name == 'tanh':
return torch.nn.Tanh()
elif name == 'relu':
return torch.nn.ReLU()
elif name == 'softmax':
return torch.nn.Softmax()
elif name == 'le... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xu94-nlp/Code-for-MAMO | Attention | false | 11,029 | [
"Apache-2.0"
] | 0 | d9c6655e0660976c90c07fa096a1f5dc8328a60b | https://github.com/xu94-nlp/Code-for-MAMO/tree/d9c6655e0660976c90c07fa096a1f5dc8328a60b |
AngleSimpleLinear | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
from torch.nn import Parameter
from torch.nn.parameter import Parameter
import torch.onnx
import torch.nn
class AngleSimpleLinear(nn.Module):
"""Computes cos of angles between input vectors and weights ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | krodyush/training_extensions | AngleSimpleLinear | false | 11,030 | [
"Apache-2.0"
] | 0 | 542f4004dfbc6fc62a622065367ba4f85a703dd3 | https://github.com/krodyush/training_extensions/tree/542f4004dfbc6fc62a622065367ba4f85a703dd3 |
FCLateActionSAQFunction | import torch
import numpy as np
from torch import nn
from abc import ABCMeta
from abc import abstractmethod
import torch.nn.functional as F
def init_lecun_normal(tensor, scale=1.0):
"""Initializes the tensor with LeCunNormal."""
fan_in = torch.nn.init._calculate_correct_fan(tensor, 'fan_in')
std = scale *... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
from torch... | tarokiritani/pfrl | FCLateActionSAQFunction | false | 11,031 | [
"MIT"
] | 0 | 284ed1f43b32654a2ec1569b16a0f6b9acbd5e79 | https://github.com/tarokiritani/pfrl/tree/284ed1f43b32654a2ec1569b16a0f6b9acbd5e79 |
conv_head_pooling | import torch
import torch.nn as nn
class conv_head_pooling(nn.Module):
def __init__(self, in_feature, out_feature, stride, conv_type,
padding_mode='zeros', dilation=1):
super(conv_head_pooling, self).__init__()
if conv_type == 'depthwise':
_groups = in_feature
else:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | yasarniyazoglu/d2go | conv_head_pooling | false | 11,032 | [
"Apache-2.0"
] | 0 | 308c2700c51c70a7a928d99a477b64e856d1ed5e | https://github.com/yasarniyazoglu/d2go/tree/308c2700c51c70a7a928d99a477b64e856d1ed5e |
MultiHeadAttention | import torch
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperatur... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yshen47/mvsnerf | MultiHeadAttention | false | 11,033 | [
"MIT"
] | 0 | 38ab4cf4fc5d025a9ad04e4a801b501ea9a78fb4 | https://github.com/yshen47/mvsnerf/tree/38ab4cf4fc5d025a9ad04e4a801b501ea9a78fb4 |
topk_PAM_Module | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn.modules.module import Module
def mask_softmax(input, mask=None, dim=-1):
"""Applies a softmax function.
Softmax is defined as:
:math:`\\text{Softmax}(x_{i}) = \\frac{exp(x_i)}{\\sum_j exp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yougoforward/OCNet1931 | topk_PAM_Module | false | 11,034 | [
"MIT"
] | 0 | e679e9f248aff2f06e1d983e4e30230e5fc5174f | https://github.com/yougoforward/OCNet1931/tree/e679e9f248aff2f06e1d983e4e30230e5fc5174f |
Classifier | import torch
import torch.nn as nn
import torch.nn.functional as F
class Classifier(nn.Module):
def __init__(self, inputs, hidden_units):
super().__init__()
self.hidden = nn.Linear(inputs, hidden_units)
self.output = nn.Linear(hidden_units, 102)
self.dropout = nn.Dropout(p=0.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.... | zamerman/Udacity-AI-Programming | Classifier | false | 11,035 | [
"MIT"
] | 0 | 6537f273fb00531d448330c1c85886d86e1161d2 | https://github.com/zamerman/Udacity-AI-Programming/tree/6537f273fb00531d448330c1c85886d86e1161d2 |
UnaryBlock | import torch
import torch.utils.data
import torch.nn as nn
from torch.nn.parameter import Parameter
class BatchNormBlock(nn.Module):
def __init__(self, in_dim, use_bn, bn_momentum):
"""
Initialize a batch normalization block. If network does not use batch normalization, replace with biases.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.... | wuxingzhe/OverPredactor | UnaryBlock | false | 11,036 | [
"MIT"
] | 0 | 3a0965f4c3fc84ec0dcba555ec7c460f265d9143 | https://github.com/wuxingzhe/OverPredactor/tree/3a0965f4c3fc84ec0dcba555ec7c460f265d9143 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
"""Estimation of the nonnegative mixture weight by a 1-D conv layer.
"""
def __init__(self, L, N):
super(Encoder, self).__init__()
self.L, self.N = L, N
self.conv1d_U = nn.Conv1d(1, N, ker... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | zhangxinaaaa/Conv-TasNet | Encoder | false | 11,037 | [
"MIT"
] | 0 | 4622d93d0b9dbe23584addd4f4b9463255651652 | https://github.com/zhangxinaaaa/Conv-TasNet/tree/4622d93d0b9dbe23584addd4f4b9463255651652 |
Conv2d_dilated | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
from torch.nn.modules.utils import _pair
def same_padding_length(input_length, filter_size, stride, dilation=1):
dilated_filter_size = filter_size + (filter_size - 1) * (dilation - 1)
output_length = (... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | xwjBupt/Counting-ICCV-DSSINet | Conv2d_dilated | false | 11,038 | [
"MIT"
] | 0 | 92e4c56c93572fb2b026d573c3e711ce85a4af8f | https://github.com/xwjBupt/Counting-ICCV-DSSINet/tree/92e4c56c93572fb2b026d573c3e711ce85a4af8f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.