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 |
|---|---|---|---|---|---|---|---|---|---|---|
MaskLSTMCell | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class MaskLSTMCell(nn.Module):
def __init__(self, options):
super(MaskLSTMCell, self).__init__()
self.n_in = options['n_in']
self.n_out = options['n_out']
self.input = nn.Linear(self.n_in, self.n_out ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | KaiQiangSong/joint_parse_summ | MaskLSTMCell | false | 8,813 | [
"BSD-3-Clause"
] | 29 | 5d4a40d9a681bc8b06c847643d810846f3867216 | https://github.com/KaiQiangSong/joint_parse_summ/tree/5d4a40d9a681bc8b06c847643d810846f3867216 |
RWKV_TimeMix | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class RWKV_TimeMix(nn.Module):
def __init__(self, config, layer_id):
super().__init__()
assert config.n_attn % config.n_head == 0
self.layer_id = layer_id
self.ctx_len = config.ctx_len
self.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.... | JunnYu/Paddle-AI-Writer | RWKV_TimeMix | false | 8,814 | [
"BSD-3-Clause"
] | 25 | 8d211f9e60aeed323b6330065668f54350514c70 | https://github.com/JunnYu/Paddle-AI-Writer/tree/8d211f9e60aeed323b6330065668f54350514c70 |
Attention | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.init
class Attention(nn.Module):
def __init__(self, args, enc_dim, dec_dim, attn_dim=None):
super(Attention, self).__init__()
self.args = args
self.enc_dim = enc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IvanFei/video_captioning_rl | Attention | false | 8,815 | [
"MIT"
] | 41 | 85ffa1abc056bd0ecfd35d1b52aed81d2f04afef | https://github.com/IvanFei/video_captioning_rl/tree/85ffa1abc056bd0ecfd35d1b52aed81d2f04afef |
CNNCifar100 | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.functional as F
class CNNCifar100(nn.Module):
def __init__(self, args):
super(CNNCifar100, self).__init__()
self.conv1 = nn.Conv2d(3, 64, 5)
self.pool = nn.MaxPool2d(2, 2)
self.drop = 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.... | Clej/FedRep | CNNCifar100 | false | 8,816 | [
"MIT"
] | 31 | 543315a58c42399dccfe186795ada8abe5ac84ef | https://github.com/Clej/FedRep/tree/543315a58c42399dccfe186795ada8abe5ac84ef |
BertPredictionHeadTransform | from _paritybench_helpers import _mock_config
import math
import torch
import torch.utils.data
import torch.nn as nn
import torch
import torch.nn.parallel
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT"s gelu is slightly different (and gives slightly different ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | IsmaelElsharkawi/new_pororo_repo | BertPredictionHeadTransform | false | 8,817 | [
"MIT"
] | 19 | 4617083b420615b8a3eb0f44d02e4e91a8f407f7 | https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7 |
BertPredictionHead | from _paritybench_helpers import _mock_config
import math
import torch
import torch.utils.data
import torch.nn as nn
import torch
import torch.nn.parallel
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT"s gelu is slightly different (and gives slightly different ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IsmaelElsharkawi/new_pororo_repo | BertPredictionHead | false | 8,818 | [
"MIT"
] | 19 | 4617083b420615b8a3eb0f44d02e4e91a8f407f7 | https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.utils.data
import torch.nn as nn
import torch
import torch.nn.parallel
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IsmaelElsharkawi/new_pororo_repo | BertAttention | false | 8,819 | [
"MIT"
] | 19 | 4617083b420615b8a3eb0f44d02e4e91a8f407f7 | https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7 |
BertLayer | from _paritybench_helpers import _mock_config
import math
import torch
import torch.utils.data
import torch.nn as nn
import torch
import torch.nn.parallel
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT"s gelu is slightly different (and gives slightly different ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IsmaelElsharkawi/new_pororo_repo | BertLayer | false | 8,820 | [
"MIT"
] | 19 | 4617083b420615b8a3eb0f44d02e4e91a8f407f7 | https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7 |
MemoryUpdater | from _paritybench_helpers import _mock_config
import math
import torch
import torch.utils.data
import torch.nn as nn
import torch
import torch.nn.parallel
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IsmaelElsharkawi/new_pororo_repo | MemoryUpdater | false | 8,821 | [
"MIT"
] | 19 | 4617083b420615b8a3eb0f44d02e4e91a8f407f7 | https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7 |
Block | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torch.nn import functional as F
class RWKV_TimeMix(nn.Module):
def __init__(self, config, layer_id):
super().__init__()
assert config.n_attn % config.n_head == 0
self.layer_id = layer_id
self.ctx... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | JunnYu/Paddle-AI-Writer | Block | false | 8,822 | [
"BSD-3-Clause"
] | 25 | 8d211f9e60aeed323b6330065668f54350514c70 | https://github.com/JunnYu/Paddle-AI-Writer/tree/8d211f9e60aeed323b6330065668f54350514c70 |
Tucker | import torch
from torch import nn
from torch.nn import functional as F
class Tucker(nn.Module):
def __init__(self, input_dims, output_dim, mm_dim=1600, shared=False,
normalize=False, dropout_input=0.0, dropout_pre_lin=0.0,
dropout_output=0.0):
super(Tucker, self).__init__()
self.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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | AndresPMD/GCN_classification | Tucker | false | 8,823 | [
"MIT"
] | 39 | b005c4256d68f1f90a7f73e7fdb3d066448de28c | https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c |
L2Norm | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
... | 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
from math import sqrt as sqrt
from itertools import produ... | Atine/pytorch.SSD.handles | L2Norm | false | 8,824 | [
"MIT"
] | 0 | ff57ceacc57f195361adceb92a84d54d155ba1a4 | https://github.com/Atine/pytorch.SSD.handles/tree/ff57ceacc57f195361adceb92a84d54d155ba1a4 |
FocalLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class FocalLoss(nn.Module):
"""Non weighted version of Focal Loss"""
def __init__(self, alpha=0.25, gamma=2):
super(FocalLoss, self).__init__()
self.alpha = alpha
self.gamma = gamma
def forward(self, inputs, targe... | 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... | BambooPalace/Celeba-attributes-prediction | FocalLoss | false | 8,825 | [
"MIT"
] | 0 | c97fdf2c926eab137e7b6938659a877d3b7dc3f5 | https://github.com/BambooPalace/Celeba-attributes-prediction/tree/c97fdf2c926eab137e7b6938659a877d3b7dc3f5 |
LayerScaling | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class LayerScaling(nn.Module):
"""Scales inputs by the second moment for the entire layer.
.. math::
y = \\frac{x}{\\sqrt{\\mathrm{E}[x^2] + \\epsilon}}
Args... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.... | Ajk4/online-normalization | LayerScaling | false | 8,826 | [
"BSD-3-Clause"
] | 0 | 84895855fb8b099ad8c1266dc325bec41d72ecf5 | https://github.com/Ajk4/online-normalization/tree/84895855fb8b099ad8c1266dc325bec41d72ecf5 |
LayerScaling1D | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class LayerScaling1D(nn.Module):
"""Scales inputs by the second moment for the entire layer.
.. math::
y = \\frac{x}{\\sqrt{\\mathrm{E}[x^2] + \\epsilon}}
Ar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.... | Ajk4/online-normalization | LayerScaling1D | false | 8,827 | [
"BSD-3-Clause"
] | 0 | 84895855fb8b099ad8c1266dc325bec41d72ecf5 | https://github.com/Ajk4/online-normalization/tree/84895855fb8b099ad8c1266dc325bec41d72ecf5 |
GroupNorm2d | import torch
import torch.nn as nn
class GroupNorm2d(nn.Module):
def __init__(self, in_features, in_groups, epsilon=1e-05):
super(GroupNorm2d, self).__init__()
self.in_groups = in_groups
self.epsilon = epsilon
self.gamma = nn.Parameter(torch.ones(1, in_features, 1, 1))
sel... | 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_... | AnirudhMaiya/pytorch-Group-Normalization | GroupNorm2d | false | 8,828 | [
"MIT"
] | 0 | 9792e7beafc91387540df2191669c1ba540ee2de | https://github.com/AnirudhMaiya/pytorch-Group-Normalization/tree/9792e7beafc91387540df2191669c1ba540ee2de |
RewardCriterion | import torch
import torch.nn as nn
def to_contiguous(tensor):
if tensor.is_contiguous():
return tensor
else:
return tensor.contiguous()
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward):
... | 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... | Ago3/VLP | RewardCriterion | false | 8,829 | [
"Apache-2.0"
] | 0 | 4dec0e04b8592f4a74fe66c253dbb92574e7e2ba | https://github.com/Ago3/VLP/tree/4dec0e04b8592f4a74fe66c253dbb92574e7e2ba |
PositionwiseFeedforward | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedforward(nn.Module):
def __init__(self, hid_dim: 'int', pf_dim: 'int', dropout: 'float'):
super().__init__()
self.hid_dim = hid_dim
self.pf_dim = pf_dim
self.fc_1 = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Art31/pytorch-seq2seq | PositionwiseFeedforward | false | 8,830 | [
"MIT"
] | 0 | 24e0180902a5eadc3390c5fd95634c6c62ef3cc9 | https://github.com/Art31/pytorch-seq2seq/tree/24e0180902a5eadc3390c5fd95634c6c62ef3cc9 |
SeperableConv | import torch
import torch.nn as nn
import torch.nn.functional as F
def _get_padding(kernel_size, stride, dilation):
padding = (stride - 1 + dilation * (kernel_size - 1)) // 2
return padding
class SeperableConv(nn.Module):
def __init__(self, inp, outp, k=3, stride=1, dilation=1):
super(Seperable... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AksultanMukhanbet/proctoring_intellectual_part | SeperableConv | false | 8,831 | [
"MIT"
] | 0 | f85db9d31025cb57a732f64ab22358651bc93c69 | https://github.com/AksultanMukhanbet/proctoring_intellectual_part/tree/f85db9d31025cb57a732f64ab22358651bc93c69 |
BehlerAngular | import torch
from torch import nn as nn
class BehlerAngular(nn.Module):
"""
Compute Behler type angular contribution of the angle spanned by three atoms:
:math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta`
Sets of zetas with lambdas of -1 and +1 are generated automatically.
A... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | Avinashpathapati/gnn | BehlerAngular | false | 8,832 | [
"MIT"
] | 0 | e06c36f5d8fb7da555c8f82e04364ba4366444c7 | https://github.com/Avinashpathapati/gnn/tree/e06c36f5d8fb7da555c8f82e04364ba4366444c7 |
Aggregate | import torch
from torch import nn as nn
class Aggregate(nn.Module):
"""Pooling layer based on sum or average with optional masking.
Args:
axis (int): axis along which pooling is done.
mean (bool, optional): if True, use average instead for sum pooling.
keepdim (bool, optional): whethe... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | Avinashpathapati/gnn | Aggregate | false | 8,833 | [
"MIT"
] | 0 | e06c36f5d8fb7da555c8f82e04364ba4366444c7 | https://github.com/Avinashpathapati/gnn/tree/e06c36f5d8fb7da555c8f82e04364ba4366444c7 |
Scale | import torch
import torch.utils.data
from torch import nn
class Scale(nn.Module):
def __init__(self, init_value=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return input * self.scale
def get_inputs():
r... | 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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | AriAaltoGit/FCOS | Scale | false | 8,834 | [
"BSD-2-Clause"
] | 0 | 7e66ba4247f533e3660749fafb87366d06ea3f7d | https://github.com/AriAaltoGit/FCOS/tree/7e66ba4247f533e3660749fafb87366d06ea3f7d |
ConvNorm | import torch
class ConvNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=None, dilation=1, bias=True, w_init_gain='linear'):
super(ConvNorm, self).__init__()
if padding is None:
assert kernel_size % 2 == 1
padding... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
reinterpret_tens... | Ahmad1s/FastSpeech2 | ConvNorm | false | 8,835 | [
"MIT"
] | 0 | d31802ffcd74bb2c2ca57b53e481917989ded6b9 | https://github.com/Ahmad1s/FastSpeech2/tree/d31802ffcd74bb2c2ca57b53e481917989ded6b9 |
NeuralNet | import torch
import torch.nn as nn
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNet, self).__init__()
self.l1 = nn.Linear(input_size, hidden_size)
self.l2 = nn.Linear(hidden_size, hidden_size)
self.l3 = nn.Linear(hidden_size, nu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AlejandroE25/pytorch-chatbot | NeuralNet | false | 8,836 | [
"MIT"
] | 0 | b9d7926f2f897f3a8513e8796b38f928715738af | https://github.com/AlejandroE25/pytorch-chatbot/tree/b9d7926f2f897f3a8513e8796b38f928715738af |
Attention | import math
import torch
from torch import nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, hidden_size):
super(Attention, self).__init__()
self.hidden_size = hidden_size
self.attn = nn.Linear(self.hidden_size * 2, hidden_size)
self.v = nn.Paramete... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AmitMY/seq2seq | Attention | false | 8,837 | [
"MIT"
] | 0 | 1ad7c09188537729e5b18356f5c36fad1928d245 | https://github.com/AmitMY/seq2seq/tree/1ad7c09188537729e5b18356f5c36fad1928d245 |
InputConv | import torch
import torch.nn as nn
import torch.nn.functional as F
def _get_padding(kernel_size, stride, dilation):
padding = (stride - 1 + dilation * (kernel_size - 1)) // 2
return padding
class InputConv(nn.Module):
def __init__(self, inp, outp, k=3, stride=1, dilation=1):
super(InputConv, se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AksultanMukhanbet/proctoring_intellectual_part | InputConv | false | 8,838 | [
"MIT"
] | 0 | f85db9d31025cb57a732f64ab22358651bc93c69 | https://github.com/AksultanMukhanbet/proctoring_intellectual_part/tree/f85db9d31025cb57a732f64ab22358651bc93c69 |
TagLineLoss | import torch
from torch import nn
class TagLineLoss(nn.Module):
def __init__(self):
super(TagLineLoss, self).__init__()
self.criterion = torch.nn.CrossEntropyLoss()
def forward(self, output, target):
return self.criterion(input=output, target=target)
def get_inputs():
return [t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | Benjamintdk/DSAI-Project | TagLineLoss | false | 8,839 | [
"Apache-2.0"
] | 0 | 684b74fcef43972e3f4d308f006fb3b4c8191b18 | https://github.com/Benjamintdk/DSAI-Project/tree/684b74fcef43972e3f4d308f006fb3b4c8191b18 |
MLP | import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, embedding_size):
super(MLP, self).__init__()
self.dense_h_to_4h = nn.Linear(embedding_size, embedding_size * 4)
self.dense_4h_to_h = nn.Linear(embedding_size * 4, embedding_size)
self.act = nn.functional.g... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | AeroXi/CPM-Generate-Pytorch | MLP | false | 8,840 | [
"Apache-2.0"
] | 0 | a1530ad2848a690c6e1557f996fe58538fe86884 | https://github.com/AeroXi/CPM-Generate-Pytorch/tree/a1530ad2848a690c6e1557f996fe58538fe86884 |
Liner_Qnet | import torch
import torch.nn as nn
import torch.nn.functional as F
class Liner_Qnet(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super().__init__()
self.L1 = nn.Linear(input_size, hidden_size)
self.L2 = nn.Linear(hidden_size, output_size)
def forward(self, x)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BodaSadalla98/snake-ai | Liner_Qnet | false | 8,841 | [
"MIT"
] | 0 | 03cc56f39c708d403e51777959138ef776110824 | https://github.com/BodaSadalla98/snake-ai/tree/03cc56f39c708d403e51777959138ef776110824 |
NN | import torch
import torch.nn as nn
import torch.nn.functional as F
class NN(nn.Module):
def __init__(self, input_size, num_classes):
super(NN, self).__init__()
self.fc1 = nn.Linear(input_size, 50)
self.fc2 = nn.Linear(50, num_classes)
def forward(self, x):
x = F.relu(self.fc1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AsianZeus/PyTorch-Models | NN | false | 8,842 | [
"Apache-2.0"
] | 0 | 3249a06a5233b22232a8a336c52e8c24d1b55439 | https://github.com/AsianZeus/PyTorch-Models/tree/3249a06a5233b22232a8a336c52e8c24d1b55439 |
SimpleCNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleCNN(nn.Module):
def __init__(self):
super(SimpleCNN, self).__init__()
self.fc1 = nn.Linear(28 * 28, 500)
self.fc2 = nn.Linear(500, 256)
self.fc3 = nn.Linear(256, 10)
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AnweshCR7/convNeXt | SimpleCNN | false | 8,843 | [
"MIT"
] | 0 | 5400dd0f7c793f497057f5548b49e3969a540504 | https://github.com/AnweshCR7/convNeXt/tree/5400dd0f7c793f497057f5548b49e3969a540504 |
upsample_block | import torch
import torch.nn as nn
import torch.nn.functional as F
class upsample_block(nn.Module):
"""
Defines upsampling block. The upsampling is performed
using bilinear or nearest interpolation followed by 1-by-1
convolution (the latter can be used to reduce
a number of feature 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Art-MC/SKX_NN | upsample_block | false | 8,844 | [
"MIT"
] | 0 | 02d5089ea9c4b3ca7c1878e1d9a5811f5da9f6bd | https://github.com/Art-MC/SKX_NN/tree/02d5089ea9c4b3ca7c1878e1d9a5811f5da9f6bd |
Conv2d | import torch
import torch.nn as nn
class Conv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
relu=True, same_padding=False, bn=False):
super(Conv2d, self).__init__()
padding = int((kernel_size - 1) / 2) if same_padding else 0
self.conv = nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Bazinga0426/Crowd-Counting-for-FYP | Conv2d | false | 8,845 | [
"MIT"
] | 0 | a5ef9de5d7b69bd76980aa4312700601cf7d9adb | https://github.com/Bazinga0426/Crowd-Counting-for-FYP/tree/a5ef9de5d7b69bd76980aa4312700601cf7d9adb |
MultiNonLinearClassifier | import torch
import torch.nn as nn
from torch.nn import functional as F
class MultiNonLinearClassifier(nn.Module):
def __init__(self, hidden_size, num_label, dropout_rate):
super(MultiNonLinearClassifier, self).__init__()
self.num_label = num_label
self.classifier1 = nn.Linear(hidden_size... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | BeyonderXX/MINER | MultiNonLinearClassifier | false | 8,846 | [
"Apache-2.0"
] | 0 | 552049139cc61dec8fba19f1e941e96caf630a6a | https://github.com/BeyonderXX/MINER/tree/552049139cc61dec8fba19f1e941e96caf630a6a |
DoubleConv | import torch
import torch.nn as nn
class DoubleConv(nn.Module):
"""
Double 3x3 conv + relu
"""
def __init__(self, in_channels, out_channels):
super(DoubleConv, self).__init__()
self.conv_1 = nn.Conv2d(in_channels, out_channels, 3)
self.conv_2 = nn.Conv2d(out_channels, out_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Aoi-hosizora/UNet-pytorch | DoubleConv | false | 8,847 | [
"MIT"
] | 0 | 96951d5d1fdc6c6266a11e1bd97fbf72010bc87d | https://github.com/Aoi-hosizora/UNet-pytorch/tree/96951d5d1fdc6c6266a11e1bd97fbf72010bc87d |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature):
super().__init__()
self.temperature = temperature
self.softmax = nn.Softmax(dim=2)
def forward(self, q, k, v, ma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ahmad1s/FastSpeech2 | ScaledDotProductAttention | false | 8,848 | [
"MIT"
] | 0 | d31802ffcd74bb2c2ca57b53e481917989ded6b9 | https://github.com/Ahmad1s/FastSpeech2/tree/d31802ffcd74bb2c2ca57b53e481917989ded6b9 |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AntoniaSophia/deep-reinforcement-learning | Actor | false | 8,849 | [
"MIT"
] | 0 | 1d1c77039eea22fcf6726c35c3dd2563adfcb519 | https://github.com/AntoniaSophia/deep-reinforcement-learning/tree/1d1c77039eea22fcf6726c35c3dd2563adfcb519 |
GLU | import torch
import torch.nn as nn
from torch.nn.utils.rnn import *
import torch.nn.parallel
import torch.nn.functional as F
class GLU(nn.Module):
def __init__(self):
super(GLU, self).__init__()
def forward(self, x):
nc = x.size(1)
assert nc % 2 == 0, 'channels dont divide 2!'
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn.utils.rnn import *
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | ArunKodnani/StackGAN-v2 | GLU | false | 8,850 | [
"MIT"
] | 0 | e2ef678049b2e18b4a076cecfbe220cf270e59e6 | https://github.com/ArunKodnani/StackGAN-v2/tree/e2ef678049b2e18b4a076cecfbe220cf270e59e6 |
AndModule | import torch
import torch.nn as nn
class AndModule(nn.Module):
""" A neural module that (basically) performs a logical and.
Extended Summary
----------------
An :class:`AndModule` is a neural module that takes two input attention masks and (basically)
performs a set intersection. This would be u... | 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... | ArjitJ/tbd-nets | AndModule | false | 8,851 | [
"MIT"
] | 0 | 8e93ecad54489706ec3249c9ca5d345d6866e1ba | https://github.com/ArjitJ/tbd-nets/tree/8e93ecad54489706ec3249c9ca5d345d6866e1ba |
OrModule | import torch
import torch.nn as nn
class OrModule(nn.Module):
""" A neural module that (basically) performs a logical or.
Extended Summary
----------------
An :class:`OrModule` is a neural module that takes two input attention masks and (basically)
performs a set union. This would be used in a qu... | 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... | ArjitJ/tbd-nets | OrModule | false | 8,852 | [
"MIT"
] | 0 | 8e93ecad54489706ec3249c9ca5d345d6866e1ba | https://github.com/ArjitJ/tbd-nets/tree/8e93ecad54489706ec3249c9ca5d345d6866e1ba |
Conv | import torch
import torch.nn as nn
class Conv(nn.Module):
"""
Convolution Module
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='linear'):
"""
:param in_channels: dimension of input
:param out_channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Ahmad1s/FastSpeech2 | Conv | false | 8,853 | [
"MIT"
] | 0 | d31802ffcd74bb2c2ca57b53e481917989ded6b9 | https://github.com/Ahmad1s/FastSpeech2/tree/d31802ffcd74bb2c2ca57b53e481917989ded6b9 |
BertLayerNorm | import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_si... | 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... | AdrianVandierAst/fast-bert | BertLayerNorm | false | 8,854 | [
"Apache-2.0"
] | 0 | f5adb426accee4a1882cdd4372fced4ef922c978 | https://github.com/AdrianVandierAst/fast-bert/tree/f5adb426accee4a1882cdd4372fced4ef922c978 |
bhaModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class bhaModel(nn.Module):
def __init__(self, inShape, outShape):
super().__init__()
self.inShape = inShape
self.outShape = outShape
self.fc1 = nn.Linear(self.inShape, 32)
self.fc2 = nn.Linear(32, 64)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | BharathC15/bharathML | bhaModel | false | 8,855 | [
"MIT"
] | 0 | ab0460eace3bc83a6b9a7ba7c40e9721baead09a | https://github.com/BharathC15/bharathML/tree/ab0460eace3bc83a6b9a7ba7c40e9721baead09a |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | AntoniaSophia/deep-reinforcement-learning | Critic | false | 8,856 | [
"MIT"
] | 0 | 1d1c77039eea22fcf6726c35c3dd2563adfcb519 | https://github.com/AntoniaSophia/deep-reinforcement-learning/tree/1d1c77039eea22fcf6726c35c3dd2563adfcb519 |
ZeroConv2d | import torch
from torch import nn
from torch.nn import functional as F
class ZeroConv2d(nn.Module):
def __init__(self, in_channel, out_channel, padding=1):
super().__init__()
self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0)
self.conv.weight.data.zero_()
self.conv.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 math as tl_math
from torch im... | AvivNavon/glow-pytorch | ZeroConv2d | false | 8,857 | [
"MIT"
] | 0 | de0fb2c1d8a4000337b2fbd1215df68530070431 | https://github.com/AvivNavon/glow-pytorch/tree/de0fb2c1d8a4000337b2fbd1215df68530070431 |
Attention | import torch
from torch import nn
class Attention(nn.Module):
"""
Attention Network.
"""
def __init__(self, encoder_dim, decoder_dim, attention_dim):
"""
:param encoder_dim: feature size of encoded images
:param decoder_dim: size of decoder's RNN
:param attention_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.... | AshuAkshi0708/Attention_based_image_captioning | Attention | false | 8,858 | [
"Apache-2.0"
] | 0 | 33db9caa5763e687fa4f6b2b813f424d0d1fc00c | https://github.com/AshuAkshi0708/Attention_based_image_captioning/tree/33db9caa5763e687fa4f6b2b813f424d0d1fc00c |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size=4, action_size=14, seed=1111):
"""
Initialize Deep Q Network
Args:
state_size (int): Dimension of each state
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AntoniaSophia/deep-reinforcement-learning | QNetwork | false | 8,859 | [
"MIT"
] | 0 | 1d1c77039eea22fcf6726c35c3dd2563adfcb519 | https://github.com/AntoniaSophia/deep-reinforcement-learning/tree/1d1c77039eea22fcf6726c35c3dd2563adfcb519 |
Reorg | import torch
import torch.nn as nn
class Reorg(nn.Module):
def __init__(self, stride=2):
super(Reorg, self).__init__()
self.stride = stride
def forward(self, x):
stride = self.stride
assert x.data.dim() == 4
B = x.data.size(0)
C = x.data.size(1)
H = 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
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AmitNativ1984/masqr | Reorg | false | 8,860 | [
"MIT"
] | 0 | a57a60d1011aa70317f5893fc05bfb0f029cafb5 | https://github.com/AmitNativ1984/masqr/tree/a57a60d1011aa70317f5893fc05bfb0f029cafb5 |
PositionwiseFeedForward | import math
import torch
from torch import nn
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the 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.triton_helpers import libdevice
import math
from to... | AdrianVandierAst/fast-bert | PositionwiseFeedForward | false | 8,861 | [
"Apache-2.0"
] | 0 | f5adb426accee4a1882cdd4372fced4ef922c978 | https://github.com/AdrianVandierAst/fast-bert/tree/f5adb426accee4a1882cdd4372fced4ef922c978 |
Coboundary | import torch
import torch.nn as nn
import torch.nn.functional
class Coboundary(nn.Module):
def __init__(self, C_in, C_out, enable_bias=True, variance=1.0):
super().__init__()
assert C_in > 0
assert C_out > 0
self.C_in = C_in
self.C_out = C_out
self.enable_bias = en... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._... | AtreusCorp/simplicial_neural_networks | Coboundary | false | 8,862 | [
"MIT"
] | 0 | 7a903dd02494811ace0d86e36476059e156fc15c | https://github.com/AtreusCorp/simplicial_neural_networks/tree/7a903dd02494811ace0d86e36476059e156fc15c |
UpsampleCat | import torch
import torch.nn as nn
import torch.nn.functional as F
class UpsampleCat(nn.Module):
"""
Unsample input and concat with contracting tensor
"""
def __init__(self, ch):
super(UpsampleCat, self).__init__()
self.up_conv = nn.Conv2d(ch, ch // 2, 3, padding=1)
self.up = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Aoi-hosizora/UNet-pytorch | UpsampleCat | false | 8,863 | [
"MIT"
] | 0 | 96951d5d1fdc6c6266a11e1bd97fbf72010bc87d | https://github.com/Aoi-hosizora/UNet-pytorch/tree/96951d5d1fdc6c6266a11e1bd97fbf72010bc87d |
GlobalAvgPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class GlobalAvgPool2d(nn.Module):
def __init__(self):
super(GlobalAvgPool2d, self).__init__()
def forward(self, x):
N = x.data.size(0)
C = x.data.size(1)
H = x.data.size(2)
W = x.data.size(3)
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
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AmitNativ1984/masqr | GlobalAvgPool2d | false | 8,864 | [
"MIT"
] | 0 | a57a60d1011aa70317f5893fc05bfb0f029cafb5 | https://github.com/AmitNativ1984/masqr/tree/a57a60d1011aa70317f5893fc05bfb0f029cafb5 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPoolStride1(nn.Module):
def __init__(self):
super(MaxPoolStride1, self).__init__()
def forward(self, x):
x = F.max_pool2d(F.pad(x, (0, 1, 0, 1), mode='replicate'), 2, stride=1)
return x
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | AmitNativ1984/masqr | MaxPoolStride1 | false | 8,865 | [
"MIT"
] | 0 | a57a60d1011aa70317f5893fc05bfb0f029cafb5 | https://github.com/AmitNativ1984/masqr/tree/a57a60d1011aa70317f5893fc05bfb0f029cafb5 |
ComparisonModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class ComparisonModule(nn.Module):
""" A neural module that takes as input two feature maps and produces a feature map as output.
Extended Summary
----------------
A :class:`ComparisonModule` takes two feature maps as input and concat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ArjitJ/tbd-nets | ComparisonModule | false | 8,866 | [
"MIT"
] | 0 | 8e93ecad54489706ec3249c9ca5d345d6866e1ba | https://github.com/ArjitJ/tbd-nets/tree/8e93ecad54489706ec3249c9ca5d345d6866e1ba |
Conv2dRelu_Fixed | import torch
from torch import nn
import torch.nn.functional as F
import torch.cuda
import torch.backends.cudnn
import torch.backends.mkl
import torch.backends.cuda
import torch.backends.quantized
class Conv2dRelu_Fixed(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(Conv2dRelu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | CaoZhongZ/intel-extension-for-pytorch | Conv2dRelu_Fixed | false | 8,867 | [
"Apache-2.0"
] | 0 | 13c3dcbd6876cc57c08d3db4e50dc435ae96a91d | https://github.com/CaoZhongZ/intel-extension-for-pytorch/tree/13c3dcbd6876cc57c08d3db4e50dc435ae96a91d |
Block | import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNorm(nn.Module):
""" LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with
shape (batch_size, height, width, 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.triton_helpers import libdevice
import torch.nn as ... | AnweshCR7/convNeXt | Block | false | 8,868 | [
"MIT"
] | 0 | 5400dd0f7c793f497057f5548b49e3969a540504 | https://github.com/AnweshCR7/convNeXt/tree/5400dd0f7c793f497057f5548b49e3969a540504 |
MultiHeadedAttention | import math
import torch
from torch import Tensor
import torch.nn as nn
class MultiHeadedAttention(nn.Module):
"""
Multi-Head Attention module from "Attention is All You Need"
Implementation modified from OpenNMT-py.
https://github.com/OpenNMT/OpenNMT-py
"""
def __init__(self, num_heads: 'in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AlexShypula/joeynmt | MultiHeadedAttention | false | 8,869 | [
"Apache-2.0"
] | 0 | 045f86916dbebc4fbaccaaec17b8c7f665392194 | https://github.com/AlexShypula/joeynmt/tree/045f86916dbebc4fbaccaaec17b8c7f665392194 |
Upsample | import torch
import torch.nn as nn
class Upsample(nn.Module):
def __init__(self, stride=2):
super(Upsample, self).__init__()
self.stride = stride
def forward(self, x):
stride = self.stride
assert x.data.dim() == 4
B = x.data.size(0)
C = x.data.size(1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AmitNativ1984/masqr | Upsample | false | 8,870 | [
"MIT"
] | 0 | a57a60d1011aa70317f5893fc05bfb0f029cafb5 | https://github.com/AmitNativ1984/masqr/tree/a57a60d1011aa70317f5893fc05bfb0f029cafb5 |
MedianPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.modules.utils import _quadruple
class MedianPool2d(nn.Module):
"""Median pool (usable as median filter when stride=1) module.
Args:
kernel_size: size of pooling kernel, int or 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.triton_helpers import math as tl_math
import torch.nn as nn
from torch.nn.modules.utils import _pair
from torch... | Arnakii/invertinggradients | MedianPool2d | false | 8,871 | [
"MIT"
] | 0 | c4f66fc9c73f0a18e9ddf01650c0e82fe3998013 | https://github.com/Arnakii/invertinggradients/tree/c4f66fc9c73f0a18e9ddf01650c0e82fe3998013 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self) ->None:
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BatFresh/Resoure_variation | Net | false | 8,872 | [
"MIT"
] | 0 | a55d182b7bdd2b65d7ad10c9f8cfcb45436ad291 | https://github.com/BatFresh/Resoure_variation/tree/a55d182b7bdd2b65d7ad10c9f8cfcb45436ad291 |
merge | import torch
import torch.nn as nn
class merge(nn.Module):
def forward(self, x, y):
return x + y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Arno3165229/Corner_Traffic_Light | merge | false | 8,873 | [
"BSD-3-Clause"
] | 0 | 91eead49318a3b1e3a9c2295cbe5661cb1074b69 | https://github.com/Arno3165229/Corner_Traffic_Light/tree/91eead49318a3b1e3a9c2295cbe5661cb1074b69 |
RegressionModel | import torch
import torch.nn as nn
class RegressionModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, feature_size=256):
super(RegressionModel, self).__init__()
self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3,
padding=1)
self.act1 = nn.ReL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AdityaKane2001/answersheet_automation | RegressionModel | false | 8,874 | [
"Apache-2.0"
] | 0 | f7f30a514f94bfbdb68ab43a3dfc6e3fd770e8f1 | https://github.com/AdityaKane2001/answersheet_automation/tree/f7f30a514f94bfbdb68ab43a3dfc6e3fd770e8f1 |
Self_Attn | import torch
import torch.nn as nn
class Self_Attn(nn.Module):
""" Self attention Layer"""
def __init__(self, in_dim):
super().__init__()
self.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim //
2, kernel_size=1)
self.key_conv = nn.Conv2d(in_channels=in_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.... | Aympab/DCGAN | Self_Attn | false | 8,875 | [
"Apache-2.0"
] | 0 | 2d5aeb62e33f31fc5bfcfdac8b951cd7ae144b96 | https://github.com/Aympab/DCGAN/tree/2d5aeb62e33f31fc5bfcfdac8b951cd7ae144b96 |
L2Norm | import torch
import torch.nn as nn
import torch.nn.init as init
from itertools import product as product
from math import sqrt as sqrt
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.init as init
from itertools import produc... | AndOneDay/PytorchSSD | L2Norm | false | 8,876 | [
"MIT"
] | 0 | a9f2cde8d149e14cab3feb0084b5be3c1e6c97c6 | https://github.com/AndOneDay/PytorchSSD/tree/a9f2cde8d149e14cab3feb0084b5be3c1e6c97c6 |
InvConv2d | import torch
from torch import nn
from torch.nn import functional as F
class InvConv2d(nn.Module):
def __init__(self, in_channel):
super().__init__()
weight = torch.randn(in_channel, in_channel)
q, _ = torch.qr(weight)
weight = q.unsqueeze(2).unsqueeze(3)
self.weight = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.nn import functional as F
assert_size_stride = t... | AvivNavon/glow-pytorch | InvConv2d | false | 8,877 | [
"MIT"
] | 0 | de0fb2c1d8a4000337b2fbd1215df68530070431 | https://github.com/AvivNavon/glow-pytorch/tree/de0fb2c1d8a4000337b2fbd1215df68530070431 |
injective_pad | import torch
import torch.nn as nn
class injective_pad(nn.Module):
def __init__(self, pad_size):
super(injective_pad, self).__init__()
self.pad_size = pad_size
self.pad = nn.ZeroPad2d((0, 0, 0, pad_size))
def forward(self, x):
x = x.permute(0, 2, 1, 3)
x = self.pad(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
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Arnakii/invertinggradients | injective_pad | false | 8,878 | [
"MIT"
] | 0 | c4f66fc9c73f0a18e9ddf01650c0e82fe3998013 | https://github.com/Arnakii/invertinggradients/tree/c4f66fc9c73f0a18e9ddf01650c0e82fe3998013 |
psi | import torch
import torch.nn as nn
class psi(nn.Module):
def __init__(self, block_size):
super(psi, self).__init__()
self.block_size = block_size
self.block_size_sq = block_size * block_size
def inverse(self, input):
output = input.permute(0, 2, 3, 1)
batch_size, d_he... | 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... | Arnakii/invertinggradients | psi | false | 8,879 | [
"MIT"
] | 0 | c4f66fc9c73f0a18e9ddf01650c0e82fe3998013 | https://github.com/Arnakii/invertinggradients/tree/c4f66fc9c73f0a18e9ddf01650c0e82fe3998013 |
QueryModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class QueryModule(nn.Module):
""" A neural module that takes as input a feature map and an attention and produces a feature
map as output.
Extended Summary
----------------
A :class:`QueryModule` takes a feature map and an attenti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ArjitJ/tbd-nets | QueryModule | false | 8,880 | [
"MIT"
] | 0 | 8e93ecad54489706ec3249c9ca5d345d6866e1ba | https://github.com/ArjitJ/tbd-nets/tree/8e93ecad54489706ec3249c9ca5d345d6866e1ba |
PrimaryCapsule | import torch
import torch.nn as nn
def squash(inputs, axis=-1):
"""
The non-linear activation used in Capsule. It drives the length of a large vector to near 1 and small vector to 0
:param inputs: vectors to be squashed
:param axis: the axis to squash
:return: a Tensor with same size as inputs
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Arno3165229/Corner_Traffic_Light | PrimaryCapsule | false | 8,881 | [
"BSD-3-Clause"
] | 0 | 91eead49318a3b1e3a9c2295cbe5661cb1074b69 | https://github.com/Arno3165229/Corner_Traffic_Light/tree/91eead49318a3b1e3a9c2295cbe5661cb1074b69 |
upsample | import torch
import torch.nn as nn
class upsample(nn.Module):
def __init__(self, scale_factor):
super(upsample, self).__init__()
self.scale_factor = scale_factor
def forward(self, x):
return nn.functional.interpolate(x, scale_factor=self.scale_factor)
def get_inputs():
return [... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Arno3165229/Corner_Traffic_Light | upsample | false | 8,882 | [
"BSD-3-Clause"
] | 0 | 91eead49318a3b1e3a9c2295cbe5661cb1074b69 | https://github.com/Arno3165229/Corner_Traffic_Light/tree/91eead49318a3b1e3a9c2295cbe5661cb1074b69 |
Model | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.fc1 = nn.Linear(4, 8)
self.relu = nn.ReLU()
self.fc2 = nn.Linear(8, 3)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
x = self.relu(self.fc1(x)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Catastropha/ignis | Model | false | 8,883 | [
"MIT"
] | 0 | 0fce3b4502666bf3257670c11e3a9c018e04baac | https://github.com/Catastropha/ignis/tree/0fce3b4502666bf3257670c11e3a9c018e04baac |
GaussianSample | import torch
import torch.nn as nn
class Stochastic(nn.Module):
"""
Base stochastic layer that uses the
reparametrization trick [Kingma 2013]
to draw a sample from a distribution
parametrised by mu and log_var.
"""
def reparametrize(self, mu, logvar):
epsilon = torch.randn(mu.size... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math... | ChengF-Lab/scIVA | GaussianSample | false | 8,884 | [
"MIT"
] | 0 | f70a927531dd16236dff30decbe77f0552ad4f2d | https://github.com/ChengF-Lab/scIVA/tree/f70a927531dd16236dff30decbe77f0552ad4f2d |
OutConv | import torch
import numpy as np
import torch.nn as nn
from abc import abstractmethod
class BaseModel(nn.Module):
"""
Base class for all models
"""
@abstractmethod
def forward(self, *inputs):
"""
Forward pass logic
:return: Model output
"""
raise NotImpleme... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
from abc import abstractmethod
assert_s... | ActonMartin/Unet_pytorch | OutConv | false | 8,885 | [
"MIT"
] | 0 | 561c596d65fd5976426366283a527d341e09d1e7 | https://github.com/ActonMartin/Unet_pytorch/tree/561c596d65fd5976426366283a527d341e09d1e7 |
Policy | import torch
import torch.nn as nn
import torch.nn.functional as F
class Policy(nn.Module):
def __init__(self, state_size, action_size):
super(Policy, self).__init__()
self.state_size = state_size
self.action_size = action_size
self.fc1 = nn.Linear(state_size, 125)
self.fc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Brandon-Rozek/EvolutionaryAlgo | Policy | false | 8,886 | [
"MIT"
] | 0 | 9652327bd5aa7791dc7f2aa5b3e680f9df05638d | https://github.com/Brandon-Rozek/EvolutionaryAlgo/tree/9652327bd5aa7791dc7f2aa5b3e680f9df05638d |
FFN | import torch
import torch.nn as nn
class FFN(nn.Module):
"""Feed Forward Network."""
def __init__(self, num_features: 'int', ffn_dim_1: 'int', ffn_dim_2: 'int'
) ->None:
"""Initialize the class."""
super().__init__()
self.gemm1 = nn.Linear(num_features, ffn_dim_1, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BruceRayWilson/sambanova_starter | FFN | false | 8,887 | [
"MIT"
] | 0 | be1b01369b040d00f174a0ee1fdb22e89ef40062 | https://github.com/BruceRayWilson/sambanova_starter/tree/be1b01369b040d00f174a0ee1fdb22e89ef40062 |
CrossEntropy | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch._utils
import torch.optim
class CrossEntropy(nn.Module):
def __init__(self, ignore_label=-1, weight=None):
super(CrossEntropy, self).__init__()
self.ignore_label = ignore_label
self.criterion = nn.CrossEn... | 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
... | ChenyangWang1/HRnet_Face_Parsing | CrossEntropy | false | 8,888 | [
"MIT"
] | 0 | 07ac757147865c95b0da1d15ea32608f38ca099c | https://github.com/ChenyangWang1/HRnet_Face_Parsing/tree/07ac757147865c95b0da1d15ea32608f38ca099c |
LogReg | import torch
import torch.nn as nn
class LogReg(nn.Module):
"""Logreg class."""
def __init__(self, num_features: 'int', num_classes: 'int'):
"""Initialize the class."""
super().__init__()
self.lin_layer = nn.Linear(in_features=num_features, out_features=
num_classes, 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 import triton_helpers
from torch._inductor.runtime.... | BruceRayWilson/sambanova_starter | LogReg | false | 8,889 | [
"MIT"
] | 0 | be1b01369b040d00f174a0ee1fdb22e89ef40062 | https://github.com/BruceRayWilson/sambanova_starter/tree/be1b01369b040d00f174a0ee1fdb22e89ef40062 |
BiDAFAttention | 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.... | Antimortine/made_nlp_course | BiDAFAttention | false | 8,890 | [
"MIT"
] | 0 | 2094e02751462f292d9dec75d02ad8c0672eda9b | https://github.com/Antimortine/made_nlp_course/tree/2094e02751462f292d9dec75d02ad8c0672eda9b |
ClassificationModel | import torch
import torch.nn as nn
class ClassificationModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, num_classes=80,
prior=0.01, feature_size=256):
super(ClassificationModel, self).__init__()
self.num_classes = num_classes
self.num_anchors = num_anchors
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AdityaKane2001/answersheet_automation | ClassificationModel | false | 8,891 | [
"Apache-2.0"
] | 0 | f7f30a514f94bfbdb68ab43a3dfc6e3fd770e8f1 | https://github.com/AdityaKane2001/answersheet_automation/tree/f7f30a514f94bfbdb68ab43a3dfc6e3fd770e8f1 |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel=3):
super(SpatialAttention, self).__init__()
self.conv1 = nn.Conv2d(2, 1, kernel_size=kernel, padding=kernel //
2, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Alpkant/CDCN | SpatialAttention | false | 8,892 | [
"MIT"
] | 0 | 4d4401824b8652a10739615e02e67148521739d2 | https://github.com/Alpkant/CDCN/tree/4d4401824b8652a10739615e02e67148521739d2 |
TestMul | import torch
import torch.nn as nn
class TestMul(nn.Module):
"""Module for Element-wise multiplication conversion testing
"""
def __init__(self, inp=10, out=16, kernel_size=3, bias=True):
super(TestMul, self).__init__()
self.conv2d_1 = nn.Conv2d(inp, out, stride=inp % 3 + 1, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AliaksandrSiarohin/pytorch2keras | TestMul | false | 8,893 | [
"MIT"
] | 0 | 9c8ee213cff43ade152b1de78fa76fd05ec8b40a | https://github.com/AliaksandrSiarohin/pytorch2keras/tree/9c8ee213cff43ade152b1de78fa76fd05ec8b40a |
QREmbeddingBag | import torch
import numpy as np
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
class QREmbeddingBag(nn.Module):
"""Computes sums or means over two 'bags' of embeddings, one using the quotient
of the indices and the other using the remainder of the indices, witho... | 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 numpy as np
import torch.nn as nn
from torch.nn.parameter import Paramet... | Com1t/dlrm | QREmbeddingBag | false | 8,894 | [
"MIT"
] | 0 | fdbae97a974507758296637e0041e80fe3b00ae5 | https://github.com/Com1t/dlrm/tree/fdbae97a974507758296637e0041e80fe3b00ae5 |
TestConv2d | import torch
import torch.nn as nn
class TestConv2d(nn.Module):
"""Module for Dense conversion testing
"""
def __init__(self, inp=10, out=16, kernel_size=3, dilation=1, bias=True):
super(TestConv2d, self).__init__()
self.conv2d = nn.Conv2d(inp, out, kernel_size=kernel_size, 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... | AliaksandrSiarohin/pytorch2keras | TestConv2d | false | 8,895 | [
"MIT"
] | 0 | 9c8ee213cff43ade152b1de78fa76fd05ec8b40a | https://github.com/AliaksandrSiarohin/pytorch2keras/tree/9c8ee213cff43ade152b1de78fa76fd05ec8b40a |
AttentionalColorizedListenerDecoder | import torch
import torch.nn as nn
import torch.utils.data
class QuadraticForm(torch.autograd.Function):
"""
This is a custom function that, given two parameters mew and sigma, implements quadratic form.
This function takes a representation of a color in vector space and returns a unnormalized score attr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Christopher-Leung/cs224u | AttentionalColorizedListenerDecoder | false | 8,896 | [
"Apache-2.0"
] | 0 | c7d5a73d57156afa105c15b0bf33140aede088cb | https://github.com/Christopher-Leung/cs224u/tree/c7d5a73d57156afa105c15b0bf33140aede088cb |
LocationLayer | import torch
import torch.utils.data
from torch import nn
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias)
torch.nn.init.xavier_unifor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyna... | Charlottecuc/Cross-Lingual-Voice-Cloning | LocationLayer | false | 8,897 | [
"BSD-3-Clause"
] | 0 | 8bc8ead0ca121d9ef606c46e1ccc42467661ebdc | https://github.com/Charlottecuc/Cross-Lingual-Voice-Cloning/tree/8bc8ead0ca121d9ef606c46e1ccc42467661ebdc |
AttentionPool | import torch
import torch.nn as nn
class AttentionPool(nn.Module):
"""docstring for AttentionPool"""
def __init__(self, inputdim, outputdim=10, pooldim=1, **kwargs):
super().__init__()
self.inputdim = inputdim
self.outputdim = outputdim
self.pooldim = pooldim
self.tran... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AjianIronSide/Datadriven-GPVAD | AttentionPool | false | 8,898 | [
"MIT"
] | 0 | 8590b5f794beb9640b8fe70ac1f5add5944425b3 | https://github.com/AjianIronSide/Datadriven-GPVAD/tree/8590b5f794beb9640b8fe70ac1f5add5944425b3 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64,
fc2_units=64):
"""Initialize parameters and build model.
Params
======
state_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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | CCThompson82/deep-reinforcement-learning | QNetwork | false | 8,899 | [
"MIT"
] | 0 | f93faf0fb2b2dd8cfafeb8a4480e5520cefe6cb2 | https://github.com/CCThompson82/deep-reinforcement-learning/tree/f93faf0fb2b2dd8cfafeb8a4480e5520cefe6cb2 |
TestSub | import torch
import torch.nn as nn
class TestSub(nn.Module):
"""Module for Element-wise subtaction conversion testing
"""
def __init__(self, inp=10, out=16, kernel_size=3, bias=True):
super(TestSub, self).__init__()
self.conv2d_1 = nn.Conv2d(inp, out, stride=inp % 3 + 1, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AliaksandrSiarohin/pytorch2keras | TestSub | false | 8,900 | [
"MIT"
] | 0 | 9c8ee213cff43ade152b1de78fa76fd05ec8b40a | https://github.com/AliaksandrSiarohin/pytorch2keras/tree/9c8ee213cff43ade152b1de78fa76fd05ec8b40a |
Classifier | import torch
from torch import nn
import torch.nn.functional as F
class Classifier(nn.Module):
def __init__(self, input_size):
super().__init__()
self.hidden_1 = nn.Linear(input_size, 100)
self.hidden_2 = nn.Linear(100, 100)
self.hidden_3 = nn.Linear(100, 50)
self.hidden_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 import triton_helpers
from torch._inductor.runtime.... | ChengJiacheng/Applied-Deep-Learning-with-PyTorch | Classifier | false | 8,901 | [
"MIT"
] | 0 | 260d3ad3929705f615c758dd72f9539f390461bf | https://github.com/ChengJiacheng/Applied-Deep-Learning-with-PyTorch/tree/260d3ad3929705f615c758dd72f9539f390461bf |
MaxPool | import torch
import torch.nn as nn
class MaxPool(nn.Module):
"""Module for MaxPool conversion testing
"""
def __init__(self, inp=10, out=16, kernel_size=3, bias=True):
super(MaxPool, self).__init__()
self.conv2d = nn.Conv2d(inp, out, kernel_size=kernel_size, bias=bias)
self.pool =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AliaksandrSiarohin/pytorch2keras | MaxPool | false | 8,902 | [
"MIT"
] | 0 | 9c8ee213cff43ade152b1de78fa76fd05ec8b40a | https://github.com/AliaksandrSiarohin/pytorch2keras/tree/9c8ee213cff43ade152b1de78fa76fd05ec8b40a |
TestConvTranspose2d | import torch
import torch.nn as nn
class TestConvTranspose2d(nn.Module):
"""Module for Dense conversion testing
"""
def __init__(self, inp=10, out=16, kernel_size=3, bias=True):
super(TestConvTranspose2d, self).__init__()
self.conv2d = nn.ConvTranspose2d(inp, out, padding=1, stride=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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AliaksandrSiarohin/pytorch2keras | TestConvTranspose2d | false | 8,903 | [
"MIT"
] | 0 | 9c8ee213cff43ade152b1de78fa76fd05ec8b40a | https://github.com/AliaksandrSiarohin/pytorch2keras/tree/9c8ee213cff43ade152b1de78fa76fd05ec8b40a |
AvgPool | import torch
import torch.nn as nn
class AvgPool(nn.Module):
"""Module for MaxPool conversion testing
"""
def __init__(self, inp=10, out=16, kernel_size=3, bias=True):
super(AvgPool, self).__init__()
self.conv2d = nn.Conv2d(inp, out, kernel_size=kernel_size, bias=bias)
self.pool =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | AliaksandrSiarohin/pytorch2keras | AvgPool | false | 8,904 | [
"MIT"
] | 0 | 9c8ee213cff43ade152b1de78fa76fd05ec8b40a | https://github.com/AliaksandrSiarohin/pytorch2keras/tree/9c8ee213cff43ade152b1de78fa76fd05ec8b40a |
FFNLogReg | import torch
import torch.nn as nn
class FFN(nn.Module):
"""Feed Forward Network."""
def __init__(self, num_features: 'int', ffn_dim_1: 'int', ffn_dim_2: 'int'
) ->None:
"""Initialize the class."""
super().__init__()
self.gemm1 = nn.Linear(num_features, ffn_dim_1, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | BruceRayWilson/sambanova_starter | FFNLogReg | false | 8,905 | [
"MIT"
] | 0 | be1b01369b040d00f174a0ee1fdb22e89ef40062 | https://github.com/BruceRayWilson/sambanova_starter/tree/be1b01369b040d00f174a0ee1fdb22e89ef40062 |
HingeMarginLoss | import torch
import torch.nn as nn
class HingeMarginLoss(nn.Module):
"""
计算hinge loss 接口
"""
def __init__(self):
super(HingeMarginLoss, self).__init__()
def forward(self, t, tr, delt=None, size_average=False):
"""
计算hingle loss
"""
if delt is None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Cuiqingyao/multilabel | HingeMarginLoss | false | 8,906 | [
"Apache-2.0"
] | 0 | f36dc6f1168a3edf8f43565477c096dc0bf31de8 | https://github.com/Cuiqingyao/multilabel/tree/f36dc6f1168a3edf8f43565477c096dc0bf31de8 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
""" Applies attention mechanism on the `context` using the `query`.
**Thank you** to IBM for their initial implementation of :class:`Attention`. Here is
their `License
<https://github.com/IBM/pytorch-seq2seq/blob/master/LICENSE>`__.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Columbine21/PyTorch-NLP | Attention | false | 8,907 | [
"BSD-3-Clause"
] | 0 | 63460d0951a0406b4b7cb99d3a290dcef0721eff | https://github.com/Columbine21/PyTorch-NLP/tree/63460d0951a0406b4b7cb99d3a290dcef0721eff |
HDRLoss | import torch
import torch.nn as nn
class HDRLoss(nn.Module):
"""High dynamic range loss."""
def __init__(self, eps=0.01):
"""Initializes loss with numerical stability epsilon."""
super(HDRLoss, self).__init__()
self._eps = eps
def forward(self, denoised, target):
"""Compu... | 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... | CirilBohak/noise2noise-pytorch | HDRLoss | false | 8,908 | [
"MIT"
] | 0 | e517366248a62ce0b7e3710199b02b27261aa639 | https://github.com/CirilBohak/noise2noise-pytorch/tree/e517366248a62ce0b7e3710199b02b27261aa639 |
_Linear | import torch
from torch import nn
class _Linear(nn.Module):
def __init__(self, input_dim=20, output_dim=10):
super(_Linear, self).__init__()
self.input_dim = int(input_dim)
self.output_dim = int(output_dim)
self.fc1 = nn.Linear(self.input_dim, self.output_dim)
self.logprob... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CoAxLab/newremagine | _Linear | false | 8,909 | [
"MIT"
] | 0 | 5ae1c579121c93271ebf5dcef45bd66e8daea3a7 | https://github.com/CoAxLab/newremagine/tree/5ae1c579121c93271ebf5dcef45bd66e8daea3a7 |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | CCThompson82/deep-reinforcement-learning | Critic | false | 8,910 | [
"MIT"
] | 0 | f93faf0fb2b2dd8cfafeb8a4480e5520cefe6cb2 | https://github.com/CCThompson82/deep-reinforcement-learning/tree/f93faf0fb2b2dd8cfafeb8a4480e5520cefe6cb2 |
MLP | import torch
from torch import nn
from torch.utils.data import *
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self):
super(MLP, self).__init__()
self.fc1 = nn.Linear(784, 512)
self.fc2 = nn.Linear(512, 128)
self.fc3 = nn.Linear(128, 10)
def forward(self,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Cjkkkk/nnfusion | MLP | false | 8,911 | [
"MIT"
] | 0 | 7ee61dfdd66fbf67eb178fcc5cfa1cddb99b3c13 | https://github.com/Cjkkkk/nnfusion/tree/7ee61dfdd66fbf67eb178fcc5cfa1cddb99b3c13 |
ReOrgLayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch._utils
class ReOrgLayer(nn.Module):
def __init__(self, stride=2):
super(ReOrgLayer, self).__init__()
self.stride = stride
def forward(self, x):
assert x.data.dim() == 4
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch._utils
assert_size_stride = torch._C._dynamo.... | AutoRaider/AlphaPose | ReOrgLayer | false | 8,912 | [
"Apache-2.0"
] | 0 | bf74882728901b033d45512b402c32277bf9246b | https://github.com/AutoRaider/AlphaPose/tree/bf74882728901b033d45512b402c32277bf9246b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.