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 |
|---|---|---|---|---|---|---|---|---|---|---|
Attention | import math
import torch
from torch import nn
class Attention(nn.Module):
"""A generic attention module for a decoder in seq2seq"""
def __init__(self, dim, use_tanh=False, C=10):
super(Attention, self).__init__()
self.use_tanh = use_tanh
self.project_query = nn.Linear(dim, 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.triton_helpers import libdevice
import math
from to... | iamstevepaul/MRTA-Attention | Attention | false | 10,230 | [
"MIT"
] | 0 | fc177440f7354212c41ad02ef76fdda43cc0aa57 | https://github.com/iamstevepaul/MRTA-Attention/tree/fc177440f7354212c41ad02ef76fdda43cc0aa57 |
AugCNN | import torch
import torch.nn as nn
import torch.nn.functional as F
def apply_init_(modules):
"""
Initialize NN modules
"""
for m in modules:
if isinstance(m, nn.Conv2d):
nn.init.xavier_uniform_(m.weight)
if m.bias is not None:
nn.init.constant_(m.bias, 0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | jajajag/auto-drac | AugCNN | false | 10,231 | [
"MIT"
] | 0 | 2241f9f5f10a4d863a8b9d198da1d39e5feb59a0 | https://github.com/jajajag/auto-drac/tree/2241f9f5f10a4d863a8b9d198da1d39e5feb59a0 |
MeanAct | import torch
import torch.nn as nn
class MeanAct(nn.Module):
def __init__(self):
super(MeanAct, self).__init__()
def forward(self, x):
return torch.clamp(torch.exp(x), min=1e-05, max=1000000.0)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[],... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | jdasam/scDCC | MeanAct | false | 10,232 | [
"Apache-2.0"
] | 0 | 8ebaed766db5ad56021983ebc13e9a60b6c7b453 | https://github.com/jdasam/scDCC/tree/8ebaed766db5ad56021983ebc13e9a60b6c7b453 |
BatchDense | import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class BatchDense(nn.Module):
def __init__(self, batch, in_features, out_features, bias_init=None):
super(BatchDense, self).__init__()
self.batch = batch
self.in_features = in_features
self.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
import math
import torch.nn as nn
from torch.nn.parameter import Parameter
asser... | iloncka/neurotrees | BatchDense | false | 10,233 | [
"MIT"
] | 0 | ddb52dc0e7ac1cf67a426b401ba06149807e03ec | https://github.com/iloncka/neurotrees/tree/ddb52dc0e7ac1cf67a426b401ba06149807e03ec |
VAE | import torch
import torch.utils.data
from torch import nn
from torch.nn import functional as F
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.input_linear = nn.Linear(4297, 2000)
self.enc_middle = nn.Linear(2000, 100)
self.enc_1 = nn.Linear(100, 5)
... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | helenaandres/adversarial-generation-of-gene-expression-data | VAE | false | 10,234 | [
"MIT"
] | 0 | 9a10f0c364b7daa789ae75ab5b51ed5c7cbcbeb1 | https://github.com/helenaandres/adversarial-generation-of-gene-expression-data/tree/9a10f0c364b7daa789ae75ab5b51ed5c7cbcbeb1 |
DispAct | import torch
import torch.nn as nn
import torch.nn.functional as F
class DispAct(nn.Module):
def __init__(self):
super(DispAct, self).__init__()
def forward(self, x):
return torch.clamp(F.softplus(x), min=0.0001, max=10000.0)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ge... | 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... | jdasam/scDCC | DispAct | false | 10,235 | [
"Apache-2.0"
] | 0 | 8ebaed766db5ad56021983ebc13e9a60b6c7b453 | https://github.com/jdasam/scDCC/tree/8ebaed766db5ad56021983ebc13e9a60b6c7b453 |
KLDLoss | import torch
import torch.nn as nn
import torch.utils.data
class KLDLoss(nn.Module):
def forward(self, mu, logvar):
return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | izhorvath/MetGAN | KLDLoss | false | 10,236 | [
"BSD-3-Clause"
] | 0 | aca85fb3306d2515a65c8d525cd78e1147ba7e1b | https://github.com/izhorvath/MetGAN/tree/aca85fb3306d2515a65c8d525cd78e1147ba7e1b |
PerturbationModule | import torch
import torch.utils.data
import torch
import torch.nn as nn
class PerturbationModule(nn.Module):
def __init__(self, T):
super(PerturbationModule, self).__init__()
self.T = T
self.training = False
self.conv_block = None
def forward(self, x):
if not self.tra... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | jeffkinnison/pytorch-CycleGAN-and-pix2pix | PerturbationModule | false | 10,237 | [
"BSD-3-Clause"
] | 0 | e47041fa4ffa80ad5948d2d1125ec94c34c5947d | https://github.com/jeffkinnison/pytorch-CycleGAN-and-pix2pix/tree/e47041fa4ffa80ad5948d2d1125ec94c34c5947d |
CIoU | import torch
from torch import nn
class CIoU(nn.Module):
def __init__(self):
super(CIoU, self).__init__()
def forward(self, inputs, targets):
size = len(inputs)
uL_truth = targets[:, 0:2]
lR_truth = targets[:, 2:4]
uL_pred = inputs[:, 0:2]
lR_pred = inputs[:, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | jcscheufele/CS545_Final | CIoU | false | 10,238 | [
"MIT"
] | 0 | d86858408a9a0aab82b5d2b7e12847023d939e2e | https://github.com/jcscheufele/CS545_Final/tree/d86858408a9a0aab82b5d2b7e12847023d939e2e |
BiaffineScorer | import torch
import torch.nn as nn
class BiaffineScorer(nn.Module):
def __init__(self, input1_size, input2_size, output_size):
super().__init__()
self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1,
output_size)
self.W_bilin.weight.data.zero_()
self.W_bilin.bia... | 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... | giorgianb/stanza | BiaffineScorer | false | 10,239 | [
"Apache-2.0"
] | 0 | e1ff1ab73c228739fea3ef5c012a9f1042bef2e3 | https://github.com/giorgianb/stanza/tree/e1ff1ab73c228739fea3ef5c012a9f1042bef2e3 |
Actor | import torch
import torch.nn.functional as F
from torch import nn
class Actor(nn.Module):
"""
Policy Network (state --> action)
"""
def __init__(self, state_size: 'int', action_size: 'int', hidden_size:
'int'=256):
super().__init__()
self.fc1 = nn.Linear(state_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
from torch._inductor.runtime.... | jadenvc/puppersim | Actor | false | 10,240 | [
"Apache-2.0"
] | 0 | 1b3f3e3fc0515d5d6101622e0d729c779debfd32 | https://github.com/jadenvc/puppersim/tree/1b3f3e3fc0515d5d6101622e0d729c779debfd32 |
BboxHead | import torch
import torch.nn as nn
from itertools import product as product
class BboxHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=2):
super(BboxHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(
1, 1), stride=1, padding=0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from itertools import product as product
assert_size_strid... | huigs/retinaface-pytorch | BboxHead | false | 10,241 | [
"MIT"
] | 0 | 0d7551d5863d172c2122bdd8d2d58be36e1b10fd | https://github.com/huigs/retinaface-pytorch/tree/0d7551d5863d172c2122bdd8d2d58be36e1b10fd |
SDFNetwork | import torch
import numpy as np
import torch.nn as nn
def get_embedder(multires, input_dims=3):
embed_kwargs = {'include_input': True, 'input_dims': input_dims,
'max_freq_log2': multires - 1, 'num_freqs': multires,
'log_sampling': True, 'periodic_fns': [torch.sin, torch.cos]}
embedder_obj = Em... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | hzwangjl/NeuS | SDFNetwork | false | 10,242 | [
"MIT"
] | 0 | f1b89176ec18e19b3848d787416dab9a1ce5300b | https://github.com/hzwangjl/NeuS/tree/f1b89176ec18e19b3848d787416dab9a1ce5300b |
Critic | import torch
import torch.nn.functional as F
from torch import nn
class Critic(nn.Module):
"""
Value Network (state + action --> value)
"""
def __init__(self, state_size: 'int', action_size: 'int', hidden_size:
'int'=256):
super().__init__()
self.fc1 = nn.Linear(state_size + 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 import nn
assert_s... | jadenvc/puppersim | Critic | false | 10,243 | [
"Apache-2.0"
] | 0 | 1b3f3e3fc0515d5d6101622e0d729c779debfd32 | https://github.com/jadenvc/puppersim/tree/1b3f3e3fc0515d5d6101622e0d729c779debfd32 |
LandmarkHead | import torch
import torch.nn as nn
from itertools import product as product
class LandmarkHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=2):
super(LandmarkHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size=
(1, 1), stride=1, padd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 itertools import product as product
assert_size_strid... | huigs/retinaface-pytorch | LandmarkHead | false | 10,244 | [
"MIT"
] | 0 | 0d7551d5863d172c2122bdd8d2d58be36e1b10fd | https://github.com/huigs/retinaface-pytorch/tree/0d7551d5863d172c2122bdd8d2d58be36e1b10fd |
SpatialSELayer1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialSELayer1d(nn.Module):
def __init__(self, num_channels):
"""
:param num_channels: No of input channels
"""
super(SpatialSELayer1d, self).__init__()
self.conv = nn.Conv1d(num_channels, 1, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ioanvl/1d_squeeze_excitation | SpatialSELayer1d | false | 10,245 | [
"MIT"
] | 0 | f422dc4b8e7de6239a6fb7d1688048db5053e733 | https://github.com/ioanvl/1d_squeeze_excitation/tree/f422dc4b8e7de6239a6fb7d1688048db5053e733 |
ClassHead | import torch
import torch.nn as nn
from itertools import product as product
class ClassHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=2):
super(ClassHead, self).__init__()
self.num_anchors = num_anchors
self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 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
from itertools import product as product
assert_size_strid... | huigs/retinaface-pytorch | ClassHead | false | 10,246 | [
"MIT"
] | 0 | 0d7551d5863d172c2122bdd8d2d58be36e1b10fd | https://github.com/huigs/retinaface-pytorch/tree/0d7551d5863d172c2122bdd8d2d58be36e1b10fd |
CNormalized_Linear | import math
import torch
import torch as th
class CNormalized_Linear(th.nn.Module):
"""Linear layer with column-wise normalized input matrix."""
def __init__(self, in_features, out_features, bias=False):
"""Initialize the layer."""
super(CNormalized_Linear, self).__init__()
self.in_fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | edgarvardanyan/CausalDiscoveryToolbox | CNormalized_Linear | false | 10,247 | [
"MIT"
] | 0 | 5497a400440b49a3af14a0c7512bcdd307c9285d | https://github.com/edgarvardanyan/CausalDiscoveryToolbox/tree/5497a400440b49a3af14a0c7512bcdd307c9285d |
ChannelSELayer1d | import torch
import torch.nn as nn
class ChannelSELayer1d(nn.Module):
def __init__(self, num_channels, reduction_ratio=4):
"""
:param num_channels: No of input channels
:param reduction_ratio: By how much should the num_channels should be reduced
"""
super(ChannelSELayer1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ioanvl/1d_squeeze_excitation | ChannelSELayer1d | false | 10,248 | [
"MIT"
] | 0 | f422dc4b8e7de6239a6fb7d1688048db5053e733 | https://github.com/ioanvl/1d_squeeze_excitation/tree/f422dc4b8e7de6239a6fb7d1688048db5053e733 |
Linear3D | import math
import torch
import torch as th
from torch.nn import Parameter
def functional_linear3d(input, weight, bias=None):
"""
Apply a linear transformation to the incoming data: :math:`y = xA^T + b`.
Shape:
- Input: :math:`(N, *, in\\_features)` where `*` means any number of
additio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 as th
from torch.nn import Parameter
assert_size_stride... | edgarvardanyan/CausalDiscoveryToolbox | Linear3D | false | 10,249 | [
"MIT"
] | 0 | 5497a400440b49a3af14a0c7512bcdd307c9285d | https://github.com/edgarvardanyan/CausalDiscoveryToolbox/tree/5497a400440b49a3af14a0c7512bcdd307c9285d |
GCNLayer | import torch
import torch.nn as nn
class GCNLayer(nn.Module):
def __init__(self, in_ft, out_ft, bias=True):
super(GCNLayer, self).__init__()
self.fc = nn.Linear(in_ft, out_ft, bias=False)
self.act = nn.PReLU()
if bias:
self.bias = nn.Parameter(torch.FloatTensor(out_ft)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | jaynee156/GNN-thesis | GCNLayer | false | 10,250 | [
"MIT"
] | 0 | fe8a731698dedb6cf76f7130658a646664a79b09 | https://github.com/jaynee156/GNN-thesis/tree/fe8a731698dedb6cf76f7130658a646664a79b09 |
Net | import torch
import torch.utils.data
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=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
from torch._inductor.runtime.... | iquintero/sagemaker-pytorch-container | Net | false | 10,251 | [
"Apache-2.0"
] | 0 | 70f64c87e549ae833d7f2ef2f15f01542ff5678e | https://github.com/iquintero/sagemaker-pytorch-container/tree/70f64c87e549ae833d7f2ef2f15f01542ff5678e |
ValueFunction | import torch
import torch.nn as nn
import torch.nn.functional as F
class ValueFunction(nn.Module):
"""fully connected 200x200 hidden layers"""
def __init__(self, state_dim):
super(ValueFunction, self).__init__()
self.fc1 = nn.Linear(state_dim, 200)
self.fc2 = nn.Linear(200, 200)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | himanshusahni/task-biased-url | ValueFunction | false | 10,252 | [
"MIT"
] | 0 | 28e4ec318d46d84065b6e197fa9f4100bd4a4c34 | https://github.com/himanshusahni/task-biased-url/tree/28e4ec318d46d84065b6e197fa9f4100bd4a4c34 |
CrossAttention | import torch
from torch import nn
class MultiHeadAttention(nn.Module):
"""
Multi head attention for Perceiver https://arxiv.org/pdf/2103.03206.pdf.
Args:
num_q_channels (`int`):
Number of q channels.
num_kv_channels (`int`):
Number of k or v channels. k has the same... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jennyli-z/towhee | CrossAttention | false | 10,253 | [
"Apache-2.0"
] | 0 | 55c55fd961229575b75eae269b55090c839f8dcd | https://github.com/jennyli-z/towhee/tree/55c55fd961229575b75eae269b55090c839f8dcd |
DenseBlock | import torch
from torch import nn
from torch.nn import functional as F
class CausalConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2):
super(CausalConv1d, self).__init__()
self.padding = dilation
self.causal_conv = nn.Conv1d(in_channels, out_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | heyitsmine/FewRel | DenseBlock | false | 10,254 | [
"MIT"
] | 0 | 2a2b8ae471298d9eb3557796a085c23b21982fb2 | https://github.com/heyitsmine/FewRel/tree/2a2b8ae471298d9eb3557796a085c23b21982fb2 |
CausalConv1d | import torch
from torch import nn
class CausalConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2):
super(CausalConv1d, self).__init__()
self.padding = dilation
self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size,
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | heyitsmine/FewRel | CausalConv1d | false | 10,255 | [
"MIT"
] | 0 | 2a2b8ae471298d9eb3557796a085c23b21982fb2 | https://github.com/heyitsmine/FewRel/tree/2a2b8ae471298d9eb3557796a085c23b21982fb2 |
QValueFunction | import torch
import torch.nn as nn
import torch.nn.functional as F
class QValueFunction(nn.Module):
"""fully connected 200x200 hidden layers"""
def __init__(self, state_dim, action_dim):
super(QValueFunction, self).__init__()
self.fc1 = nn.Linear(state_dim + action_dim, 200)
self.fc2 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | himanshusahni/task-biased-url | QValueFunction | false | 10,256 | [
"MIT"
] | 0 | 28e4ec318d46d84065b6e197fa9f4100bd4a4c34 | https://github.com/himanshusahni/task-biased-url/tree/28e4ec318d46d84065b6e197fa9f4100bd4a4c34 |
Gate | import torch
import torch.nn as nn
class Gate(nn.Module):
def __init__(self, input_dim):
super(Gate, self).__init__()
self.linear = nn.Linear(input_dim * 4, 1, bias=True)
self.sigmoid = nn.Sigmoid()
def forward(self, x, y):
z = torch.cat([x, y, x * y, x - y], dim=2)
r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | hgrhgy/NumSeq2SQL | Gate | false | 10,257 | [
"MIT"
] | 0 | 6f22fdf108736f979afa2dbd3af14aa9ad4718aa | https://github.com/hgrhgy/NumSeq2SQL/tree/6f22fdf108736f979afa2dbd3af14aa9ad4718aa |
ChannelSpatialSELayer1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer1d(nn.Module):
def __init__(self, num_channels, reduction_ratio=4):
"""
:param num_channels: No of input channels
:param reduction_ratio: By how much should the num_channels should be reduced
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | ioanvl/1d_squeeze_excitation | ChannelSpatialSELayer1d | false | 10,258 | [
"MIT"
] | 0 | f422dc4b8e7de6239a6fb7d1688048db5053e733 | https://github.com/ioanvl/1d_squeeze_excitation/tree/f422dc4b8e7de6239a6fb7d1688048db5053e733 |
GaussianPolicyFunction | import torch
import torch.nn as nn
import torch.nn.functional as F
class GaussianPolicyFunction(nn.Module):
"""fully connected 200x200 hidden layers"""
def __init__(self, state_dim, action_dim):
super(GaussianPolicyFunction, self).__init__()
self.fc1 = nn.Linear(state_dim, 200)
self.f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | himanshusahni/task-biased-url | GaussianPolicyFunction | false | 10,259 | [
"MIT"
] | 0 | 28e4ec318d46d84065b6e197fa9f4100bd4a4c34 | https://github.com/himanshusahni/task-biased-url/tree/28e4ec318d46d84065b6e197fa9f4100bd4a4c34 |
SkillDiscriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
class SkillDiscriminator(nn.Module):
"""fully connected 200x200 layers for inferring q(z|s)"""
def __init__(self, state_dim, nb_skills):
super(SkillDiscriminator, self).__init__()
self.fc1 = nn.Linear(state_dim, 200)
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.... | himanshusahni/task-biased-url | SkillDiscriminator | false | 10,260 | [
"MIT"
] | 0 | 28e4ec318d46d84065b6e197fa9f4100bd4a4c34 | https://github.com/himanshusahni/task-biased-url/tree/28e4ec318d46d84065b6e197fa9f4100bd4a4c34 |
OutConv | import torch
import torch.nn as nn
class OutConv(nn.Module):
def __init__(self, inChannels, outChannels):
super(OutConv, self).__init__()
self.conv = nn.Conv2d(inChannels, outChannels, kernel_size=1)
self.tanh = nn.Tanh()
def forward(self, input_):
return self.tanh(self.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.triton_helpers import libdevice
import torch.nn as ... | iabd/Dereverbify | OutConv | false | 10,261 | [
"MIT"
] | 0 | e0c2e40c6813cf5528c3e0a1d697085444fb23b2 | https://github.com/iabd/Dereverbify/tree/e0c2e40c6813cf5528c3e0a1d697085444fb23b2 |
DiscretePolicyFunction | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiscretePolicyFunction(nn.Module):
"""fully connected 200x200 hidden layers"""
def __init__(self, state_dim, action_dim):
super(DiscretePolicyFunction, self).__init__()
self.fc1 = nn.Linear(state_dim, 200)
self.f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | himanshusahni/task-biased-url | DiscretePolicyFunction | false | 10,263 | [
"MIT"
] | 0 | 28e4ec318d46d84065b6e197fa9f4100bd4a4c34 | https://github.com/himanshusahni/task-biased-url/tree/28e4ec318d46d84065b6e197fa9f4100bd4a4c34 |
AttentionPool2d | import math
import torch
import numpy as np
import torch.nn as nn
import torch as th
def count_flops_attn(model, _x, y):
"""
A counter for the `thop` package to count the operations in an
attention operation.
Meant to be used like:
macs, params = thop.profile(
model,
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.... | jasperhu13/deit | AttentionPool2d | false | 10,265 | [
"Apache-2.0"
] | 0 | 97b09b1c131a7ee8d01ee0ce27a936ff33cf62fc | https://github.com/jasperhu13/deit/tree/97b09b1c131a7ee8d01ee0ce27a936ff33cf62fc |
PatchEmbed | import torch
import torch.nn as nn
class PatchEmbed(nn.Module):
"""
PatchEmbed.
"""
def __init__(self, dim_in=3, dim_out=768, kernel=(1, 16, 16), stride=(1,
4, 4), padding=(1, 7, 7), conv_2d=False):
super().__init__()
if conv_2d:
conv = nn.Conv2d
else:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jasperhu13/deit | PatchEmbed | false | 10,266 | [
"Apache-2.0"
] | 0 | 97b09b1c131a7ee8d01ee0ce27a936ff33cf62fc | https://github.com/jasperhu13/deit/tree/97b09b1c131a7ee8d01ee0ce27a936ff33cf62fc |
SiglogModule | import torch
import torch.nn as nn
def siglog(v):
return v.sign() * torch.log(1 + v.abs())
class SiglogModule(nn.Module):
def forward(self, v):
return siglog(v)
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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | finalgruntgit/diautils | SiglogModule | false | 10,267 | [
"MIT"
] | 0 | b9d7666ed5023700db01a4295430c52721acfc25 | https://github.com/finalgruntgit/diautils/tree/b9d7666ed5023700db01a4295430c52721acfc25 |
MeanModule | import torch
import torch.nn as nn
class MeanModule(nn.Module):
def __init__(self, *axis, keepdim=False):
super().__init__()
self.axis = axis
self.keepdim = keepdim
def forward(self, v):
mean = v.mean(self.axis)
if self.keepdim:
dims = list(v.shape)
... | 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... | finalgruntgit/diautils | MeanModule | false | 10,268 | [
"MIT"
] | 0 | b9d7666ed5023700db01a4295430c52721acfc25 | https://github.com/finalgruntgit/diautils/tree/b9d7666ed5023700db01a4295430c52721acfc25 |
Attention | import torch
from torch import nn
class Attention(nn.Module):
def __init__(self, feature_dim, K, bias=True, **kwargs):
super(Attention, self).__init__(**kwargs)
self.supports_masking = True
self.bias = bias
self.feature_dim = feature_dim
self.K = K
weight = torch.z... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
fr... | heyitsmine/FewRel | Attention | false | 10,269 | [
"MIT"
] | 0 | 2a2b8ae471298d9eb3557796a085c23b21982fb2 | https://github.com/heyitsmine/FewRel/tree/2a2b8ae471298d9eb3557796a085c23b21982fb2 |
SumModule | import torch
import torch.nn as nn
class SumModule(nn.Module):
def __init__(self, *axis, keepdim=False):
super().__init__()
self.axis = axis
self.keepdim = keepdim
def forward(self, v):
sum = v.sum(self.axis)
if self.keepdim:
dims = list(v.shape)
... | 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... | finalgruntgit/diautils | SumModule | false | 10,271 | [
"MIT"
] | 0 | b9d7666ed5023700db01a4295430c52721acfc25 | https://github.com/finalgruntgit/diautils/tree/b9d7666ed5023700db01a4295430c52721acfc25 |
MultiheadAttention | import torch
from torch import nn
from torch.nn import Parameter
import torch.nn.functional as F
class MultiheadAttention(nn.Module):
"""Multi-headed attention.
See "Attention Is All You Need" for more details.
"""
def __init__(self, embed_dim, num_heads, attn_dropout=0.0, bias=True,
add_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.... | jiahuanluo/multi_media | MultiheadAttention | false | 10,272 | [
"MIT"
] | 0 | ac5ac59dba87d0368ca656e600a85bfd9a1da28e | https://github.com/jiahuanluo/multi_media/tree/ac5ac59dba87d0368ca656e600a85bfd9a1da28e |
SigsqrtModule | import torch
import torch.nn as nn
def sigsqrt(v):
return v / torch.sqrt(1 + v.abs())
class SigsqrtModule(nn.Module):
def forward(self, v):
return sigsqrt(v)
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, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | finalgruntgit/diautils | SigsqrtModule | false | 10,273 | [
"MIT"
] | 0 | b9d7666ed5023700db01a4295430c52721acfc25 | https://github.com/finalgruntgit/diautils/tree/b9d7666ed5023700db01a4295430c52721acfc25 |
LearnedPositionalEncoding | import torch
import torch.nn as nn
import torch.optim
class LearnedPositionalEncoding(nn.Module):
def __init__(self, max_position_embeddings, embedding_dim, seq_length):
super(LearnedPositionalEncoding, self).__init__()
self.position_embeddings = nn.Parameter(torch.zeros(1, 3200, 512))
def f... | 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.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | felixquinton1/TransBTS | LearnedPositionalEncoding | false | 10,274 | [
"Apache-2.0"
] | 0 | 6992c902413ba15f40ebfe9f6d5d0e3594051033 | https://github.com/felixquinton1/TransBTS/tree/6992c902413ba15f40ebfe9f6d5d0e3594051033 |
VAELoss | import torch
import torch.nn as nn
class VAELoss(nn.Module):
def __init__(self):
super(VAELoss, self).__init__()
self.bce = nn.BCELoss(reduction='sum')
def forward(self, recon_x, x, mu, logvar):
BCE = self.bce(recon_x, x)
KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar... | 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... | jlrussin/RL_project | VAELoss | false | 10,275 | [
"Apache-2.0"
] | 0 | a8562b4797afdf5944dba768a88d779056e8506a | https://github.com/jlrussin/RL_project/tree/a8562b4797afdf5944dba768a88d779056e8506a |
SoftmaxModule | import torch
import torch.nn as nn
class SoftmaxModule(nn.Module):
def __init__(self, axis):
super().__init__()
self.axis = axis
def forward(self, v):
return v.softmax(self.axis)
def get_inputs():
return [torch.rand([4, 4, 4, 4, 4])]
def get_init_inputs():
return [[], {'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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | finalgruntgit/diautils | SoftmaxModule | false | 10,276 | [
"MIT"
] | 0 | b9d7666ed5023700db01a4295430c52721acfc25 | https://github.com/finalgruntgit/diautils/tree/b9d7666ed5023700db01a4295430c52721acfc25 |
MultipleRegression | import torch
import torch.nn as nn
class MultipleRegression(nn.Module):
def __init__(self, num_features):
super(MultipleRegression, self).__init__()
self.fc1 = nn.Linear(num_features, 64)
self.fc2 = nn.Linear(64, 128)
self.output = nn.Linear(128, 1)
self.act = nn.Sigmoid()... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | jiruifu-jerry0219/UpperLimbEstimator | MultipleRegression | false | 10,277 | [
"Apache-2.0"
] | 0 | d62deef93419934dcb33e43707dd0634a235fb9a | https://github.com/jiruifu-jerry0219/UpperLimbEstimator/tree/d62deef93419934dcb33e43707dd0634a235fb9a |
SegmentationNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class SegmentationNet(nn.Module):
def __init__(self, feature, hidden1, hidden2, output):
""" Initialize a class NeuralNet.
:param batch_size: int
:param hidden: int
"""
super(SegmentationNet, 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.... | jinyu-hou/medium-blog-scripts | SegmentationNet | false | 10,278 | [
"MIT"
] | 0 | a645d544a4bd1c937e4ff99dca0d6e98b3abb7f9 | https://github.com/jinyu-hou/medium-blog-scripts/tree/a645d544a4bd1c937e4ff99dca0d6e98b3abb7f9 |
LinearWithChannel | import torch
import numpy as np
import torch.nn as nn
class LinearWithChannel(nn.Module):
def __init__(self, input_size, output_size, channel_size):
super(LinearWithChannel, self).__init__()
self.channel_size = channel_size
self.weight = torch.nn.Parameter(torch.zeros(channel_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 numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | jilanglois-su/cobs10-dengai | LinearWithChannel | false | 10,279 | [
"MIT"
] | 0 | 101d3434db6330e9794b2e266b02c93793abfb82 | https://github.com/jilanglois-su/cobs10-dengai/tree/101d3434db6330e9794b2e266b02c93793abfb82 |
MultiHeadedAttention | import torch
from torch import nn
from torch.nn import functional as F
def same_tensor(tensor, *args):
""" Do the input tensors all point to the same underlying data """
for other in args:
if not torch.is_tensor(other):
return False
if tensor.device != other.device:
ret... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jinga-lala/stupidNMT | MultiHeadedAttention | false | 10,280 | [
"BSD-3-Clause"
] | 0 | 2a41c072c2bc622c7edd8556f552f38556d70dae | https://github.com/jinga-lala/stupidNMT/tree/2a41c072c2bc622c7edd8556f552f38556d70dae |
MLP | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
from torch.nn.parameter import Parameter
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class Conv1D(nn.Module):
def __init__(self, nf, nx):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | jamessheenworks/GPT2sQA | MLP | false | 10,281 | [
"Apache-2.0"
] | 0 | 14866cb21d229281e8f8b8f88aac9195bca45cd7 | https://github.com/jamessheenworks/GPT2sQA/tree/14866cb21d229281e8f8b8f88aac9195bca45cd7 |
Classify | import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Flatten(nn.Module):
@staticmethod
def forward(x):
return x.view(x.size(0), -1)
class Classify(nn.Module):
def __init__(self, c1,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | hyperparameters/Towards-Realtime-MOT | Classify | false | 10,282 | [
"MIT"
] | 0 | eb956a3bd5991f4895178566cb0173769977f88d | https://github.com/hyperparameters/Towards-Realtime-MOT/tree/eb956a3bd5991f4895178566cb0173769977f88d |
NeuralNerwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class NeuralNerwork(nn.Module):
""" Construct a ReLU-activated NN, set Bias to False
Four hidden layers with sizes [1000, 1000, 500, 200]
Features = 784, Targets = 10 classes
"""
def __init__(self, features, targets):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | jf20541/Pruning-DeepNeuralNetwork | NeuralNerwork | false | 10,283 | [
"MIT"
] | 0 | a78a88616c19aa0f1449eb562b7dd8d7c4f47252 | https://github.com/jf20541/Pruning-DeepNeuralNetwork/tree/a78a88616c19aa0f1449eb562b7dd8d7c4f47252 |
SELayer | import torch
import torch.nn.functional as F
import torch.nn as nn
class SELayer(nn.Module):
def __init__(self, in_channels, reduction):
super().__init__()
mid_channels = in_channels // reduction
self.fc1 = nn.Linear(in_channels, mid_channels)
self.fc2 = nn.Linear(mid_channels, in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | implus/pytorch_image_classification | SELayer | false | 10,284 | [
"MIT"
] | 0 | cac490ed518ad09b0429fc01af060457fb050e68 | https://github.com/implus/pytorch_image_classification/tree/cac490ed518ad09b0429fc01af060457fb050e68 |
WeightedMultilabel | import torch
import torch.nn as nn
class WeightedMultilabel(nn.Module):
def __init__(self, weights: 'torch.Tensor'):
super(WeightedMultilabel, self).__init__()
self.cerition = nn.BCEWithLogitsLoss(reduction='none')
self.weights = weights
def forward(self, outputs, targets):
l... | 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... | jiawenxiao/physionet2020_0823 | WeightedMultilabel | false | 10,285 | [
"BSD-2-Clause"
] | 0 | 99dd54a3f7b8cef83ff37a46223f4f979edd2e74 | https://github.com/jiawenxiao/physionet2020_0823/tree/99dd54a3f7b8cef83ff37a46223f4f979edd2e74 |
BertLayerNormNoVar | import torch
import torch.nn as nn
class BertLayerNormNoVar(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNormNoVar, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsil... | 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... | jiachens/auto_LiRPA | BertLayerNormNoVar | false | 10,286 | [
"BSD-3-Clause"
] | 0 | cc1ff18e8fbc938953b20ae6a030a25761cb0b78 | https://github.com/jiachens/auto_LiRPA/tree/cc1ff18e8fbc938953b20ae6a030a25761cb0b78 |
RobNet | import torch
from torch import nn
import torch.nn.functional as F
class RobNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size=3, stride=2, dilation=1)
self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=2)
self.conv3 = nn.Conv2d(32, 6... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | hongrui16/rotated_detection | RobNet | false | 10,287 | [
"MIT"
] | 0 | 0b0a061b0753950c20d1e52c8ae8fc59e1ceb21d | https://github.com/hongrui16/rotated_detection/tree/0b0a061b0753950c20d1e52c8ae8fc59e1ceb21d |
Conv2 | import math
import torch
import torch.nn as nn
class Conv2(nn.Module):
""" A convolution layer with the stride of 2.
Input:
x: (N, 2L+2, in_channels) numeric tensor
global_cond: (N, global_cond_channels) numeric tensor
Output:
y: (N, L, out_channels) numeric 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.triton_helpers import libdevice
import math
import ... | jonojace/WaveRNN | Conv2 | false | 10,288 | [
"MIT"
] | 0 | 5ac72d5ed10262132f016f8e523bc663faa991da | https://github.com/jonojace/WaveRNN/tree/5ac72d5ed10262132f016f8e523bc663faa991da |
CatKLLoss | import torch
from torch.nn.modules.loss import _Loss
class CatKLLoss(_Loss):
def __init__(self, reduction='none'):
super(CatKLLoss, self).__init__()
assert reduction in ['none', 'sum', 'mean']
self.reduction = reduction
def forward(self, log_qy, log_py):
"""
KL(qy|py)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.loss import _Loss
assert_size_stride = torch._C._dy... | imguozhen/proactive-chat | CatKLLoss | false | 10,289 | [
"Apache-2.0"
] | 0 | 80d13e28cb93c26a65ace0a028c53fd0bafcdbf9 | https://github.com/imguozhen/proactive-chat/tree/80d13e28cb93c26a65ace0a028c53fd0bafcdbf9 |
PCN1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class PCN1(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=2, dilation=1)
self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=2)
self.conv3 = nn.Conv2d(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
from torch._inductor.runtime.... | jisheng047/blinsert | PCN1 | false | 10,290 | [
"BSD-2-Clause"
] | 0 | 923d2ea2af3f2f257c817fa8de02c7db8ec9bcc9 | https://github.com/jisheng047/blinsert/tree/923d2ea2af3f2f257c817fa8de02c7db8ec9bcc9 |
MaskBCELoss | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
class MaskBCELoss(_Loss):
def __init__(self, reduction='mean'):
super(MaskBCELoss, self).__init__()
assert reduction in ['none', 'sum', 'mean']
self.reduction = reduction
def forward(self, input, tar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | imguozhen/proactive-chat | MaskBCELoss | false | 10,291 | [
"Apache-2.0"
] | 0 | 80d13e28cb93c26a65ace0a028c53fd0bafcdbf9 | https://github.com/imguozhen/proactive-chat/tree/80d13e28cb93c26a65ace0a028c53fd0bafcdbf9 |
NormalKLLoss | import torch
from torch import distributions
from torch.nn.modules.loss import _Loss
class NormalKLLoss(_Loss):
def __init__(self, reduction='mean'):
super(NormalKLLoss, self).__init__()
assert reduction in ['none', 'sum', 'mean']
self.reduction = reduction
def forward(self, q_mu, q_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.nn.modules.loss import _Loss
assert_size_stride = t... | imguozhen/proactive-chat | NormalKLLoss | false | 10,292 | [
"Apache-2.0"
] | 0 | 80d13e28cb93c26a65ace0a028c53fd0bafcdbf9 | https://github.com/imguozhen/proactive-chat/tree/80d13e28cb93c26a65ace0a028c53fd0bafcdbf9 |
Gather | import torch
from torch import nn
import torch.onnx
class Gather(nn.Module):
def __init__(self, dim=0):
self.dim = dim
self.selection = [slice(None) for _ in range(dim)]
super().__init__()
def forward(self, input: 'torch.Tensor', indices: 'torch.Tensor'):
selection = self.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 import nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | jiuntian/onnx2pytorch | Gather | false | 10,293 | [
"Apache-2.0"
] | 0 | fadca10a6045f4373293c9c0854607fb51a47c12 | https://github.com/jiuntian/onnx2pytorch/tree/fadca10a6045f4373293c9c0854607fb51a47c12 |
GlobalAveragePool | import torch
from torch import nn
import torch.onnx
class GlobalAveragePool(nn.Module):
def forward(self, input: 'torch.Tensor'):
spatial_shape = input.ndimension() - 2
dim = tuple(range(spatial_shape, spatial_shape + 2))
return torch.mean(input, dim=dim, keepdim=True)
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 import nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | jiuntian/onnx2pytorch | GlobalAveragePool | false | 10,294 | [
"Apache-2.0"
] | 0 | fadca10a6045f4373293c9c0854607fb51a47c12 | https://github.com/jiuntian/onnx2pytorch/tree/fadca10a6045f4373293c9c0854607fb51a47c12 |
Scale | import torch
from torch import nn
from torch.nn import *
class Scale(nn.Module):
def __init__(self, scale):
super().__init__()
self.scale = scale
def forward(self, x):
return x * self.scale
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 import nn
from torch.nn import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._d... | jlubars/autonomous-learning-library | Scale | false | 10,295 | [
"MIT"
] | 0 | 5d2d2e1ee9e0876614d7113e26f026f126a3899f | https://github.com/jlubars/autonomous-learning-library/tree/5d2d2e1ee9e0876614d7113e26f026f126a3899f |
FullSort | import torch
import torch.nn as nn
class FullSort(nn.Module):
def forward(self, x):
return torch.sort(x, 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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | hologerry/residual-flows | FullSort | false | 10,296 | [
"MIT"
] | 0 | 33a3639150490279c2e13238dd6244b80c52adf7 | https://github.com/hologerry/residual-flows/tree/33a3639150490279c2e13238dd6244b80c52adf7 |
Accuracy | import torch
import torch.nn.functional as F
import torch.nn as nn
class Accuracy(nn.Module):
def __init__(self):
super().__init__()
def forward(self, prediction, target, mask=None, token_dim=-1,
sequence_dim=-2):
prediction = F.softmax(prediction, token_dim).argmax(sequence_dim)
... | 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
... | karadeli98/BBM406-Project | Accuracy | false | 10,297 | [
"MIT"
] | 0 | 6de0fa2cbebb93dec272dc7c54a25024880ed1e7 | https://github.com/karadeli98/BBM406-Project/tree/6de0fa2cbebb93dec272dc7c54a25024880ed1e7 |
LipschitzCube | import torch
import torch.nn as nn
class LipschitzCube(nn.Module):
def forward(self, x):
return (x >= 1) * (x - 2 / 3) + (x <= -1) * (x + 2 / 3) + (x > -1) * (x
< 1) * x ** 3 / 3
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | hologerry/residual-flows | LipschitzCube | false | 10,298 | [
"MIT"
] | 0 | 33a3639150490279c2e13238dd6244b80c52adf7 | https://github.com/hologerry/residual-flows/tree/33a3639150490279c2e13238dd6244b80c52adf7 |
MSDConvBlock | import torch
import torch.nn as nn
class MSDConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dilation, std):
super(MSDConvBlock, self).__init__()
self.conv = nn.Conv2d(in_channels=in_channels, out_channels=
out_channels, kernel_size=(3, 3), padding=(dilation, dilati... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | jiayangshi/pcf | MSDConvBlock | false | 10,299 | [
"MIT"
] | 0 | 1e3c5847bdb4100f60b7251cefb9cfe7a76c3c64 | https://github.com/jiayangshi/pcf/tree/1e3c5847bdb4100f60b7251cefb9cfe7a76c3c64 |
Sparsify1D | import torch
import torch.nn as nn
class SparsifyBase(nn.Module):
def __init__(self, sparse_ratio=0.5):
super(SparsifyBase, self).__init__()
self.sr = sparse_ratio
self.preact = None
self.act = None
def get_activation(self):
def hook(model, input, output):
... | 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... | jmhuer/TCN | Sparsify1D | false | 10,301 | [
"MIT"
] | 0 | 8233b2ff5686ef496b113a6984f5100709a503d3 | https://github.com/jmhuer/TCN/tree/8233b2ff5686ef496b113a6984f5100709a503d3 |
Network | import torch
class Network(torch.nn.Module):
def __init__(self, input_dimension, output_dimension):
super(Network, self).__init__()
self.layer_1 = torch.nn.Linear(in_features=input_dimension,
out_features=90)
self.layer_2 = torch.nn.Linear(in_features=90, out_features=125)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | joshsia/random-maze-rl | Network | false | 10,302 | [
"MIT"
] | 0 | 016b67d23bfba63182cf06ca17bc9a75baca6ee5 | https://github.com/joshsia/random-maze-rl/tree/016b67d23bfba63182cf06ca17bc9a75baca6ee5 |
Aggregation | import torch
from torch import nn
from torch.nn import *
class Aggregation(nn.Module):
"""
Aggregation layer for the Dueling architecture.
https://arxiv.org/abs/1511.06581
This layer computes a Q function by combining
an estimate of V with an estimate of the advantage.
The advantage is normal... | 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 *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._d... | jlubars/autonomous-learning-library | Aggregation | false | 10,303 | [
"MIT"
] | 0 | 5d2d2e1ee9e0876614d7113e26f026f126a3899f | https://github.com/jlubars/autonomous-learning-library/tree/5d2d2e1ee9e0876614d7113e26f026f126a3899f |
LipNormLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
def _max_except_dim(input, dim):
maxed = input
for axis in range(input.ndimension() - 1, dim, -1):
maxed, _ = maxed.max(axis, keepdim=True)
for axis in range(dim - 1, -1, -1):
maxed, _ = maxed.max(axis, keepdim=True)
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | hologerry/residual-flows | LipNormLinear | false | 10,304 | [
"MIT"
] | 0 | 33a3639150490279c2e13238dd6244b80c52adf7 | https://github.com/hologerry/residual-flows/tree/33a3639150490279c2e13238dd6244b80c52adf7 |
LipNormConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
def _max_except_dim(input, dim):
maxed = input
for axis in range(input.ndimension() - 1, dim, -1):
maxed, _ = maxed.max(axis, keepdim=True)
for axis in range(dim - 1, -1, -1):
maxed, _ = maxed.max(axis, keepdim=True)
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | hologerry/residual-flows | LipNormConv2d | false | 10,305 | [
"MIT"
] | 0 | 33a3639150490279c2e13238dd6244b80c52adf7 | https://github.com/hologerry/residual-flows/tree/33a3639150490279c2e13238dd6244b80c52adf7 |
EALSTM | import torch
import torch.nn as nn
import torch.utils.data
class EALSTM(nn.Module):
"""Implementation of the Entity-Aware-LSTM (EA-LSTM)
TODO: Include paper ref and latex equations
Parameters
----------
input_size_dyn : int
Number of dynamic features, which are those, passed to the LSTM at... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | jdwillard19/lake_conus_surface_temp_2021 | EALSTM | false | 10,306 | [
"MIT"
] | 0 | 88334091dec71ae43fe4256603d65045141936b5 | https://github.com/jdwillard19/lake_conus_surface_temp_2021/tree/88334091dec71ae43fe4256603d65045141936b5 |
AttentionConv | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class AttentionConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=False):
super(AttentionConv, self).__init__()
self.out_channels = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | jhvics1/pytorch-stand-alone-self-attention | AttentionConv | false | 10,307 | [
"MIT"
] | 0 | 77375d99250ab9d8089e73bd4803afae30843748 | https://github.com/jhvics1/pytorch-stand-alone-self-attention/tree/77375d99250ab9d8089e73bd4803afae30843748 |
ConvNet | import torch
import torch.optim
import torch.nn as nn
import torch.nn.functional as F
class ConvNet(nn.Module):
def __init__(self):
super(ConvNet, 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... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.optim
import tor... | jwdink/PyTorch-LBFGS | ConvNet | false | 10,308 | [
"MIT"
] | 0 | 7e18ea3d9cb16a0af1a76f7c9c023c916b408a04 | https://github.com/jwdink/PyTorch-LBFGS/tree/7e18ea3d9cb16a0af1a76f7c9c023c916b408a04 |
AttentionLayer | import torch
import torch.nn as nn
class AttentionLayer(nn.Module):
def __init__(self, embed_dim, num_heads, dropout_rate=0.1,
feedforward_size=256):
"""The core module with both spatial attention module and
temporal attention model embedded within it.
"""
super(Attent... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jhbed/fairmotion | AttentionLayer | false | 10,310 | [
"BSD-3-Clause"
] | 0 | 949683d628b389a1e4f241b21e88f5d57f3a488e | https://github.com/jhbed/fairmotion/tree/949683d628b389a1e4f241b21e88f5d57f3a488e |
AUGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
import torch.onnx
import torch as torch
class AUGRUCell(nn.Module):
""" Effect of GRU with attentional update gate (AUGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Predicti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dulvqingyunLT/DeepCTR-Torch | AUGRUCell | false | 10,311 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
Norm | import torch
import torch.nn as nn
class Norm(nn.Module):
"""
Re-usable class for either batch-norm or layer-norm (by swapping dim)
"""
def __init__(self, n_hidden, eps=1e-08, dim=0):
super(Norm, self).__init__()
self.eps = eps
self.n_hidden = n_hidden
self.a = nn.Para... | 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_... | jrbtaylor/recurrent_pytorch | Norm | false | 10,312 | [
"Apache-2.0"
] | 0 | 09ee203a86b70a32aec3e97d7daa646caf8fd182 | https://github.com/jrbtaylor/recurrent_pytorch/tree/09ee203a86b70a32aec3e97d7daa646caf8fd182 |
Adjust_naive | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def get_conv2d_layer(in_c, out_c, k, s, p=0, dilation=1, groups=1):
return nn.Conv2d(in_channels=in_c, out_channels=out_c, kernel_size=k,
stride=s, padding=p, dilation=dilation, groups=groups)
class Adjust_naive(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 torch.nn as nn
assert_... | AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem | Adjust_naive | false | 10,313 | [
"MIT"
] | 0 | 9d837b8df9c761defb1eca390b3a60aa4a6fbb1a | https://github.com/AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem/tree/9d837b8df9c761defb1eca390b3a60aa4a6fbb1a |
SpaceToDepth | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class SpaceToDepth(nn.Module):
def __init__(self, block_size=4):
super().__init__()
assert block_size == 4
self.bs = block_size
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distr... | jasonnoy/COMP5329 | SpaceToDepth | false | 10,314 | [
"MIT"
] | 0 | fc17c80b1ac41d788cc0a92d3a033dbe2f9b8b81 | https://github.com/jasonnoy/COMP5329/tree/fc17c80b1ac41d788cc0a92d3a033dbe2f9b8b81 |
ContrastiveLoss | import torch
import torch.nn.functional as F
class ContrastiveLoss(torch.nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=2):
super(ContrastiveLoss, self).__init__()
self.margin = m... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | kevincao91/SiameseNet_Demo | ContrastiveLoss | false | 10,315 | [
"MIT"
] | 0 | 6ec4384159682a8ee93fb110d6fca33de85fa1ba | https://github.com/kevincao91/SiameseNet_Demo/tree/6ec4384159682a8ee93fb110d6fca33de85fa1ba |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 256)
self.l2 = nn.Linear(256, 256)
self.l3 = nn.Linear(256, action_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.... | karush17/gym-pybullet-drones | Actor | false | 10,316 | [
"MIT"
] | 0 | 7a7acd4f51dcb1cbea8eb9ef0cfcfc7dcf1c90ba | https://github.com/karush17/gym-pybullet-drones/tree/7a7acd4f51dcb1cbea8eb9ef0cfcfc7dcf1c90ba |
FM | import torch
import torch.nn as nn
from sklearn.metrics import *
import torch.onnx
import torch as torch
class FM(nn.Module):
"""Factorization Machine models pairwise (order-2) feature interactions
without linear term and bias.
Input shape
- 3D tensor with shape: ``(batch_size,field_size,embedd... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from sklearn.metrics import *
import torch.onnx
import torch as torch
assert_size_stride = torch._C._dynamo.guards.ass... | dulvqingyunLT/DeepCTR-Torch | FM | false | 10,317 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
CapsuleConvLayer | import torch
import torch.nn as nn
class CapsuleConvLayer(nn.Module):
def __init__(self, in_channels, out_channels):
super(CapsuleConvLayer, self).__init__()
self.conv0 = nn.Conv2d(in_channels=in_channels, out_channels=
out_channels, kernel_size=9, stride=1, bias=True)
self.re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | juingzhou/Base-on-PyTorch-implementation-CapsuleNet | CapsuleConvLayer | false | 10,318 | [
"MIT"
] | 0 | 6b030bf93b258d9d6496379bcbe4b94542366817 | https://github.com/juingzhou/Base-on-PyTorch-implementation-CapsuleNet/tree/6b030bf93b258d9d6496379bcbe4b94542366817 |
ConvUnit | import torch
import torch.nn as nn
class ConvUnit(nn.Module):
def __init__(self, in_channels):
super(ConvUnit, self).__init__()
self.conv0 = nn.Conv2d(in_channels=in_channels, out_channels=32,
kernel_size=9, stride=2, bias=True)
def forward(self, x):
return self.conv0(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... | juingzhou/Base-on-PyTorch-implementation-CapsuleNet | ConvUnit | false | 10,319 | [
"MIT"
] | 0 | 6b030bf93b258d9d6496379bcbe4b94542366817 | https://github.com/juingzhou/Base-on-PyTorch-implementation-CapsuleNet/tree/6b030bf93b258d9d6496379bcbe4b94542366817 |
KLLoss | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.checkpoint
class KLLoss(nn.Module):
"""Loss that uses a 'hinge' on the lower bound.
This means that for samples with a label value smaller than the threshold, the loss is zero if the prediction is
also smaller than that t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | jiazheng-xing/Swin_Multimodal | KLLoss | false | 10,320 | [
"MIT"
] | 0 | 7bc41977fe7d8d4f0091852c63a6a32a0fada0fb | https://github.com/jiazheng-xing/Swin_Multimodal/tree/7bc41977fe7d8d4f0091852c63a6a32a0fada0fb |
DeepHeadModule | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt as sqrt
class DeepHeadModule(nn.Module):
def __init__(self, input_channels, output_channels):
super(DeepHeadModule, self).__init__()
self._input_channels = input_channels
self._output_channels = outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ma... | juanmed/FaceDetection-DSFD | DeepHeadModule | false | 10,321 | [
"Apache-2.0"
] | 0 | 23650ca492444f9f052ca9b8db8b068a9be5bc68 | https://github.com/juanmed/FaceDetection-DSFD/tree/23650ca492444f9f052ca9b8db8b068a9be5bc68 |
CNN | import torch
from torch import nn
import torch.nn.functional as F
class CNN(torch.nn.Module):
"""Basic CNN architecture."""
def __init__(self, in_channels=1):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(in_channels, 64, 8, 1)
self.conv2 = nn.Conv2d(64, 128, 6, 2)
self.c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | jubueche/cleverhans | CNN | false | 10,322 | [
"MIT"
] | 0 | 2e45b75ccc7b04ffec27fd9e6079f00451586266 | https://github.com/jubueche/cleverhans/tree/2e45b75ccc7b04ffec27fd9e6079f00451586266 |
AsymmetricLossOptimized | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
... | 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 torchv... | jasonnoy/COMP5329 | AsymmetricLossOptimized | false | 10,323 | [
"MIT"
] | 0 | fc17c80b1ac41d788cc0a92d3a033dbe2f9b8b81 | https://github.com/jasonnoy/COMP5329/tree/fc17c80b1ac41d788cc0a92d3a033dbe2f9b8b81 |
SEModule | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class FastAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastAvgPool2d, self).__init__()
self.flatten = flatten
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torchvision import datas... | jasonnoy/COMP5329 | SEModule | false | 10,324 | [
"MIT"
] | 0 | fc17c80b1ac41d788cc0a92d3a033dbe2f9b8b81 | https://github.com/jasonnoy/COMP5329/tree/fc17c80b1ac41d788cc0a92d3a033dbe2f9b8b81 |
StdConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-10)
return F.conv2d(x, w, self.bias, self.stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | kayvane1/BiT-Tobacco-800 | StdConv2d | false | 10,325 | [
"Apache-2.0"
] | 0 | fd937cc3f8fc1d5e45744defd82d112c10281433 | https://github.com/kayvane1/BiT-Tobacco-800/tree/fd937cc3f8fc1d5e45744defd82d112c10281433 |
RNN | import torch
import torch.nn as nn
class Norm(nn.Module):
"""
Re-usable class for either batch-norm or layer-norm (by swapping dim)
"""
def __init__(self, n_hidden, eps=1e-08, dim=0):
super(Norm, self).__init__()
self.eps = eps
self.n_hidden = n_hidden
self.a = nn.Para... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jrbtaylor/recurrent_pytorch | RNN | false | 10,326 | [
"Apache-2.0"
] | 0 | 09ee203a86b70a32aec3e97d7daa646caf8fd182 | https://github.com/jrbtaylor/recurrent_pytorch/tree/09ee203a86b70a32aec3e97d7daa646caf8fd182 |
BinaryLogisticRegressionLoss | import torch
import torch.nn as nn
def binary_logistic_regression_loss(reg_score, label, threshold=0.5,
ratio_range=(1.05, 21), eps=1e-05):
"""Binary Logistic Regression Loss."""
label = label.view(-1)
reg_score = reg_score.contiguous().view(-1)
pmask = (label > threshold).float()
num_positive... | 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
... | giahaowjx/mmaction2 | BinaryLogisticRegressionLoss | false | 10,327 | [
"Apache-2.0"
] | 0 | 4f95e9b91354acdcae768ce94e01d3821bba0154 | https://github.com/giahaowjx/mmaction2/tree/4f95e9b91354acdcae768ce94e01d3821bba0154 |
FEM | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt as sqrt
class FEM(nn.Module):
def __init__(self, channel_size):
super(FEM, self).__init__()
self.cs = channel_size
self.cpm1 = nn.Conv2d(self.cs, 256, kernel_size=3, dilation=1,
stride=1, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ma... | juanmed/FaceDetection-DSFD | FEM | false | 10,328 | [
"Apache-2.0"
] | 0 | 23650ca492444f9f052ca9b8db8b068a9be5bc68 | https://github.com/juanmed/FaceDetection-DSFD/tree/23650ca492444f9f052ca9b8db8b068a9be5bc68 |
ExpandNetLoss | import torch
from torch import nn
class ExpandNetLoss(nn.Module):
def __init__(self, loss_lambda=5):
super(ExpandNetLoss, self).__init__()
self.similarity = torch.nn.CosineSimilarity(dim=1, eps=1e-20)
self.l1_loss = nn.L1Loss()
self.loss_lambda = loss_lambda
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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | kacperkk2/temporalStableExpandNet | ExpandNetLoss | false | 10,329 | [
"BSD-3-Clause-Clear"
] | 0 | 87a4d6c8c1a47b721760c9daf2727e380b90c541 | https://github.com/kacperkk2/temporalStableExpandNet/tree/87a4d6c8c1a47b721760c9daf2727e380b90c541 |
ScaledDotProductAttention | import torch
import numpy as np
from torch import nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionality of queries and keys... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jmhessel/meshed-memory-transformer | ScaledDotProductAttention | false | 10,330 | [
"BSD-3-Clause"
] | 0 | b502da2522f2e25d602fba547ed6ebf7968857a9 | https://github.com/jmhessel/meshed-memory-transformer/tree/b502da2522f2e25d602fba547ed6ebf7968857a9 |
Clamp | import torch
from torch import nn
class Clamp(nn.Module):
"""Clamp energy output"""
def forward(self, x):
x = torch.clamp(x, min=0, max=30)
return 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 import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | kgreif24/mlhep-aka | Clamp | false | 10,331 | [
"Apache-2.0"
] | 0 | 41e120eb3e7049a01ffdb22c4e00b3aaca94b541 | https://github.com/kgreif24/mlhep-aka/tree/41e120eb3e7049a01ffdb22c4e00b3aaca94b541 |
AvgConsensus | import torch
import torch.nn as nn
class AvgConsensus(nn.Module):
"""Average consensus module.
Args:
dim (int): Decide which dim consensus function to apply.
Default: 1.
"""
def __init__(self, dim=1):
super().__init__()
self.dim = dim
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
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | giahaowjx/mmaction2 | AvgConsensus | false | 10,332 | [
"Apache-2.0"
] | 0 | 4f95e9b91354acdcae768ce94e01d3821bba0154 | https://github.com/giahaowjx/mmaction2/tree/4f95e9b91354acdcae768ce94e01d3821bba0154 |
OffsetNet | import torch
import torch.nn as nn
class OffsetNet(nn.Module):
"""OffsetNet in Temporal interlace module.
The OffsetNet consists of one convolution layer and two fc layers
with a relu activation following with a sigmoid function. Following
the convolution layer, two fc layers and relu are applied to ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | giahaowjx/mmaction2 | OffsetNet | false | 10,333 | [
"Apache-2.0"
] | 0 | 4f95e9b91354acdcae768ce94e01d3821bba0154 | https://github.com/giahaowjx/mmaction2/tree/4f95e9b91354acdcae768ce94e01d3821bba0154 |
ScaledDotProductAttentionMemory | import torch
import numpy as np
from torch import nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, d_model, d_k, d_v, h, m):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionalit... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jmhessel/meshed-memory-transformer | ScaledDotProductAttentionMemory | false | 10,334 | [
"BSD-3-Clause"
] | 0 | b502da2522f2e25d602fba547ed6ebf7968857a9 | https://github.com/jmhessel/meshed-memory-transformer/tree/b502da2522f2e25d602fba547ed6ebf7968857a9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.