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 |
|---|---|---|---|---|---|---|---|---|---|---|
TransformerEncoderLayer | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
"""Multi-Head Attention module."""
def __init__(self, n_head=8, d_model=512, d_k=64, d_v=64, dropout=0.1,
qkv_bias=False, mask_value=0):
super().__init__()
self.mask_value = mask_value
self.n_head = n_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NceBoy/mmocr | TransformerEncoderLayer | false | 11,752 | [
"Apache-2.0"
] | 0 | 3fb7a18d7eb44799e75c1991e5da2044b458d411 | https://github.com/NceBoy/mmocr/tree/3fb7a18d7eb44799e75c1991e5da2044b458d411 |
Normalize | import torch
import torch.nn as nn
class Normalize(nn.Module):
def __init__(self, features, epsilon=1e-06):
super(Normalize, self).__init__()
self.gain = nn.Parameter(torch.ones(features))
self.bias = nn.Parameter(torch.zeros(features))
self.epsilon = epsilon
def forward(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 libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | NingNing-C/neurips19-graph-protein-design | Normalize | false | 11,753 | [
"MIT"
] | 0 | 9daba22083c04ad2528aed47f4b5dc97e2951132 | https://github.com/NingNing-C/neurips19-graph-protein-design/tree/9daba22083c04ad2528aed47f4b5dc97e2951132 |
DQN | import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
def __init__(self, state_size, action_size):
super(DQN, self).__init__()
self.fc1 = nn.Linear(state_size, 30)
self.fc2 = nn.Linear(30, 10)
self.fc3 = nn.Linear(10, action_size)
def forwar... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | NickHclos/DDPG-PyTorch | DQN | false | 11,754 | [
"MIT"
] | 0 | 9f6df328c275ff5c579fa0e4f7b30ab234cf236d | https://github.com/NickHclos/DDPG-PyTorch/tree/9f6df328c275ff5c579fa0e4f7b30ab234cf236d |
DAFAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
def masked_softmax(logits, mask, dim=-1, log_softmax=False):
"""Take the softmax of `logits` over given dimension, and set
entries to 0 wherever `mask` is 0.
Args:
logits (torch.Tensor): Inputs to the softmax function.
mas... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NicholasPaulBrazeauSanchez/squad | DAFAttention | false | 11,755 | [
"MIT"
] | 0 | 7343f41b186f1647e474824e5035c8dd639028b2 | https://github.com/NicholasPaulBrazeauSanchez/squad/tree/7343f41b186f1647e474824e5035c8dd639028b2 |
GEGLU | import torch
from torch import nn
import torch.nn.functional as F
class GEGLU(nn.Module):
def forward(self, x):
x, gates = x.chunk(2, dim=-1)
return x * F.gelu(gates)
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | NomadicDaggy/DALLE-pytorch | GEGLU | false | 11,756 | [
"MIT"
] | 0 | ecadc12e8063763ad45de50773e5c746262cdfd3 | https://github.com/NomadicDaggy/DALLE-pytorch/tree/ecadc12e8063763ad45de50773e5c746262cdfd3 |
MNIST_CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class SqueezeLastTwo(nn.Module):
"""A module which squeezes the last two dimensions, ordinary squeeze can be a problem for batch size 1"""
def __init__(self):
super(SqueezeLastTwo, self).__init__()
def for... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Neronjust2017/DomainBed | MNIST_CNN | false | 11,757 | [
"MIT"
] | 0 | 42be49a316a74799b95d6a5e29bb210477c7f828 | https://github.com/Neronjust2017/DomainBed/tree/42be49a316a74799b95d6a5e29bb210477c7f828 |
BoundSin | from _paritybench_helpers import _mock_config
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from numbers import Number
from torch.nn import MSELoss
def isnan(x):
if isinstance(x, Patches):
return False
return torch.isnan(x).any()
class Perturbation... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
import numpy as np
import torch.nn as nn
import torch.nn.func... | Mahoumaru/auto_LiRPA | BoundSin | false | 11,758 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
Mutan | import torch
import torch.nn as nn
import torch.nn.functional as F
class Mutan(nn.Module):
def __init__(self, input_dims, output_dim, mm_dim=1600, rank=15, shared
=False, normalize=False, dropout_input=0.0, dropout_pre_lin=0.0,
dropout_output=0.0):
super(Mutan, self).__init__()
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | JoannaLXY/block.bootstrap.pytorch | Mutan | false | 11,759 | [
"BSD-3-Clause"
] | 0 | 42c3e7616b704e05c6ff2376ff68b5b18044fe77 | https://github.com/JoannaLXY/block.bootstrap.pytorch/tree/42c3e7616b704e05c6ff2376ff68b5b18044fe77 |
CRF | import torch
import torch.utils.data.dataloader
import torch.nn
class CRF(torch.nn.Module):
"""
Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod).
Classifier which predicts single tag / class / label for given word based on not just the word,
but also on previ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data.dataloader
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | OatsProduction/flair | CRF | false | 11,760 | [
"MIT"
] | 0 | 1cf2c9a9ae487e279dce9f6b92c41fa32c4563cf | https://github.com/OatsProduction/flair/tree/1cf2c9a9ae487e279dce9f6b92c41fa32c4563cf |
PairwiseBCELoss | import torch
from abc import abstractmethod
import torch.utils.data.dataloader
import torch.nn.functional as F
from torch import nn
import torch.nn
class SimilarityLoss(nn.Module):
def __init__(self):
super(SimilarityLoss, self).__init__()
@abstractmethod
def forward(self, inputs, targets):
... | 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 abc im... | OatsProduction/flair | PairwiseBCELoss | false | 11,761 | [
"MIT"
] | 0 | 1cf2c9a9ae487e279dce9f6b92c41fa32c4563cf | https://github.com/OatsProduction/flair/tree/1cf2c9a9ae487e279dce9f6b92c41fa32c4563cf |
RankingLoss | import torch
from abc import abstractmethod
import torch.utils.data.dataloader
import torch.nn.functional as F
from torch import nn
import torch.nn
class SimilarityLoss(nn.Module):
def __init__(self):
super(SimilarityLoss, self).__init__()
@abstractmethod
def forward(self, inputs, targets):
... | 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 abc import abstractmethod
import torch.utils.data.dataloader
from torch import nn
im... | OatsProduction/flair | RankingLoss | false | 11,762 | [
"MIT"
] | 0 | 1cf2c9a9ae487e279dce9f6b92c41fa32c4563cf | https://github.com/OatsProduction/flair/tree/1cf2c9a9ae487e279dce9f6b92c41fa32c4563cf |
FrameAvgPool | from _paritybench_helpers import _mock_config
import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class FrameAvgPool(nn.Module):
def __init__(self, cfg):
super(FrameAvgPool, self).__init__()
input_size = cfg.INPUT_SIZE
hidden_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.parallel
impo... | MicroTensor-ai/episodic-memory | FrameAvgPool | false | 11,763 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
RobertaClassificationHead | import torch
import torch.nn as nn
from typing import Optional
class RobertaClassificationHead(nn.Module):
def __init__(self, num_classes, input_dim, inner_dim: 'Optional[int]'=
None, dropout: 'float'=0.1, activation=nn.ReLU):
super().__init__()
if not inner_dim:
inner_dim = i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from ty... | NivekT/text | RobertaClassificationHead | false | 11,764 | [
"BSD-3-Clause"
] | 0 | 4908d3c88f92296a4c23be2f064ccde13cce50ce | https://github.com/NivekT/text/tree/4908d3c88f92296a4c23be2f064ccde13cce50ce |
SpatialGather_Module | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch._utils
class SpatialGather_Module(nn.Module):
"""
Aggregate the context features according to the initial
predicted probability distribution.
Employ the soft-weighted method to aggregate the context.
O... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NikV-JS/semantic-segmentation | SpatialGather_Module | false | 11,765 | [
"BSD-3-Clause"
] | 0 | 68fd9ddc5498590371f064c8bebb03ac80932766 | https://github.com/NikV-JS/semantic-segmentation/tree/68fd9ddc5498590371f064c8bebb03ac80932766 |
TextProcessor | import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
def reset_parameters_util(model):
pass
class TextProcessor(nn.Module):
"""Processes sentence representations to the correct hidden dimension"""
def __init__(self, desc_dim, hid_dim):
super(Te... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | OfirShechter/NLPMultimodalGame | TextProcessor | false | 11,766 | [
"BSD-3-Clause"
] | 0 | 79bd8476da0c2f3185ed7241932bc1165558917b | https://github.com/OfirShechter/NLPMultimodalGame/tree/79bd8476da0c2f3185ed7241932bc1165558917b |
InnerProductDecoder | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.modules.loss
class InnerProductDecoder(nn.Module):
"""Decoder for using inner product for prediction."""
def __init__(self, dropout, act=torch.sigmoid):
super(InnerProductDecoder, self).__init__()
self.dropout ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.modules.loss
assert_size_stride = torch._C... | PatriciaXiao/gae-pytorch | InnerProductDecoder | false | 11,767 | [
"MIT"
] | 0 | eb0e9bdf9a2f23d38941ac731bd481bd6da737b9 | https://github.com/PatriciaXiao/gae-pytorch/tree/eb0e9bdf9a2f23d38941ac731bd481bd6da737b9 |
ResidualConvUnit | import torch
import torch.nn as nn
class ResidualConvUnit(nn.Module):
"""Residual convolution module.
"""
def __init__(self, features):
"""Init.
Args:
features (int): number of features
"""
super().__init__()
self.conv1 = nn.Conv2d(features, 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
import torch.nn as nn
assert_... | Northshoot/3d-photo-inpainting | ResidualConvUnit | false | 11,768 | [
"MIT"
] | 0 | 49dd36ce4a277929831f09d978721b3fdb87eb25 | https://github.com/Northshoot/3d-photo-inpainting/tree/49dd36ce4a277929831f09d978721b3fdb87eb25 |
MultiheadAttention | import torch
import torch.nn.functional as F
import torch.utils.data
from torch import nn
from torch.nn import Parameter
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class MultiheadAttention(nn.Module):
"""Multi-headed attention.
See "Attention Is All You Need" for more deta... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Novemser/fairseq | MultiheadAttention | false | 11,769 | [
"BSD-3-Clause"
] | 0 | b9e29a4711a6c0b7923879d5d59f3e879f0f228a | https://github.com/Novemser/fairseq/tree/b9e29a4711a6c0b7923879d5d59f3e879f0f228a |
RewardEstimator | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
def reset_parameters_util(model):
pass
class RewardEstimator(nn.Module):
"""Estimates the reward the agent will receieved. Value used as a baseline in REINFORCE loss"""
def __init__(self,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.util... | OfirShechter/NLPMultimodalGame | RewardEstimator | false | 11,770 | [
"BSD-3-Clause"
] | 0 | 79bd8476da0c2f3185ed7241932bc1165558917b | https://github.com/OfirShechter/NLPMultimodalGame/tree/79bd8476da0c2f3185ed7241932bc1165558917b |
Encoder | import torch
from torch import 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, kernel_size, enc_dim, audio_channels):
super(Encoder, self).__init__()
self.conv1d_U = nn.Conv1d(audio_ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | PanagiotisP/demucs | Encoder | false | 11,771 | [
"MIT"
] | 0 | d115d0773ca08a081f5b6bfe274cf0e4ed9e2677 | https://github.com/PanagiotisP/demucs/tree/d115d0773ca08a081f5b6bfe274cf0e4ed9e2677 |
PartialConv | import math
import torch
import torch.nn as nn
def weights_init(init_type='gaussian'):
def init_fun(m):
classname = m.__class__.__name__
if (classname.find('Conv') == 0 or classname.find('Linear') == 0
) and hasattr(m, 'weight'):
if init_type == 'gaussian':
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dynamo.guards.a... | Northshoot/3d-photo-inpainting | PartialConv | false | 11,772 | [
"MIT"
] | 0 | 49dd36ce4a277929831f09d978721b3fdb87eb25 | https://github.com/Northshoot/3d-photo-inpainting/tree/49dd36ce4a277929831f09d978721b3fdb87eb25 |
Baseline | import torch
import torch.utils.data
import torch
import torch.nn as nn
class Baseline(nn.Module):
"""Baseline
"""
def __init__(self, hid_dim, x_dim, binary_dim, inp_dim):
super(Baseline, self).__init__()
self.x_dim = x_dim
self.binary_dim = binary_dim
self.inp_dim = inp_d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | OfirShechter/NLPMultimodalGame | Baseline | false | 11,773 | [
"BSD-3-Clause"
] | 0 | 79bd8476da0c2f3185ed7241932bc1165558917b | https://github.com/OfirShechter/NLPMultimodalGame/tree/79bd8476da0c2f3185ed7241932bc1165558917b |
CanineSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
class CanineSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if (config.hidden_size % config.num_attention_heads != 0 and not
hasattr(confi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Clemens123/transformers | CanineSelfAttention | false | 11,774 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
ResidualBlock | import torch
from torch import nn
import torch.nn.functional as F
class ResidualBlock(nn.Module):
"""
Residual block from R2D3/IMPALA
Taken from [1,2]
"""
def __init__(self, num_channels, first_conv_weight_scale):
super().__init__()
self.conv1 = nn.Conv2d(num_channels, num_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 import nn
assert_s... | Oliver-Tautz/minecraft-bc-2020 | ResidualBlock | false | 11,775 | [
"MIT"
] | 0 | d18ba1c1afbf92f897e4bbe70c2c71292510f928 | https://github.com/Oliver-Tautz/minecraft-bc-2020/tree/d18ba1c1afbf92f897e4bbe70c2c71292510f928 |
OutConv | import torch
import torch.nn as nn
class OutConv(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutConv, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1)
self.softmax = nn.Softmax(dim=1)
def forward(self, x):
tmp = self.conv(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.... | Orelbenr/acoustic-fencing | OutConv | false | 11,776 | [
"MIT"
] | 0 | 2d8c6121c915d2f12fae3c9d776e6339f028e35a | https://github.com/Orelbenr/acoustic-fencing/tree/2d8c6121c915d2f12fae3c9d776e6339f028e35a |
GraphConvolution | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
import torch.nn.modules.loss
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | PatriciaXiao/gae-pytorch | GraphConvolution | false | 11,777 | [
"MIT"
] | 0 | eb0e9bdf9a2f23d38941ac731bd481bd6da737b9 | https://github.com/PatriciaXiao/gae-pytorch/tree/eb0e9bdf9a2f23d38941ac731bd481bd6da737b9 |
GCNModelVAE | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
import torch.nn as nn
import torch.nn.modules.loss
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | PatriciaXiao/gae-pytorch | GCNModelVAE | false | 11,778 | [
"MIT"
] | 0 | eb0e9bdf9a2f23d38941ac731bd481bd6da737b9 | https://github.com/PatriciaXiao/gae-pytorch/tree/eb0e9bdf9a2f23d38941ac731bd481bd6da737b9 |
BothContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | PiescesHusky/OpenNMT-py | BothContextGate | false | 11,779 | [
"MIT"
] | 0 | 7276cf94f989c50b3169742f64e64142897d1ec0 | https://github.com/PiescesHusky/OpenNMT-py/tree/7276cf94f989c50b3169742f64e64142897d1ec0 |
ContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_str... | PiescesHusky/OpenNMT-py | ContextGate | false | 11,780 | [
"MIT"
] | 0 | 7276cf94f989c50b3169742f64e64142897d1ec0 | https://github.com/PiescesHusky/OpenNMT-py/tree/7276cf94f989c50b3169742f64e64142897d1ec0 |
TargetContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | PiescesHusky/OpenNMT-py | TargetContextGate | false | 11,781 | [
"MIT"
] | 0 | 7276cf94f989c50b3169742f64e64142897d1ec0 | https://github.com/PiescesHusky/OpenNMT-py/tree/7276cf94f989c50b3169742f64e64142897d1ec0 |
SourceContextGate | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ContextGate(nn.Module):
"""
Context gate is a decoder module that takes as input the previous word
embedding, the current decoder state and the attention state, and
produces a gate.
The gate can be used to select t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | PiescesHusky/OpenNMT-py | SourceContextGate | false | 11,782 | [
"MIT"
] | 0 | 7276cf94f989c50b3169742f64e64142897d1ec0 | https://github.com/PiescesHusky/OpenNMT-py/tree/7276cf94f989c50b3169742f64e64142897d1ec0 |
relu | import torch
import torch.nn.functional as F
from torch import nn
class relu(nn.Module):
def forward(self, x):
return F.relu(x, inplace=True)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@t... | PistonY/MobileNetV3.pytorch | relu | false | 11,783 | [
"MIT"
] | 0 | 9dc56359247d8a63a9a392bb51183ba0f8a94f33 | https://github.com/PistonY/MobileNetV3.pytorch/tree/9dc56359247d8a63a9a392bb51183ba0f8a94f33 |
Hswish | import torch
import torch.nn as nn
import torch.nn.functional as F
from itertools import product as product
class Hswish(nn.Module):
def __init__(self, inplace=True):
super(Hswish, self).__init__()
self.inplace = inplace
def forward(self, x):
return x * F.relu6(x + 3.0, inplace=self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from itertools import product as product
assert_size_stride = torch... | PoWeiChiao/3DDFA_V2 | Hswish | false | 11,784 | [
"MIT"
] | 0 | 5b4ae883705a1f5b1f15c19203bedbd47fc8a832 | https://github.com/PoWeiChiao/3DDFA_V2/tree/5b4ae883705a1f5b1f15c19203bedbd47fc8a832 |
ConvReLUNorm | import torch
from torch.nn import functional as F
from torch import nn
import torch.utils.data
import torch.optim
class ConvReLUNorm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0):
super(ConvReLUNorm, self).__init__()
self.conv = nn.Conv1d(in_channels, out_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.... | PiotrDabkowski/NeMo | ConvReLUNorm | false | 11,785 | [
"Apache-2.0"
] | 0 | 7c251e9035b24136cf130f3caf760087e5ccf07c | https://github.com/PiotrDabkowski/NeMo/tree/7c251e9035b24136cf130f3caf760087e5ccf07c |
LayerNorm1D | import torch
import torch.nn as nn
class LayerNorm1D(nn.Module):
def __init__(self, num_outputs, eps=1e-05, affine=True):
super(LayerNorm1D, self).__init__()
self.eps = eps
self.weight = nn.Parameter(torch.ones(1, num_outputs))
self.bias = nn.Parameter(torch.zeros(1, num_outputs))... | 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_... | Pluriscient/learn-to-learn | LayerNorm1D | false | 11,786 | [
"MIT"
] | 0 | 4aa0143522eb90f6439b83ed424d12b434cb344b | https://github.com/Pluriscient/learn-to-learn/tree/4aa0143522eb90f6439b83ed424d12b434cb344b |
FC1 | import torch
import torch.nn as nn
class FC1(nn.Module):
def __init__(self, nInput, activate, weight):
super(FC1, self).__init__()
self.nInput = nInput
self.fc1 = nn.Linear(self.nInput, self.nInput * 2)
self.fc2 = nn.Linear(self.nInput * 2, self.nInput)
self.fc3 = nn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Po-Chun-Chien/LUT-Net | FC1 | false | 11,787 | [
"MIT"
] | 0 | 413559027980db2585d939cd4a514a172b62f57d | https://github.com/Po-Chun-Chien/LUT-Net/tree/413559027980db2585d939cd4a514a172b62f57d |
DecoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def scaled_dot_product_attention(query, keys, values, mask=None):
d_k = keys.shape[-1]
dot_score = query @ keys.transpose(-2, -1) / math.sqrt(d_k)
if mask is not None:
dot_score = dot_score.masked_fill(mask == 0, -10000... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NathanYanJing/TransformerReplication | DecoderLayer | false | 11,788 | [
"MIT"
] | 0 | b20f987dcc507724971f843c2d214c9c76bd8e34 | https://github.com/NathanYanJing/TransformerReplication/tree/b20f987dcc507724971f843c2d214c9c76bd8e34 |
MaskedInstanceNorm1d | import torch
from torch import nn
import torch.utils.data
import torch.optim
class MaskedInstanceNorm1d(nn.Module):
"""Instance norm + masking."""
MAX_CNT = 100000.0
def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine:
'bool'=False):
super().__init__()
self.d_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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import ... | PiotrDabkowski/NeMo | MaskedInstanceNorm1d | false | 11,789 | [
"Apache-2.0"
] | 0 | 7c251e9035b24136cf130f3caf760087e5ccf07c | https://github.com/PiotrDabkowski/NeMo/tree/7c251e9035b24136cf130f3caf760087e5ccf07c |
Model_CIFAR10 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model_CIFAR10(nn.Module):
def __init__(self):
super(Model_CIFAR10, self).__init__()
self.linear1 = nn.Linear(32 * 32, 50)
self.linear2 = nn.Linear(50, 10)
def forward(self, inputs):
x = inputs.view(-1, 3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Pluriscient/learn-to-learn | Model_CIFAR10 | false | 11,790 | [
"MIT"
] | 0 | 4aa0143522eb90f6439b83ed424d12b434cb344b | https://github.com/Pluriscient/learn-to-learn/tree/4aa0143522eb90f6439b83ed424d12b434cb344b |
TransformerDecoderLayer | import math
import torch
import torch.nn.functional as F
from torch import nn
def _normalize(tensor, norm_layer):
"""
Broadcast layer norm
"""
size = tensor.size()
return norm_layer(tensor.view(-1, size[-1])).view(size)
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, dim, d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | OneDirection9/Persona-Dialogue-Generation | TransformerDecoderLayer | false | 11,791 | [
"MIT"
] | 0 | 9696659efe668177bb775dc4192b4b6dd41a9ce1 | https://github.com/OneDirection9/Persona-Dialogue-Generation/tree/9696659efe668177bb775dc4192b4b6dd41a9ce1 |
TransformerEncoderLayer | import math
import torch
import torch.nn.functional as F
from torch import nn
def _normalize(tensor, norm_layer):
"""
Broadcast layer norm
"""
size = tensor.size()
return norm_layer(tensor.view(-1, size[-1])).view(size)
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, dim, d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | OneDirection9/Persona-Dialogue-Generation | TransformerEncoderLayer | false | 11,792 | [
"MIT"
] | 0 | 9696659efe668177bb775dc4192b4b6dd41a9ce1 | https://github.com/OneDirection9/Persona-Dialogue-Generation/tree/9696659efe668177bb775dc4192b4b6dd41a9ce1 |
DeiTEmbeddings | from _paritybench_helpers import _mock_config
import collections
import torch
from torch import nn
import torch.utils.checkpoint
import collections.abc
def to_2tuple(x):
if isinstance(x, collections.abc.Iterable):
return x
return x, x
class PatchEmbeddings(nn.Module):
"""
Image to Patch Embe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 collections
from torch import nn
import torch.utils.checkpoint
import col... | Clemens123/transformers | DeiTEmbeddings | false | 11,793 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.linear1 = nn.Linear(28 * 28, 32)
self.linear2 = nn.Linear(32, 10)
def forward(self, inputs):
x = inputs.view(-1, 28 * 28)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Pluriscient/learn-to-learn | Model | false | 11,794 | [
"MIT"
] | 0 | 4aa0143522eb90f6439b83ed424d12b434cb344b | https://github.com/Pluriscient/learn-to-learn/tree/4aa0143522eb90f6439b83ed424d12b434cb344b |
LxmertAttentionOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class LxmertAttentionOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Clemens123/transformers | LxmertAttentionOutput | false | 11,795 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
ResidualBlock | import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.in_channels, self.out_channels = in_channels, out_channels
self.blocks = nn.Identity()
self.shortcut = nn.Identity()
def forward(self, x):... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_add_0(in_ptr0, out_... | Rachneet/amc-app | ResidualBlock | false | 11,796 | [
"MIT"
] | 0 | 20b586608d454a3033333e285f0dbc91e5c6e07f | https://github.com/Rachneet/amc-app/tree/20b586608d454a3033333e285f0dbc91e5c6e07f |
StyleResidual | import torch
from torch import nn
import torch.utils.data
import torch.optim
class StyleResidual(nn.Module):
"""Styling."""
def __init__(self, d_channel: 'int', d_style: 'int', kernel_size: 'int'=1):
super().__init__()
self.rs = nn.Conv1d(in_channels=d_style, out_channels=d_channel,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.optim
assert_size_stri... | PiotrDabkowski/NeMo | StyleResidual | false | 11,797 | [
"Apache-2.0"
] | 0 | 7c251e9035b24136cf130f3caf760087e5ccf07c | https://github.com/PiotrDabkowski/NeMo/tree/7c251e9035b24136cf130f3caf760087e5ccf07c |
MultiHeadAttn | import torch
from torch.nn import functional as F
from torch import nn
import torch.utils.data
import torch.optim
class MultiHeadAttn(nn.Module):
def __init__(self, n_head, d_model, d_head, dropout, dropatt=0.1,
pre_lnorm=False):
super(MultiHeadAttn, self).__init__()
self.n_head = n_head
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | PiotrDabkowski/NeMo | MultiHeadAttn | false | 11,798 | [
"Apache-2.0"
] | 0 | 7c251e9035b24136cf130f3caf760087e5ccf07c | https://github.com/PiotrDabkowski/NeMo/tree/7c251e9035b24136cf130f3caf760087e5ccf07c |
Decoder | import math
import torch
from torch import nn
def overlap_and_add(signal, frame_step):
outer_dimensions = signal.size()[:-2]
frames, frame_length = signal.size()[-2:]
subframe_length = math.gcd(frame_length, frame_step)
subframe_step = frame_step // subframe_length
subframes_per_frame = frame_leng... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | PanagiotisP/demucs | Decoder | false | 11,799 | [
"MIT"
] | 0 | d115d0773ca08a081f5b6bfe274cf0e4ed9e2677 | https://github.com/PanagiotisP/demucs/tree/d115d0773ca08a081f5b6bfe274cf0e4ed9e2677 |
FusedLeakyReLU | import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5):
if bias is not None:
rest_dim = [1] * (input.ndim - bias.ndim - 1)
return F.leaky_relu(input + bias.view(1, bias.shape[0], *rest_dim),
nega... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.nn import functional as F
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda... | RaghavaDhanya/stylegan2-pytorch | FusedLeakyReLU | false | 11,800 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 6a2b0c228c56830a7e669bc66dc92073d3c81ca8 | https://github.com/RaghavaDhanya/stylegan2-pytorch/tree/6a2b0c228c56830a7e669bc66dc92073d3c81ca8 |
Model_CIFAR10_CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model_CIFAR10_CNN(nn.Module):
def __init__(self):
super(Model_CIFAR10_CNN, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Pluriscient/learn-to-learn | Model_CIFAR10_CNN | false | 11,801 | [
"MIT"
] | 0 | 4aa0143522eb90f6439b83ed424d12b434cb344b | https://github.com/Pluriscient/learn-to-learn/tree/4aa0143522eb90f6439b83ed424d12b434cb344b |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1,
score_function='dot_product', dropout=0):
""" Attention Mechanism
:param embed_dim:
:param 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.... | RaleLee/conv-emotion | Attention | false | 11,802 | [
"MIT"
] | 0 | 1b07223cbdfd52eb31e913e982d18ff1ed3daf08 | https://github.com/RaleLee/conv-emotion/tree/1b07223cbdfd52eb31e913e982d18ff1ed3daf08 |
SoftmaxOutputLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class OutputLayer(nn.Module):
"""
Abstract base class for output layer.
Handles projection to output labels
"""
def __init__(self, hidden_size, output_size):
super(OutputLayer, self).__init__()
self.output_size = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Ravikiran2402/_MOEL | SoftmaxOutputLayer | false | 11,803 | [
"MIT"
] | 0 | 57e311712c67e1e554a3a9187709f8e2728d19be | https://github.com/Ravikiran2402/_MOEL/tree/57e311712c67e1e554a3a9187709f8e2728d19be |
Net1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
import torch.optim
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | RadhikaB-97/deep-learning-containers | Net1 | false | 11,804 | [
"Apache-2.0"
] | 0 | 85ad01742613401f42908d75bb4ca23d11895f6c | https://github.com/RadhikaB-97/deep-learning-containers/tree/85ad01742613401f42908d75bb4ca23d11895f6c |
Conv | import torch
import torch.nn as nn
class Conv(nn.Module):
"""
Convenience class that does padding and convolution for inputs in the format
[batch_size, sequence length, hidden size]
"""
def __init__(self, input_size, output_size, kernel_size, pad_type):
"""
Parameters:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Ravikiran2402/_MOEL | Conv | false | 11,805 | [
"MIT"
] | 0 | 57e311712c67e1e554a3a9187709f8e2728d19be | https://github.com/Ravikiran2402/_MOEL/tree/57e311712c67e1e554a3a9187709f8e2728d19be |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.attention_head_size = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Abhimanyu08/minbert-assignment | BertSelfAttention | false | 11,806 | [
"Apache-2.0"
] | 0 | 1610364213b1aab2d5446175dffabd7e1742833b | https://github.com/Abhimanyu08/minbert-assignment/tree/1610364213b1aab2d5446175dffabd7e1742833b |
FunnelClassificationHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class FunnelClassificationHead(nn.Module):
def __init__(self, config, n_labels):
super().__init__()
self.linear_hidden = nn.Linear(config.d_model, config.d_model)
self.dropout = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Clemens123/transformers | FunnelClassificationHead | false | 11,807 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
Sine | import torch
import torch.utils.data
import torch.nn as nn
class Sine(nn.Module):
def __init(self):
super().__init__()
def forward(self, input):
return torch.sin(30 * input)
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 math as tl_math
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch.... | RisingStockPrices/sirenized-deepsdf | Sine | false | 11,808 | [
"MIT"
] | 0 | c0fb33e26b6bf0753c02adc5186af344e40a6d04 | https://github.com/RisingStockPrices/sirenized-deepsdf/tree/c0fb33e26b6bf0753c02adc5186af344e40a6d04 |
SimpleAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleAttention(nn.Module):
def __init__(self, input_dim):
super(SimpleAttention, self).__init__()
self.input_dim = input_dim
self.scalar = nn.Linear(self.input_dim, 1, bias=False)
def forward(self, M, x=None):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RaleLee/conv-emotion | SimpleAttention | false | 11,809 | [
"MIT"
] | 0 | 1b07223cbdfd52eb31e913e982d18ff1ed3daf08 | https://github.com/RaleLee/conv-emotion/tree/1b07223cbdfd52eb31e913e982d18ff1ed3daf08 |
act_model | import random
import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
from collections import deque
class act_model(nn.Module):
def __init__(self, inp, hidden, output):
super(act_model, self).__init__()
self.fc1 = nn.Linear(inp, hidden, bias=True)
self.fc2 = nn.L... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 random
import numpy as np
import torch.nn as nn
import torch.optim as opt... | RedRyan111/deep-q-learning | act_model | false | 11,811 | [
"MIT"
] | 0 | 1c032b9d4ee8ace8002d6ac4b6f4c54987ed8fc1 | https://github.com/RedRyan111/deep-q-learning/tree/1c032b9d4ee8ace8002d6ac4b6f4c54987ed8fc1 |
PointWiseFeedForward | import torch
class PointWiseFeedForward(torch.nn.Module):
def __init__(self, hidden_units, dropout_rate):
super(PointWiseFeedForward, self).__init__()
self.conv1 = torch.nn.Conv1d(hidden_units, hidden_units, kernel_size=1)
self.dropout1 = torch.nn.Dropout(p=dropout_rate)
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
assert_size_stride = torch._C... | RenqinSS/RecSys | PointWiseFeedForward | false | 11,812 | [
"MIT"
] | 0 | 932d54e47af79576b67e28364ae6e97d99ededf4 | https://github.com/RenqinSS/RecSys/tree/932d54e47af79576b67e28364ae6e97d99ededf4 |
MegatronBertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class MegatronBertOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.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 import nn
import torch.utils.checkpoint
assert_size_stride = torch._C... | Clemens123/transformers | MegatronBertOutput | false | 11,813 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
DeiTOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class DeiTOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.checkpoint
assert_size_stride = torch._C... | Clemens123/transformers | DeiTOutput | false | 11,814 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
LxmertSelfAttentionLayer | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
class LxmertAttention(nn.Module):
def __init__(self, config, ctx_dim=None):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise 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.... | Clemens123/transformers | LxmertSelfAttentionLayer | false | 11,815 | [
"Apache-2.0"
] | 0 | 22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 | https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26 |
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.... | RyanUnderhill/onnxruntime | MegatronGelu | false | 11,816 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
Alignment | from _paritybench_helpers import _mock_config
from torch.nn import Module
import math
import torch
import torch.nn.functional as f
import torch.nn as nn
class Module(nn.Module):
def __init__(self):
super().__init__()
self.summary = {}
def add_summary(self, name, val):
if self.trainin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IamHimon/re2 | Alignment | false | 11,817 | [
"Apache-2.0"
] | 0 | d16b0ffc385f7b118a6160d035250da8d6320534 | https://github.com/IamHimon/re2/tree/d16b0ffc385f7b118a6160d035250da8d6320534 |
DeepNN_v2 | import torch
import torch.nn as nn
class DeepNN_v2(nn.Module):
def __init__(self, X_dim, i_dropout_rate, h_dropout_rate):
super().__init__()
self.v2_layer1 = nn.Linear(X_dim, 256, bias=True)
self.v2_layer2 = nn.Linear(256, 256, bias=True)
self.v2_layer3 = nn.Linear(256, 1, bias=Tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | SBIlab/NetBio | DeepNN_v2 | false | 11,818 | [
"MIT"
] | 0 | 7abd24b8989cea381147d912f76a72676750b9d2 | https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2 |
TransformerDecoderLayer | import math
import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
"""
A model layer which implements a simplified version of masked attention, as
introduced by "Attention Is All You Need" (https://arxiv.org/abs/1706.03762).
Usage:
attn = MultiHeadAttention(embed_dim, num_heads... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Michellemingxuan/stanford_cs231n | TransformerDecoderLayer | false | 11,819 | [
"MIT"
] | 0 | b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143 | https://github.com/Michellemingxuan/stanford_cs231n/tree/b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143 |
Downsample | import torch
import torch.nn as nn
import torch.hub
class Downsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.with_conv:
self.conv = torch.nn.Conv2d(in_channels, in_channels,
kernel_size=3, st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.hub
assert_size_stride = torch._C._dynamo.gua... | Rushi314/taming-transformers | Downsample | false | 11,820 | [
"MIT"
] | 0 | 4c0309823f57be3ca2266c1244e3efce13aaee98 | https://github.com/Rushi314/taming-transformers/tree/4c0309823f57be3ca2266c1244e3efce13aaee98 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(32 * 32 * 3, 512)
self.fc2 = nn.Linear(512, 128)
self.fc3 = nn.Linear(128, 10)
def forward(self, x):
x = x.vie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Rui-Chun/CNN-with-Numpy | Net | false | 11,821 | [
"MIT"
] | 0 | 0bc73040c7ada2581d2db3d6e4b2396fa98a4bde | https://github.com/Rui-Chun/CNN-with-Numpy/tree/0bc73040c7ada2581d2db3d6e4b2396fa98a4bde |
MetaLayerNorm | import re
import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class MetaModule(nn.Module):
"""
Base class for PyTorch meta-learning modules. These modules accept an
additional argument `params` in their `forward` method.
Notes
---... | 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 re
import warnings
import torch.nn as nn
from collections import Ordered... | SDivakarBhat/pytorch-meta | MetaLayerNorm | false | 11,822 | [
"MIT"
] | 0 | 74cbc8ae625d85c6b954aad159ccb26b523b2240 | https://github.com/SDivakarBhat/pytorch-meta/tree/74cbc8ae625d85c6b954aad159ccb26b523b2240 |
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
from torch._inductor.runtime.... | RyanUnderhill/onnxruntime | NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency | false | 11,823 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
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.... | RyanUnderhill/onnxruntime | MegatronFastGelu | false | 11,824 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
MaskedMSELoss | import torch
import torch.nn as nn
class MaskedMSELoss(nn.Module):
def __init__(self):
super(MaskedMSELoss, self).__init__()
self.loss = nn.MSELoss(reduction='sum')
def forward(self, pred, target, mask):
"""
pred -> batch*seq_len
target -> batch*seq_len
mask -... | 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... | RaleLee/conv-emotion | MaskedMSELoss | false | 11,825 | [
"MIT"
] | 0 | 1b07223cbdfd52eb31e913e982d18ff1ed3daf08 | https://github.com/RaleLee/conv-emotion/tree/1b07223cbdfd52eb31e913e982d18ff1ed3daf08 |
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.... | RyanUnderhill/onnxruntime | NeuralNetNonDifferentiableOutput | false | 11,826 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
MultiHeadAttention | import math
import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
"""
A model layer which implements a simplified version of masked attention, as
introduced by "Attention Is All You Need" (https://arxiv.org/abs/1706.03762).
Usage:
attn = MultiHeadAttention(embed_dim, num_heads... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Michellemingxuan/stanford_cs231n | MultiHeadAttention | false | 11,827 | [
"MIT"
] | 0 | b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143 | https://github.com/Michellemingxuan/stanford_cs231n/tree/b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143 |
NeuralNetMultiplePositionalArgumentsVarKeyword | import torch
import torch.nn
import torch.onnx
class NeuralNetMultiplePositionalArgumentsVarKeyword(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNetMultiplePositionalArgumentsVarKeyword, self).__init__()
self.fc1 = torch.nn.Linear(input_size, 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
import torch.... | RyanUnderhill/onnxruntime | NeuralNetMultiplePositionalArgumentsVarKeyword | false | 11,828 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
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
from torch._inductor.runtime.... | RyanUnderhill/onnxruntime | NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency | false | 11,829 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
MyCustomFunctionReluModel | import torch
import torch.nn
import torch.onnx
class MyCustomFunctionReluModel(torch.nn.Module):
def __init__(self):
super().__init__()
class MyReLU(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
ctx.save_for_backward(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
import torch.nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_siz... | RyanUnderhill/onnxruntime | MyCustomFunctionReluModel | false | 11,830 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
DeepNN_v3 | import torch
import torch.nn as nn
class DeepNN_v3(nn.Module):
def __init__(self, X_dim, i_dropout_rate, h_dropout_rate):
super().__init__()
self.v3_layer1 = nn.Linear(X_dim, 128, bias=True)
self.v3_layer2 = nn.Linear(128, 128, bias=True)
self.v3_layer3 = nn.Linear(128, 128, bias=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | SBIlab/NetBio | DeepNN_v3 | false | 11,831 | [
"MIT"
] | 0 | 7abd24b8989cea381147d912f76a72676750b9d2 | https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2 |
DDPGConvBody | import torch
import torch.nn as nn
import torch.nn.functional as F
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class DDPGConvBody(nn.Module):
def __init__(self, in_channels=4):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Rajawat23/DeepRL | DDPGConvBody | false | 11,832 | [
"MIT"
] | 0 | 9f77dfbc593f9c9055254c781f97983b9630dad2 | https://github.com/Rajawat23/DeepRL/tree/9f77dfbc593f9c9055254c781f97983b9630dad2 |
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.... | RyanUnderhill/onnxruntime | NeuralNetPartialNoGradModel | false | 11,833 | [
"MIT"
] | 0 | 6df4e293ffbb47d739d2dedfbb87fa6234b8c37c | https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c |
DeepNN_v1 | import torch
import torch.nn as nn
class DeepNN_v1(nn.Module):
def __init__(self, X_dim, i_dropout_rate, h_dropout_rate):
super().__init__()
self.v1_layer1 = nn.Linear(X_dim, 512, bias=True)
self.v1_layer2 = nn.Linear(512, 1, bias=True)
self.i_dropout = nn.Dropout(i_dropout_rate)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | SBIlab/NetBio | DeepNN_v1 | false | 11,834 | [
"MIT"
] | 0 | 7abd24b8989cea381147d912f76a72676750b9d2 | https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2 |
TwoLayerFCBodyWithAction | import torch
import torch.nn as nn
import torch.nn.functional as F
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class TwoLayerFCBodyWithAction(nn.Module):
def __init__(self, state_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | RaviTej310/mrpvf | TwoLayerFCBodyWithAction | false | 11,835 | [
"MIT"
] | 0 | f026b4704f26b85161de26ada5d6390ab549fbbd | https://github.com/RaviTej310/mrpvf/tree/f026b4704f26b85161de26ada5d6390ab549fbbd |
down | import torch
import torch.nn.functional as F
import torch.nn as nn
class down(nn.Module):
"""
A class for creating neural network blocks containing layers:
Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU
This is used in the UNet Class to create a UNet like NN architecture.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Remosy/v2e | down | false | 11,836 | [
"MIT"
] | 0 | efc81cbcc113ca55d1631603323150be5ef8eb30 | https://github.com/Remosy/v2e/tree/efc81cbcc113ca55d1631603323150be5ef8eb30 |
_Transition | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torchvision.transforms import *
class _Transition(nn.Module):
def __init__(self, in_channels, args):
super(_Transition, self).__init__()
self.pool = nn.AvgPool2d(kernel_size=2, stride=2)
def forward(self, x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | RobbieEarle/robustness | _Transition | false | 11,837 | [
"Apache-2.0"
] | 0 | 2f4381900015bf7fcd9975d43b8104d2d14f8568 | https://github.com/RobbieEarle/robustness/tree/2f4381900015bf7fcd9975d43b8104d2d14f8568 |
DeepNN_v4 | import torch
import torch.nn as nn
class DeepNN_v4(nn.Module):
def __init__(self, X_dim, i_dropout_rate, h_dropout_rate):
super().__init__()
self.v4_layer1 = nn.Linear(X_dim, 128, bias=True)
self.v4_layer2 = nn.Linear(128, 128, bias=True)
self.v4_layer3 = nn.Linear(128, 64, bias=T... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SBIlab/NetBio | DeepNN_v4 | false | 11,838 | [
"MIT"
] | 0 | 7abd24b8989cea381147d912f76a72676750b9d2 | https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2 |
ProposalNet | import torch
import torch.nn as nn
import torch.utils.data
class ProposalNet(nn.Module):
def __init__(self, in_features=2048):
super(ProposalNet, self).__init__()
self.down1 = nn.Conv2d(2048, 128, 3, 1, 1)
self.down2 = nn.Conv2d(128, 128, 3, 2, 1)
self.down3 = nn.Conv2d(128, 128, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Liuhongzhi2018/ClassNet | ProposalNet | false | 11,839 | [
"MIT"
] | 0 | 7d427dc9b8c38abf0a4eedfdeb75c09c59aa7185 | https://github.com/Liuhongzhi2018/ClassNet/tree/7d427dc9b8c38abf0a4eedfdeb75c09c59aa7185 |
ScaledDotProductAttention | import torch
from typing import Optional
import torch.nn.functional as F
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""
Overview:
Implementation of dot product attentionn with scaling.
"""
def __init__(self, d_k: 'int', dropout: 'float'=0.0) ->None:
super(Scaled... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | PaParaZz1/DI-engine | ScaledDotProductAttention | false | 11,840 | [
"Apache-2.0"
] | 0 | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de |
LSTM | import torch
import torch.nn as nn
import torch.nn.functional as F
class LSTM(nn.Module):
def __init__(self, input_size, cell_size, hidden_size):
"""
cell_size is the size of cell_state.
hidden_size is the size of hidden_state, or say the output_state of each step
"""
supe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | SakastLord/STGAT | LSTM | false | 11,841 | [
"MIT"
] | 0 | 664843b3a55ac55383de1d5400d731376476ea03 | https://github.com/SakastLord/STGAT/tree/664843b3a55ac55383de1d5400d731376476ea03 |
Encoder | import torch
import torch.nn as nn
class Conv(nn.Module):
def __init__(self, filters0, filters1, kernel_size, bn, bias=True):
super().__init__()
if bn:
bias = False
self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1,
padding=kernel_size // 2, bias=bias... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | PaParaZz1/DI-engine | Encoder | false | 11,842 | [
"Apache-2.0"
] | 0 | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de |
TimeBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class TimeBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3):
"""
:param in_channels: Number of input features at each node in each time
step.
:param out_channels: Desired number of outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | SakastLord/STGAT | TimeBlock | false | 11,843 | [
"MIT"
] | 0 | 664843b3a55ac55383de1d5400d731376476ea03 | https://github.com/SakastLord/STGAT/tree/664843b3a55ac55383de1d5400d731376476ea03 |
PixBlock | import torch
import torch.nn as nn
class PixBlock(nn.Module):
def __init__(self, in_size, out_size=3, scale=2, norm=None):
super(PixBlock, self).__init__()
self.conv1 = nn.Conv2d(in_size, out_size * 2 ** scale, 1, 1)
self.up = nn.PixelShuffle(scale)
def forward(self, x):
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | MohamadHMousavi/demo_wsi_superres | PixBlock | false | 11,844 | [
"MIT"
] | 0 | 7e846470aa228affa62ea77c38c138dde087a0de | https://github.com/MohamadHMousavi/demo_wsi_superres/tree/7e846470aa228affa62ea77c38c138dde087a0de |
MultiheadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
class MultiheadAttention(nn.Module):
def __init__(self, embed_dim, num_heads, attn_dropout=0.0, bias=True,
add_bias_kv=False, add_zero_attn=False):
"""
Multi-headed attention. This module can... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SCUT-IEL/CMAA | MultiheadAttention | false | 11,845 | [
"MIT"
] | 0 | 1af9e7a7a75e754a7208e361d8128ef58b716941 | https://github.com/SCUT-IEL/CMAA/tree/1af9e7a7a75e754a7208e361d8128ef58b716941 |
TokenEmbedding | import math
import torch
from torch import Tensor
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class TokenEmbedding(nn.Module):
def __init__(self, vocab_size: 'int', emb_... | 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.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | LeeSHa00/PyTorch-tutorials-kr | TokenEmbedding | false | 11,846 | [
"BSD-3-Clause"
] | 0 | 6a25b48b1a6cc96ea4edebeede2e419ef73b96fc | https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc |
GLU | import torch
import torch.nn as nn
class GLU(nn.Module):
"""
Overview:
Gating Linear Unit.
This class does a thing like this:
.. code::python
# Inputs: input, context, output_size
# The gate value is a learnt function of the input.
gate = sigmoid(l... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | PaParaZz1/DI-engine | GLU | false | 11,847 | [
"Apache-2.0"
] | 0 | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de |
LabelSmoothCELoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def one_hot(val: 'torch.LongTensor', num: 'int', num_first: 'bool'=False
) ->torch.FloatTensor:
"""
Overview:
Convert a ``torch.LongTensor`` to one hot encoding.
This implementation can be slightly faster than ``torch.nn.fu... | 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
... | PaParaZz1/DI-engine | LabelSmoothCELoss | false | 11,848 | [
"Apache-2.0"
] | 0 | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de |
TracedModule | import torch
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class TracedModule(torch.nn.Module):
def forward(self, x):
x = x.type(torch.float32)
return torch.floor(torch.sqrt(x) ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.quantization
import torch.onnx
import torch.nn.parallel
import tor... | LeeSHa00/PyTorch-tutorials-kr | TracedModule | false | 11,849 | [
"BSD-3-Clause"
] | 0 | 6a25b48b1a6cc96ea4edebeede2e419ef73b96fc | https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc |
SENet | import torch
import torch.nn as nn
class SENet(nn.Module):
"""support estimation network"""
def __init__(self, input_size: 'int', hidden_size: 'int', output_dims:
'int') ->None:
super(SENet, self).__init__()
self.l_1 = nn.Linear(input_size, hidden_size)
self.l_2 = nn.Linear(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.triton_helpers import libdevice
import torch.nn as ... | PaParaZz1/DI-engine | SENet | false | 11,850 | [
"Apache-2.0"
] | 0 | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
""" outputs the limits for the values in the hidden layer for initialisation"""
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl | Critic | false | 11,851 | [
"MIT"
] | 0 | f3e811a3ae3eb603173c2475bbfe1de91074ecdc | https://github.com/SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl/tree/f3e811a3ae3eb603173c2475bbfe1de91074ecdc |
ResidualBlock | import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_channels, out_channels, activation='relu'):
super().__init__()
self.in_channels, self.out_channels, self.activation = (in_channels,
out_channels, activation)
self.blocks = nn.Identity()
... | 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... | PaParaZz1/DI-engine | ResidualBlock | false | 11,852 | [
"Apache-2.0"
] | 0 | b38144117c1ebc6eb860d8637ec8866dfbcdf2de | https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.