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 |
|---|---|---|---|---|---|---|---|---|---|---|
SimpleConv | import torch
import torch.nn as nn
class SimpleConv(nn.Module):
def __init__(self, in_size):
super(SimpleConv, self).__init__()
self.conv = nn.Conv2d(in_size, 6, 3, padding='same')
self.relu = nn.ReLU()
def forward(self, x):
x = self.conv(x)
x = self.relu(x)
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | msc5/ml-tools | SimpleConv | false | 4,033 | [
"Apache-2.0"
] | 0 | 75ca504bdc0495e8a929ad73501b7de692b3089a | https://github.com/msc5/ml-tools/tree/75ca504bdc0495e8a929ad73501b7de692b3089a |
_Decoder | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class _Decoder(nn.Module):
def __init__(self, z_dim):
super(_Decoder, self).__init__()
self.fc1 = nn.Linear(z_dim, 600)
self.fc2 = nn.Linear(600, 600)
self.fc3 = nn.Linear(600, 784)
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
import torch.nn as nn
import ... | mori97/revae | _Decoder | false | 4,034 | [
"MIT"
] | 0 | 465009076a9be78e8ddb9021a0699b32fc695f30 | https://github.com/mori97/revae/tree/465009076a9be78e8ddb9021a0699b32fc695f30 |
AGELU | import math
import torch
import torch.utils.data
import torch.cuda
import torch.utils.checkpoint
def agelu(x):
SQRT_M2_PI = math.sqrt(2 / math.pi)
COEFF = 0.044715
return 0.5 * x * (1.0 + torch.tanh(SQRT_M2_PI * (x + COEFF * torch.pow(
x, 3))))
class AGELU(torch.nn.Module):
def forward(self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.utils.data
import torch.cuda
import torch.utils.checkp... | mullovc/NMTGMinor | AGELU | false | 4,035 | [
"MIT"
] | 0 | b1b7b1e018eaa0d99a43449655937cc050a29987 | https://github.com/mullovc/NMTGMinor/tree/b1b7b1e018eaa0d99a43449655937cc050a29987 |
LinReLU | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class LinReLU(torch.nn.Module):
__constants__ = ['bias']
def __init__(self, in_features: 'int', out_features: 'int') ->None:
super(LinReLU, self).__init__()
self.in_features = in_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | mrahman93/nam | LinReLU | false | 4,036 | [
"MIT"
] | 0 | 1a2f286a87ffa024040e3330088b4a375700c1c6 | https://github.com/mrahman93/nam/tree/1a2f286a87ffa024040e3330088b4a375700c1c6 |
ExU | import torch
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class ExU(torch.nn.Module):
def __init__(self, in_features: 'int', out_features: 'int') ->None:
super(ExU, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.we... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mrahman93/nam | ExU | false | 4,037 | [
"MIT"
] | 0 | 1a2f286a87ffa024040e3330088b4a375700c1c6 | https://github.com/mrahman93/nam/tree/1a2f286a87ffa024040e3330088b4a375700c1c6 |
ReLUDropout | import torch
import torch.utils.data
import torch.cuda
import torch.utils.checkpoint
def relu_dropout(x, p=0, training=False, variational=False, batch_first=False):
if not training or p == 0:
return x.clamp_(min=0)
p1m = 1 - p
if variational:
if batch_first:
mask = torch.rand_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
import torch.utils.data
import torch.cuda
import torch.utils.checkpoint
assert_size_strid... | mullovc/NMTGMinor | ReLUDropout | false | 4,038 | [
"MIT"
] | 0 | b1b7b1e018eaa0d99a43449655937cc050a29987 | https://github.com/mullovc/NMTGMinor/tree/b1b7b1e018eaa0d99a43449655937cc050a29987 |
MLMTaskHead | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import LayerNorm
class MLMTaskHead(nn.Module):
def __init__(self, ntoken, ninp):
super().__init__()
self.mlm_span = Linear(ninp, ninp)
self.activation = F.gelu
self.norm_la... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | mrshenli/pipeline_experiments | MLMTaskHead | false | 4,039 | [
"MIT"
] | 0 | 09386ab70386a1f4b49ae078c132f4037a887f9b | https://github.com/mrshenli/pipeline_experiments/tree/09386ab70386a1f4b49ae078c132f4037a887f9b |
SimpleTextClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleTextClassifier(nn.Module):
"""Text Classifier with 1 hidden layer
"""
def __init__(self, num_labels, vocab_size):
super(SimpleTextClassifier, self).__init__()
self.linear1 = nn.Linear(vocab_size, 128)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mtfelix/pytorch_active_learning | SimpleTextClassifier | false | 4,040 | [
"MIT"
] | 0 | 495f20c9cf5100cf2a100f4a4c6103e05fb62ca2 | https://github.com/mtfelix/pytorch_active_learning/tree/495f20c9cf5100cf2a100f4a4c6103e05fb62ca2 |
ScaledDotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
def forward(self, q, k, v, mask=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | muberraozmen/MrMP | ScaledDotProductAttention | false | 4,041 | [
"MIT"
] | 0 | da6bcccbad85a682c848ff4aa1121c773d779e57 | https://github.com/muberraozmen/MrMP/tree/da6bcccbad85a682c848ff4aa1121c773d779e57 |
Gaussian | import torch
from torch import Tensor
import torch.utils.tensorboard
import torch.utils.data
class Gaussian(torch.nn.Module):
"""Gaussian activation"""
def forward(self, x: 'Tensor') ->Tensor:
return torch.exp(-x * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_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.triton_helpers import math as tl_math
import torch.utils.tensorboard
import torch.utils.data
assert_size_stride... | cdever01/torchani | Gaussian | false | 4,042 | [
"MIT"
] | 0 | 3f7e1347a06422f50010c04a65219e22f2179bfa | https://github.com/cdever01/torchani/tree/3f7e1347a06422f50010c04a65219e22f2179bfa |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 5)
self.conv2 = nn.Conv2d(32, 64, 5)
self.conv3 = nn.Conv2d(64, 128, 5)
self.fc1 = nn.Linear(512, 512)
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.... | mmayers88/learn_pytorch | Net | false | 4,043 | [
"MIT"
] | 0 | 0dbc1aed24d869109feb23bfa6e970686cf485e3 | https://github.com/mmayers88/learn_pytorch/tree/0dbc1aed24d869109feb23bfa6e970686cf485e3 |
AttNLocalNew | import torch
import torch.nn as nn
class AttNLocalNew(nn.Module):
"""
自动限制矩阵
实现斜对角线保留权重,其他的设为-inf
"""
def __init__(self, maxlen=128, limit=20):
super(AttNLocalNew, self).__init__()
self.limit = limit
self.maxlen = maxlen
pass
def forward(self, x):
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_index_put_lift_fres... | napoler/tkit-attnlocal-pytorch | AttNLocalNew | false | 4,044 | [
"Apache-2.0"
] | 0 | ec1c32cb49635824f978b3ec19b4c80505ea735b | https://github.com/napoler/tkit-attnlocal-pytorch/tree/ec1c32cb49635824f978b3ec19b4c80505ea735b |
my_MLP2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class my_MLP2(nn.Module):
def __init__(self, input_dim, output_dim, softmax_type='vanilla'):
super().__init__()
self.input = nn.Linear(input_dim, 128)
self.hidden1 = nn.Linear(128, 128)
self.hidden2 = nn.Linear(128... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mtcarilli/CME_approximations | my_MLP2 | false | 4,045 | [
"MIT"
] | 0 | 1ffd1cc0bd17679116964ee33634c0d76c50064e | https://github.com/mtcarilli/CME_approximations/tree/1ffd1cc0bd17679116964ee33634c0d76c50064e |
my_MLP1 | import torch
import torch.nn as nn
class my_MLP1(nn.Module):
def __init__(self, input_dim, npdf, h1_dim, h2_dim, norm_type='softmax'):
super().__init__()
self.input = nn.Linear(input_dim, h1_dim)
self.hidden = nn.Linear(h1_dim, h2_dim)
self.output = nn.Linear(h2_dim, npdf)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mtcarilli/CME_approximations | my_MLP1 | false | 4,046 | [
"MIT"
] | 0 | 1ffd1cc0bd17679116964ee33634c0d76c50064e | https://github.com/mtcarilli/CME_approximations/tree/1ffd1cc0bd17679116964ee33634c0d76c50064e |
R2CNNattetion | import torch
import torch.nn as nn
import torch.utils.data
class R2CNNattetion(nn.Module):
def __init__(self):
super(R2CNNattetion, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=1)
self.pool2 = nn.MaxPool2d(kernel_size=2)
self.pool3 = nn.MaxPool2d(kernel_size=4)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | leobean/CenterNet_simple | R2CNNattetion | false | 4,047 | [
"MIT"
] | 0 | 13e2eab2c049563afde5defdf90434a310a32d02 | https://github.com/leobean/CenterNet_simple/tree/13e2eab2c049563afde5defdf90434a310a32d02 |
CustomInverse | import torch
class CustomInverse(torch.nn.Module):
def forward(self, x, y):
ress = torch.inverse(x) + x
return ress, torch.all(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
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | natke/onnxruntime-extensions | CustomInverse | false | 4,048 | [
"MIT"
] | 0 | e7b7eb596016242a7e913044e889c4a0d7dc1000 | https://github.com/natke/onnxruntime-extensions/tree/e7b7eb596016242a7e913044e889c4a0d7dc1000 |
Out | import torch
from torch import nn
class Out(nn.Module):
def forward(self, out):
out_std = torch.sqrt(out.var(0, unbiased=False) + 1e-08)
mean_std = out_std.mean()
mean_std = mean_std.expand(out.size(0), 1, 4, 4)
out = torch.cat((out, mean_std), 1)
return out
def get_inpu... | 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... | nazarblch/style-based-gan-pytorch | Out | false | 4,049 | [
"MIT"
] | 0 | 5ed7fa114904501d77b414921cd9f439773ba24c | https://github.com/nazarblch/style-based-gan-pytorch/tree/5ed7fa114904501d77b414921cd9f439773ba24c |
TwoArgNet | import torch
from torch import nn
class TwoArgNet(nn.Module):
def __init__(self, inc, outc):
super().__init__()
self.layer = nn.Linear(inc, outc)
def forward(self, t1, t2):
return self.layer(torch.cat((t1, t2), dim=1)).sigmoid()
def get_inputs():
return [torch.rand([4, 4, 4, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | nazarblch/style-based-gan-pytorch | TwoArgNet | false | 4,050 | [
"MIT"
] | 0 | 5ed7fa114904501d77b414921cd9f439773ba24c | https://github.com/nazarblch/style-based-gan-pytorch/tree/5ed7fa114904501d77b414921cd9f439773ba24c |
FusedUpsample | import torch
from torch import nn
from torch.nn import functional as F
from math import sqrt
class FusedUpsample(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, padding=0):
super().__init__()
weight = torch.randn(in_channel, out_channel, 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
from torch import nn
from math import sqrt
assert_size_stride = torch._C._dynamo... | nazarblch/style-based-gan-pytorch | FusedUpsample | false | 4,051 | [
"MIT"
] | 0 | 5ed7fa114904501d77b414921cd9f439773ba24c | https://github.com/nazarblch/style-based-gan-pytorch/tree/5ed7fa114904501d77b414921cd9f439773ba24c |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class XavierLinear(nn.Module):
def __init__(self, d_in, d_out, bias=True):
super().__init__()
self.linear = nn.Linear(d_in, d_out, bias=bias)
nn.init.xavier_normal_(self.linear.weight)
def forward(self, x):
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
from torch._inductor.runtime.... | muberraozmen/MrMP | MultiHeadAttention | false | 4,052 | [
"MIT"
] | 0 | da6bcccbad85a682c848ff4aa1121c773d779e57 | https://github.com/muberraozmen/MrMP/tree/da6bcccbad85a682c848ff4aa1121c773d779e57 |
DecoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class XavierLinear(nn.Module):
def __init__(self, d_in, d_out, bias=True):
super().__init__()
self.linear = nn.Linear(d_in, d_out, bias=bias)
nn.init.xavier_normal_(self.linear.weight)
def forward(self, x):
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
from torch._inductor.runtime.... | muberraozmen/MrMP | DecoderLayer | false | 4,053 | [
"MIT"
] | 0 | da6bcccbad85a682c848ff4aa1121c773d779e57 | https://github.com/muberraozmen/MrMP/tree/da6bcccbad85a682c848ff4aa1121c773d779e57 |
BiAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class BiAttention(nn.Module):
def __init__(self, input_size, dropout):
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.input_linear = nn.Linear(input_size, 1, bias=False)
self.m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mwakaba2/KOBE | BiAttention | false | 4,054 | [
"MIT"
] | 0 | e225e78fb18b5fc9785d521a3cd611fff3eaaf87 | https://github.com/mwakaba2/KOBE/tree/e225e78fb18b5fc9785d521a3cd611fff3eaaf87 |
FusedDownsample | import torch
from torch import nn
from torch.nn import functional as F
from math import sqrt
class FusedDownsample(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, padding=0):
super().__init__()
weight = torch.randn(out_channel, in_channel, kernel_size, kernel_size)
bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 math import sqrt
assert_size_stride = torch._C._dynamo... | nazarblch/style-based-gan-pytorch | FusedDownsample | false | 4,055 | [
"MIT"
] | 0 | 5ed7fa114904501d77b414921cd9f439773ba24c | https://github.com/nazarblch/style-based-gan-pytorch/tree/5ed7fa114904501d77b414921cd9f439773ba24c |
DeiTOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class DeiTOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.checkpoint
assert_size_stride = torch._C... | ncoop57/transformers | DeiTOutput | false | 4,056 | [
"Apache-2.0"
] | 0 | d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee | https://github.com/ncoop57/transformers/tree/d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee |
EncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class XavierLinear(nn.Module):
def __init__(self, d_in, d_out, bias=True):
super().__init__()
self.linear = nn.Linear(d_in, d_out, bias=bias)
nn.init.xavier_normal_(self.linear.weight)
def forward(self, x):
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
from torch._inductor.runtime.... | muberraozmen/MrMP | EncoderLayer | false | 4,057 | [
"MIT"
] | 0 | da6bcccbad85a682c848ff4aa1121c773d779e57 | https://github.com/muberraozmen/MrMP/tree/da6bcccbad85a682c848ff4aa1121c773d779e57 |
ConvDropoutLayerNorm | import torch
from torch import nn
import torch.utils.checkpoint
class SqueezeBertLayerNorm(nn.LayerNorm):
"""
This is a nn.LayerNorm subclass that accepts NCW data layout and performs normalization in the C dimension.
N = batch C = channels W = sequence length
"""
def __init__(self, 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
from torch import n... | ncoop57/transformers | ConvDropoutLayerNorm | false | 4,058 | [
"Apache-2.0"
] | 0 | d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee | https://github.com/ncoop57/transformers/tree/d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee |
DeiTEmbeddings | from _paritybench_helpers import _mock_config
import collections
import torch
from torch import nn
import torch.utils.checkpoint
import collections.abc
def to_2tuple(x):
if isinstance(x, collections.abc.Iterable):
return x
return x, x
class PatchEmbeddings(nn.Module):
"""
Image to Patch Embe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import collections
from torch import nn
import torch.utils.checkpoint
import col... | ncoop57/transformers | DeiTEmbeddings | false | 4,059 | [
"Apache-2.0"
] | 0 | d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee | https://github.com/ncoop57/transformers/tree/d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee |
PerceptronTanh | import torch
import torch.nn as nn
import torch.nn.functional as F
class PerceptronTanh(nn.Module):
"""Implements a 1-layer perceptron with Tanh activaton."""
def __init__(self, input_dimension, hidden_dimension, output_dimension):
super(PerceptronTanh, self).__init__()
self._layer1 = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | negotiatorvivian/PDP-SP | PerceptronTanh | false | 4,060 | [
"MIT"
] | 0 | 0fa4c1145c2b881c1fde4ed8d9f0845b7967f857 | https://github.com/negotiatorvivian/PDP-SP/tree/0fa4c1145c2b881c1fde4ed8d9f0845b7967f857 |
CanineSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
class CanineSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if (config.hidden_size % config.num_attention_heads != 0 and not
hasattr(confi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ncoop57/transformers | CanineSelfAttention | false | 4,061 | [
"Apache-2.0"
] | 0 | d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee | https://github.com/ncoop57/transformers/tree/d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee |
Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
keep_rate = 0.5
self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=
3, stride=1, padding='same', bias=True)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | mntalha/U-NET_Iplementation | Model | false | 4,062 | [
"MIT"
] | 0 | 7fc2a34352f02a4989659053a6dd8717134913a0 | https://github.com/mntalha/U-NET_Iplementation/tree/7fc2a34352f02a4989659053a6dd8717134913a0 |
DeconvBlock | import torch
import torch.nn as nn
class DeconvBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(DeconvBlock, self).__init__()
self.conv = nn.ConvTranspose2d(in_channels, out_channels,
kernel_size=3, stride=2, padding=1, output_padding=0)
self.pad = nn.Ref... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | maxuanquang/FeatDepth | DeconvBlock | false | 4,063 | [
"MIT"
] | 0 | cc68d9f1f49b65ace8f2918af5b9d552ecd80ba4 | https://github.com/maxuanquang/FeatDepth/tree/cc68d9f1f49b65ace8f2918af5b9d552ecd80ba4 |
BasicModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicModel(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
input = 1 - F.relu(1 - input)
return input
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_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... | ngduduong/captum | BasicModel | false | 4,064 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
Perceptron | import torch
import torch.nn as nn
import torch.nn.functional as F
class Perceptron(nn.Module):
"""Implements a 1-layer perceptron."""
def __init__(self, input_dimension, hidden_dimension, output_dimension):
super(Perceptron, self).__init__()
self._layer1 = nn.Linear(input_dimension, hidden_d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | negotiatorvivian/PDP-SP | Perceptron | false | 4,065 | [
"MIT"
] | 0 | 0fa4c1145c2b881c1fde4ed8d9f0845b7967f857 | https://github.com/negotiatorvivian/PDP-SP/tree/0fa4c1145c2b881c1fde4ed8d9f0845b7967f857 |
Conv5x5 | import torch
import torch.nn as nn
class Conv5x5(nn.Module):
def __init__(self, in_channels, out_channels, use_refl=True):
super(Conv5x5, self).__init__()
if use_refl:
self.pad = nn.ReflectionPad2d(2)
else:
self.pad = nn.ZeroPad2d(2)
self.conv = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | maxuanquang/FeatDepth | Conv5x5 | false | 4,066 | [
"MIT"
] | 0 | cc68d9f1f49b65ace8f2918af5b9d552ecd80ba4 | https://github.com/maxuanquang/FeatDepth/tree/cc68d9f1f49b65ace8f2918af5b9d552ecd80ba4 |
BasicModel4_MultiArgs | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicModel4_MultiArgs(nn.Module):
"""
Slightly modified example model from the paper
https://arxiv.org/pdf/1703.01365.pdf
f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2) / x3)
"""
def __init__(self):
super()... | 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... | ngduduong/captum | BasicModel4_MultiArgs | false | 4,067 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
MultiRelu | import torch
import torch.nn as nn
class MultiRelu(nn.Module):
def __init__(self, inplace=False):
super().__init__()
self.relu1 = nn.ReLU(inplace=inplace)
self.relu2 = nn.ReLU(inplace=inplace)
def forward(self, arg1, arg2):
return self.relu1(arg1), self.relu2(arg2)
def get_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ngduduong/captum | MultiRelu | false | 4,068 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
AlbertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from typing import List
from typing import Tuple
from torch import nn
from typing import Set
import torch.utils.checkpoint
def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int',
head_size: 'int', already_pruned_heads: 'Set[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.... | ncoop57/transformers | AlbertAttention | false | 4,069 | [
"Apache-2.0"
] | 0 | d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee | https://github.com/ncoop57/transformers/tree/d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee |
BasicModel3 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicModel3(nn.Module):
"""
Example model two from the paper
https://arxiv.org/pdf/1703.01365.pdf
f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2))
"""
def __init__(self):
super().__init__()
def forward... | 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... | ngduduong/captum | BasicModel3 | false | 4,070 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
BasicModel5_MultiArgs | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicModel5_MultiArgs(nn.Module):
"""
Slightly modified example model from the paper
https://arxiv.org/pdf/1703.01365.pdf
f(x1, x2) = RELU(ReLU(x1 - 1) * x3[0] - ReLU(x2) * x3[1])
"""
def __init__(self):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ngduduong/captum | BasicModel5_MultiArgs | false | 4,071 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
BasicModel6_MultiTensor | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicModel6_MultiTensor(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input1, input2):
input = input1 + input2
return 1 - F.relu(1 - input)[:, 1]
def get_inputs():
return [torch.rand... | 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... | ngduduong/captum | BasicModel6_MultiTensor | false | 4,072 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
T5DenseReluDense | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint
class T5DenseReluDense(nn.Module):
def __init__(self, config):
super().__init__()
self.wi = nn.Linear(config.d_model, config.d_ff, bias=False)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Hzfinfdu/Black-Box-Tuning | T5DenseReluDense | false | 4,073 | [
"MIT"
] | 0 | 64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 | https://github.com/Hzfinfdu/Black-Box-Tuning/tree/64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 |
STFullyConnected | import time
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.nn import functional as F
class Base(nn.Module):
""" This class is the base structure for all of classification/regression DNN models.
Mainly, it provides the general methods for training, evaluating model and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | naisuu/DrugEx | STFullyConnected | false | 4,074 | [
"MIT"
] | 0 | 8708c98a137473f11990d70e43a46018806b6f39 | https://github.com/naisuu/DrugEx/tree/8708c98a137473f11990d70e43a46018806b6f39 |
BasicModel2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicModel2(nn.Module):
"""
Example model one from the paper
https://arxiv.org/pdf/1703.01365.pdf
f(x1, x2) = RELU(ReLU(x1) - 1 - ReLU(x2))
"""
def __init__(self):
super().__init__()
def forward... | 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... | ngduduong/captum | BasicModel2 | false | 4,075 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
ReLUDeepLiftModel | import torch
import torch.nn as nn
class ReLUDeepLiftModel(nn.Module):
"""
https://www.youtube.com/watch?v=f_iAM0NPwnM
"""
def __init__(self):
super().__init__()
self.relu1 = nn.ReLU()
self.relu2 = nn.ReLU()
def forward(self, x1, x2):
return 2 * self.relu1(x1)... | 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... | ngduduong/captum | ReLUDeepLiftModel | false | 4,076 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
FeatureModel | import torch
import torch.nn as nn
class FeatureModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, feature_size_out=64,
prior=0.01, feature_size=256):
super(FeatureModel, self).__init__()
self.feature_size_out = feature_size_out
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_... | nassarofficial/pytorch-retina | FeatureModel | false | 4,077 | [
"Apache-2.0"
] | 0 | b2f10ffa7617797280c1f44d562c455b996254af | https://github.com/nassarofficial/pytorch-retina/tree/b2f10ffa7617797280c1f44d562c455b996254af |
TanhDeepLiftModel | import torch
import torch.nn as nn
class TanhDeepLiftModel(nn.Module):
"""
Same as the ReLUDeepLiftModel, but with activations
that can have negative outputs
"""
def __init__(self):
super().__init__()
self.tanh1 = nn.Tanh()
self.tanh2 = nn.Tanh()
def forward(s... | 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_... | ngduduong/captum | TanhDeepLiftModel | false | 4,078 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
SigmoidDeepLiftModel | import torch
import torch.nn as nn
class SigmoidDeepLiftModel(nn.Module):
"""
Model architecture from:
https://medium.com/coinmonks/create-a-neural-network-in
-pytorch-and-make-your-life-simpler-ec5367895199
"""
def __init__(self, num_in, num_hidden, num_out):
super().... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ngduduong/captum | SigmoidDeepLiftModel | false | 4,079 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
BasicModel_ConvNet_One_Conv | import torch
import torch.nn as nn
class BasicModel_ConvNet_One_Conv(nn.Module):
def __init__(self, inplace=False):
super().__init__()
self.conv1 = nn.Conv2d(1, 2, 3, 1)
self.relu1 = nn.ReLU(inplace=inplace)
self.fc1 = nn.Linear(8, 4)
self.conv1.weight = nn.Parameter(torch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ngduduong/captum | BasicModel_ConvNet_One_Conv | false | 4,080 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
Binarizer | import torch
from abc import ABC
from sklearn.preprocessing import Binarizer
class BaseOperator(ABC):
"""
Abstract class defining the basic structure for operator implementations in Hummingbird.
"""
def __init__(self, regression=False, classification=False, transformer=
False, anomaly_detecti... | 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 abc import ABC
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_stri... | kvenkman/hummingbird | Binarizer | false | 4,081 | [
"MIT"
] | 0 | dac08f4ff4a4103df4a8e83329a02f2d804bf34d | https://github.com/kvenkman/hummingbird/tree/dac08f4ff4a4103df4a8e83329a02f2d804bf34d |
DeiTAttention | from _paritybench_helpers import _mock_config
import math
import torch
from typing import List
from typing import Tuple
from torch import nn
from typing import Set
import torch.utils.checkpoint
def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int',
head_size: 'int', already_pruned_heads: 'Set[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.... | ncoop57/transformers | DeiTAttention | false | 4,082 | [
"Apache-2.0"
] | 0 | d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee | https://github.com/ncoop57/transformers/tree/d7e156bd1ae2467e9ea1dbc44f31da0ed2296aee |
SoftmaxModel | import torch
import torch.nn as nn
class SoftmaxModel(nn.Module):
"""
Model architecture from:
https://adventuresinmachinelearning.com/pytorch-tutorial-deep-learning/
"""
def __init__(self, num_in, num_hidden, num_out, inplace=False):
super().__init__()
self.num_in = num_i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ngduduong/captum | SoftmaxModel | false | 4,083 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
TinyCnn | import torch
import torch.nn as nn
class TinyCnn(nn.Module):
def __init__(self, feature_extraction=False):
super().__init__()
self.feature_extraction = feature_extraction
self.conv1 = nn.Conv2d(3, 3, 5)
self.relu1 = nn.ReLU()
self.pool1 = nn.MaxPool2d(2, 2)
if not ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ngduduong/captum | TinyCnn | false | 4,084 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
MLPNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLPNet(nn.Module):
def __init__(self):
super(MLPNet, 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 = x.v... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ngtrunghuan/50.021-ArtificialIntelligence | MLPNet | false | 4,085 | [
"MIT"
] | 0 | b0c3d9f8cc70312ea1298818482a4b25d4ddbded | https://github.com/ngtrunghuan/50.021-ArtificialIntelligence/tree/b0c3d9f8cc70312ea1298818482a4b25d4ddbded |
ResNNFlow | import torch
import torch.utils.data
class ResNNFlow(torch.nn.Sequential):
def __init__(self, *args, **kwargs):
super(ResNNFlow, self).__init__(*args, **kwargs)
self.gate = torch.nn.Parameter(torch.nn.init.normal_(torch.Tensor(1)))
def forward(self, inputs):
or_inputs = 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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | nicola-decao/M-NAF-experiments-VAE | ResNNFlow | false | 4,086 | [
"MIT"
] | 0 | b8e127205e84d94ae50618e95734f20d259f7934 | https://github.com/nicola-decao/M-NAF-experiments-VAE/tree/b8e127205e84d94ae50618e95734f20d259f7934 |
GatedConv2d | import torch
import torch.utils.data
import torch.nn as nn
class GatedConv2d(nn.Module):
def __init__(self, input_channels, output_channels, kernel_size, stride,
padding, dilation=1, activation=None):
super(GatedConv2d, self).__init__()
self.activation = activation
self.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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | nicola-decao/M-NAF-experiments-VAE | GatedConv2d | false | 4,087 | [
"MIT"
] | 0 | b8e127205e84d94ae50618e95734f20d259f7934 | https://github.com/nicola-decao/M-NAF-experiments-VAE/tree/b8e127205e84d94ae50618e95734f20d259f7934 |
NPIArg | import torch
import torch.nn as nn
import torch.nn.functional as F
class NPIArg(nn.Module):
def __init__(self, input_dim: 'int', arg_dim: 'int'):
super(NPIArg, self).__init__()
self.f_arg = nn.Linear(input_dim, arg_dim)
def forward(self, x):
x = self.f_arg(x)
x = F.log_softma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | nienjiuntai/pytorch-npi | NPIArg | false | 4,088 | [
"MIT"
] | 0 | 16b413c152dfb7f1506a85997adc10ddc2d9af35 | https://github.com/nienjiuntai/pytorch-npi/tree/16b413c152dfb7f1506a85997adc10ddc2d9af35 |
NPIProg | import torch
import torch.nn as nn
import torch.nn.functional as F
class NPIProg(nn.Module):
def __init__(self, input_dim: 'int', prog_key_dim: 'int', prog_num: 'int'):
super(NPIProg, self).__init__()
self._fcn1 = nn.Linear(in_features=input_dim, out_features=prog_key_dim
)
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
from torch._inductor.runtime.... | nienjiuntai/pytorch-npi | NPIProg | false | 4,089 | [
"MIT"
] | 0 | 16b413c152dfb7f1506a85997adc10ddc2d9af35 | https://github.com/nienjiuntai/pytorch-npi/tree/16b413c152dfb7f1506a85997adc10ddc2d9af35 |
BasicModel_ConvNet | import torch
import torch.nn as nn
class BasicModel_ConvNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 2, 3, 1)
self.relu1 = nn.ReLU()
self.pool1 = nn.MaxPool2d(2)
self.conv2 = nn.Conv2d(2, 4, 3, 1)
self.relu2 = nn.ReLU()
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.... | ngduduong/captum | BasicModel_ConvNet | false | 4,090 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
GammaLoss | import torch
import torch.nn
class GammaLoss(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, y, y_hat):
p = 2
loss = -y * torch.pow(y_hat, 1 - p) / (1 - p) + torch.pow(y_hat, 2 - p
) / (2 - p)
return torch.mean(loss)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | nizamphoenix/kaggle | GammaLoss | false | 4,091 | [
"MIT"
] | 0 | a9c993d0441a6d9260d605a630f95d938e6329db | https://github.com/nizamphoenix/kaggle/tree/a9c993d0441a6d9260d605a630f95d938e6329db |
BasicModel_ConvNet_MaxPool1d | import torch
import torch.nn as nn
class BasicModel_ConvNet_MaxPool1d(nn.Module):
"""Same as above, but with the MaxPool2d replaced
with a MaxPool1d. This is useful because the MaxPool modules
behave differently to other modules from the perspective
of the DeepLift Attributions
"""
def __init... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ngduduong/captum | BasicModel_ConvNet_MaxPool1d | false | 4,092 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
LogCoshLoss | import torch
import torch.nn
class LogCoshLoss(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, y_t, y_prime_t):
ey_t = torch.abs(y_t - y_prime_t)
return torch.mean(torch.log(torch.cosh(ey_t + 1e-16)))
def get_inputs():
return [torch.rand([4, 4, 4, 4])... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | nizamphoenix/kaggle | LogCoshLoss | false | 4,093 | [
"MIT"
] | 0 | a9c993d0441a6d9260d605a630f95d938e6329db | https://github.com/nizamphoenix/kaggle/tree/a9c993d0441a6d9260d605a630f95d938e6329db |
AbsModel | from torch.nn import Module
import torch
from torch import Tensor
from torch.nn import Identity
from torch.nn.modules import Module
import torch.optim.lr_scheduler
class AbsLayer(Module):
def forward(self, x: 'Tensor') ->Tensor:
return torch.abs(x).reshape((-1, 1))
class AbsModel(Module):
"""Fake 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.triton_helpers import math as tl_math
from torch.nn import Module
from torch import Tensor
from torch.nn import... | nuwangunasekara/avalanche | AbsModel | false | 4,094 | [
"MIT"
] | 0 | 1f4d5b3e559552394cce573a85b1c9af26a544fb | https://github.com/nuwangunasekara/avalanche/tree/1f4d5b3e559552394cce573a85b1c9af26a544fb |
OcclusionAwareSimilarity | import torch
import torch.nn as nn
class OcclusionAwareSimilarity(nn.Module):
def __init__(self, threshold):
super(OcclusionAwareSimilarity, self).__init__()
self.threshold = threshold
def forward(self, similarity_matrix):
indicator_zero = similarity_matrix <= self.threshold
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_index_put_lift_fres... | nv-nguyen/template-pose | OcclusionAwareSimilarity | false | 4,095 | [
"MIT"
] | 0 | ce1ffead1887b54efc8031e8e2442ba884e512ec | https://github.com/nv-nguyen/template-pose/tree/ce1ffead1887b54efc8031e8e2442ba884e512ec |
SpatialGatingUnit | import torch
import torch.nn as nn
class SpatialGatingUnit(nn.Module):
def __init__(self, dim_seq, dim_ff):
super().__init__()
self.proj = nn.Linear(dim_seq, dim_seq)
nn.init.zeros_(self.proj.weight)
nn.init.ones_(self.proj.bias)
self.norm = nn.LayerNorm(normalized_shape=d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | nima1999nikkhah/SimCLR_gMLP | SpatialGatingUnit | false | 4,096 | [
"MIT"
] | 0 | 32cca4764d4266493cb7d141eb9ef01a91f63996 | https://github.com/nima1999nikkhah/SimCLR_gMLP/tree/32cca4764d4266493cb7d141eb9ef01a91f63996 |
BasicModel_ConvNet_MaxPool3d | import torch
import torch.nn as nn
class BasicModel_ConvNet_MaxPool3d(nn.Module):
"""Same as above, but with the MaxPool1d replaced
with a MaxPool3d. This is useful because the MaxPool modules
behave differently to other modules from the perspective
of the DeepLift Attributions
"""
def __init... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ngduduong/captum | BasicModel_ConvNet_MaxPool3d | false | 4,097 | [
"BSD-3-Clause"
] | 0 | 6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 | https://github.com/ngduduong/captum/tree/6fe5f0f23ea975e73e0c0dee79bdc01b4223d283 |
SelfMatch2 | 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.... | nikcaryo/cs224n-squad | SelfMatch2 | false | 4,098 | [
"MIT"
] | 0 | 4bebca38f3cbaab8c80cd306863d6dca1d9cdf76 | https://github.com/nikcaryo/cs224n-squad/tree/4bebca38f3cbaab8c80cd306863d6dca1d9cdf76 |
VAE | import torch
import torch.nn as nn
import torch.utils.data
from math import *
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(784, 400)
self.fc2 = nn.Linear(400, 20)
self.fc3 = nn.Linear(20, 2)
self.fc4 = nn.Linear(2, 20)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | niujinshuchong/stochastic_processes | VAE | false | 4,099 | [
"MIT"
] | 0 | ea2538d2f09c39bec1834df5addd37e0699a88bf | https://github.com/niujinshuchong/stochastic_processes/tree/ea2538d2f09c39bec1834df5addd37e0699a88bf |
ScaleNorm | import torch
import torch.nn as nn
class ScaleNorm(nn.Module):
"""ScaleNorm"""
def __init__(self, scale, eps=1e-05):
super(ScaleNorm, self).__init__()
self.scale = scale
self.eps = eps
def forward(self, x):
norm = self.scale / torch.norm(x, dim=1, keepdim=True).clamp(min=... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | nvski/ST-TR | ScaleNorm | false | 4,100 | [
"MIT"
] | 0 | 75aa9fb872af217f8616c01cee7ca6548846260b | https://github.com/nvski/ST-TR/tree/75aa9fb872af217f8616c01cee7ca6548846260b |
MTFullyConnected | import time
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.nn import functional as F
class Base(nn.Module):
""" This class is the base structure for all of classification/regression DNN models.
Mainly, it provides the general methods for training, evaluating model and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 time
import numpy as n... | naisuu/DrugEx | MTFullyConnected | false | 4,101 | [
"MIT"
] | 0 | 8708c98a137473f11990d70e43a46018806b6f39 | https://github.com/naisuu/DrugEx/tree/8708c98a137473f11990d70e43a46018806b6f39 |
ModuloMapIDList | import abc
import torch
import torch.nn
import torch.optim
class MapIDList(torch.nn.Module):
@abc.abstractmethod
def forward(self, raw_values: 'torch.Tensor') ->torch.Tensor:
pass
class ModuloMapIDList(MapIDList):
def __init__(self, modulo: 'int'):
super().__init__()
self.modul... | 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 abc
import torch.nn
import torch.optim
assert_size_stride = torch._C._dy... | mcx/ReAgent | ModuloMapIDList | false | 4,102 | [
"BSD-3-Clause"
] | 0 | 57b58a8b3a6b74bb87a197b73a6cd108ddad895e | https://github.com/mcx/ReAgent/tree/57b58a8b3a6b74bb87a197b73a6cd108ddad895e |
gMLPBlock | import torch
import torch.nn as nn
class SpatialGatingUnit(nn.Module):
def __init__(self, dim_seq, dim_ff):
super().__init__()
self.proj = nn.Linear(dim_seq, dim_seq)
nn.init.zeros_(self.proj.weight)
nn.init.ones_(self.proj.bias)
self.norm = nn.LayerNorm(normalized_shape=d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | nima1999nikkhah/SimSiam_gMLP | gMLPBlock | false | 4,103 | [
"MIT"
] | 0 | 9cccd1092c02267951d39ae77c0fe5a91d735903 | https://github.com/nima1999nikkhah/SimSiam_gMLP/tree/9cccd1092c02267951d39ae77c0fe5a91d735903 |
GlobalConvBlock | import torch
from torch import nn
from math import sqrt
class GlobalConvBlock(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size):
super(GlobalConvBlock, self).__init__()
pad0 = int((kernel_size[0] - 1) / 2)
pad1 = int((kernel_size[1] - 1) / 2)
self.conv_l1 = nn.Conv2d(in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from math import sqrt
assert_size_stride = torch._C._dynamo... | odgiv/SegAN | GlobalConvBlock | false | 4,104 | [
"MIT"
] | 0 | d7a91fbc10139dc81c61737326649a3a758cdf94 | https://github.com/odgiv/SegAN/tree/d7a91fbc10139dc81c61737326649a3a758cdf94 |
EdgeFeaturesLayer | import torch
import torch.nn as nn
class EdgeFeaturesLayer(nn.Module):
def __init__(self, d_model, d_edge, h, dropout):
super(EdgeFeaturesLayer, self).__init__()
assert d_model % h == 0
d_model // h
self.linear = nn.Linear(d_edge, 1, bias=False)
with torch.no_grad():
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | odb9402/MAT | EdgeFeaturesLayer | false | 4,106 | [
"MIT"
] | 0 | 95d8083170da2c8ce1f5898b3a556bcf54eac8cc | https://github.com/odb9402/MAT/tree/95d8083170da2c8ce1f5898b3a556bcf54eac8cc |
Generator | import math
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""Construct a layernorm module (See citation for details)."""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | odb9402/MAT | Generator | false | 4,107 | [
"MIT"
] | 0 | 95d8083170da2c8ce1f5898b3a556bcf54eac8cc | https://github.com/odb9402/MAT/tree/95d8083170da2c8ce1f5898b3a556bcf54eac8cc |
Concat | import torch
from torch import nn
import torch.nn
import torch.optim
class Concat(nn.Module):
def forward(self, state: 'torch.Tensor', action: 'torch.Tensor'):
return torch.cat((state, action), dim=-1)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inpu... | 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.nn
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda =... | mcx/ReAgent | Concat | false | 4,108 | [
"BSD-3-Clause"
] | 0 | 57b58a8b3a6b74bb87a197b73a6cd108ddad895e | https://github.com/mcx/ReAgent/tree/57b58a8b3a6b74bb87a197b73a6cd108ddad895e |
Quantization | import torch
import torch.utils.data
import torch.nn as nn
class Quant(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
input = torch.clamp(input, 0, 1)
output = (input * 255.0).round() / 255.0
return output
@staticmethod
def backward(ctx, grad_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
impo... | peterhan91/Invertible-Image-Rescaling | Quantization | false | 4,109 | [
"Apache-2.0"
] | 0 | b92162f5e9be2cff2f5dba379914fcded4e04f4c | https://github.com/peterhan91/Invertible-Image-Rescaling/tree/b92162f5e9be2cff2f5dba379914fcded4e04f4c |
SpatialMeanAndStd | import torch
import torch.nn.functional
import torch.nn as nn
import torch.nn.init
import torch.onnx
class SpatialMeanAndStd(nn.Module):
def __init__(self, shape, eps=0.0001, half_size=1.0):
super(SpatialMeanAndStd, self).__init__()
p = torch.empty((2, shape[0], shape[1]), dtype=torch.float32)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.functional
import torch.nn as nn
import torch.nn.init
import to... | opentrack/neuralnet-tracker-traincode | SpatialMeanAndStd | false | 4,110 | [
"ISC",
"CC0-1.0",
"Unlicense"
] | 0 | 688ada0f46cb407d1809b50c11a136a239290123 | https://github.com/opentrack/neuralnet-tracker-traincode/tree/688ada0f46cb407d1809b50c11a136a239290123 |
PositionGenerator | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""Construct a layernorm module (See citation for details)."""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(torch.zeros(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 torch.nn as ... | odb9402/MAT | PositionGenerator | false | 4,111 | [
"MIT"
] | 0 | 95d8083170da2c8ce1f5898b3a556bcf54eac8cc | https://github.com/odb9402/MAT/tree/95d8083170da2c8ce1f5898b3a556bcf54eac8cc |
SoftmaxOutputLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class OutputLayer(nn.Module):
"""
Abstract base class for output layer.
Handles projection to output labels
"""
def __init__(self, hidden_size, output_size):
super(OutputLayer, self).__init__()
self.output_size = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | oya163/torchnlp | SoftmaxOutputLayer | false | 4,112 | [
"Apache-2.0"
] | 0 | 361caa24d741e47b8bd92af122ae281d6ad72d9d | https://github.com/oya163/torchnlp/tree/361caa24d741e47b8bd92af122ae281d6ad72d9d |
ScoreCap | import torch
from torch import nn
import torch.nn
import torch.optim
class ScoreCap(nn.Module):
def __init__(self, cap: 'float'):
super().__init__()
self.cap = cap
def forward(self, input):
return torch.clip(input, max=self.cap)
def get_inputs():
return [torch.rand([4, 4, 4, 4]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.nn
import torch.optim
assert_size_stride = torch._C._dy... | mcx/ReAgent | ScoreCap | false | 4,113 | [
"BSD-3-Clause"
] | 0 | 57b58a8b3a6b74bb87a197b73a6cd108ddad895e | https://github.com/mcx/ReAgent/tree/57b58a8b3a6b74bb87a197b73a6cd108ddad895e |
SelfGating | import torch
import torch.nn as nn
class SelfGating(nn.Module):
def __init__(self, input_dim):
super(SelfGating, self).__init__()
self.fc = nn.Linear(input_dim, input_dim)
def forward(self, input_tensor):
"""Feature gating as used in S3D-G"""
spatiotemporal_average = torch.me... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | necla-ml/CPR | SelfGating | false | 4,114 | [
"BSD-3-Clause"
] | 0 | 101023c587a35b254ea640b4501167a6830856af | https://github.com/necla-ml/CPR/tree/101023c587a35b254ea640b4501167a6830856af |
SharpenedCosineSimilarity | import torch
import torch.nn as nn
import torch.nn.functional as F
class SharpenedCosineSimilarity(nn.Conv2d):
def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size,
stride=1, padding=None, dilation=1, groups: 'int'=1, bias: 'bool'=
False, q_init: 'float'=10, p_init: 'float'=1.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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | p-sodmann/sharpened_cosine_similarity_torch | SharpenedCosineSimilarity | false | 4,115 | [
"MIT"
] | 0 | 0562e54f6494f365e321da9ae91edaba8595e3aa | https://github.com/p-sodmann/sharpened_cosine_similarity_torch/tree/0562e54f6494f365e321da9ae91edaba8595e3aa |
GaussianParamNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class GaussianParamNet(nn.Module):
"""
Parameterise a Gaussian distributions.
"""
def __init__(self, input_dim, output_dim):
super(GaussianParamNet, self).__init__()
self.fc1 = nn.Linear(input_dim, input_dim, bias=Fals... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | pemami4911/MulMON | GaussianParamNet | false | 4,116 | [
"MIT"
] | 0 | e01438e7a9a1259dc473e7ffd20a005eeaea87cb | https://github.com/pemami4911/MulMON/tree/e01438e7a9a1259dc473e7ffd20a005eeaea87cb |
VectorQuantizer | import torch
import torch.utils.data
from torch import nn
from torch.nn import functional as F
class VectorQuantizer(nn.Module):
"""
Tensorflow original: https://github.com/deepmind/sonnet/blob/v2/sonnet/src/nets/vqvae.py
Based on: https://github.com/AntixK/PyTorch-VAE/blob/master/models/vq_vae.py
"""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ltschmitt/RecGen | VectorQuantizer | false | 4,117 | [
"MIT"
] | 0 | 7f69b76b4213c823a3ff05c0e754face8b179896 | https://github.com/ltschmitt/RecGen/tree/7f69b76b4213c823a3ff05c0e754face8b179896 |
CRFOutputLayer | import torch
import torch.nn as nn
class CRF(nn.Module):
"""
Implements Conditional Random Fields that can be trained via
backpropagation.
"""
def __init__(self, num_tags):
super(CRF, self).__init__()
self.num_tags = num_tags
self.transitions = nn.Parameter(torch.Tensor(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
import torch.nn as nn
assert_... | oya163/torchnlp | CRFOutputLayer | false | 4,118 | [
"Apache-2.0"
] | 0 | 361caa24d741e47b8bd92af122ae281d6ad72d9d | https://github.com/oya163/torchnlp/tree/361caa24d741e47b8bd92af122ae281d6ad72d9d |
SparseDownSampleClose | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class SparseDownSampleClose(nn.Module):
def __init__(self, stride):
super(SparseDownSampleClose, self).__init__()
self.pooling = nn.MaxPool2d(stride, stride)
self.large_number = 600
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | phatli/PENet_ICRA2021 | SparseDownSampleClose | false | 4,119 | [
"MIT"
] | 0 | 18594b8f11d4d99022d9c80a86a6e2d4e854404a | https://github.com/phatli/PENet_ICRA2021/tree/18594b8f11d4d99022d9c80a86a6e2d4e854404a |
Allocation | from torch.nn import Module
import torch
from torch.nn import functional as F
from torch.nn import Linear
class Allocation(Module):
"""Determines allocation probability for each of the bidders given an input.
Args:
in_features: size of each input sample
bidders: number of bidders, which 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 import triton_helpers
from torch._inductor.runtime.... | pjordan/dmch | Allocation | false | 4,120 | [
"Apache-2.0"
] | 0 | 84e04ddb0679007b15acfdc275e0e3f51e50d9f2 | https://github.com/pjordan/dmch/tree/84e04ddb0679007b15acfdc275e0e3f51e50d9f2 |
MinLossModule | import torch
import torch.nn.functional as F
class MinLossModule(torch.nn.Module):
def __init__(self):
super(MinLossModule, self).__init__()
def forward(self, predictions, targets):
y_losses = F.cross_entropy(predictions, targets, reduction='none')
y_losses = torch.sum(y_losses, 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
assert_size_stride = t... | pkalluri/specialized-conditional-pcnn | MinLossModule | false | 4,121 | [
"Apache-2.0"
] | 0 | ed94e47654ed749a7dd3492c4e074e2a8fb12df8 | https://github.com/pkalluri/specialized-conditional-pcnn/tree/ed94e47654ed749a7dd3492c4e074e2a8fb12df8 |
SequentialAllocation | from torch.nn import Module
import torch
from torch.nn import functional as F
from torch.nn import Linear
def _sequential_allocation(p, weights):
_, slots, bidders_plus_one = p.shape
bidders = bidders_plus_one - 1
cumulative_total = p[:, 0, :bidders]
if weights is None:
alloc = cumulative_tota... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | pjordan/dmch | SequentialAllocation | false | 4,122 | [
"Apache-2.0"
] | 0 | 84e04ddb0679007b15acfdc275e0e3f51e50d9f2 | https://github.com/pjordan/dmch/tree/84e04ddb0679007b15acfdc275e0e3f51e50d9f2 |
TextureSegmentation | import torch
import torch.nn as nn
import torch.nn.functional as F
class TextureSegmentation(nn.Module):
def __init__(self):
super(TextureSegmentation, self).__init__()
self.decoder_conv1 = nn.ConvTranspose2d(16, 32, kernel_size=(8, 16),
stride=2, padding=(3, 7))
self.decoder_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | paucarre/staal | TextureSegmentation | false | 4,123 | [
"MIT"
] | 0 | 1635e514f0ed978a08c078afd258980bcb6f0cec | https://github.com/paucarre/staal/tree/1635e514f0ed978a08c078afd258980bcb6f0cec |
GeometryFeature | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class GeometryFeature(nn.Module):
def __init__(self):
super(GeometryFeature, self).__init__()
def forward(self, z, vnorm, unorm, h, w, ch, cw, fh, fw):
x = z * (0.5 * h * (vnorm + 1) - ch) ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | phatli/PENet_ICRA2021 | GeometryFeature | false | 4,124 | [
"MIT"
] | 0 | 18594b8f11d4d99022d9c80a86a6e2d4e854404a | https://github.com/phatli/PENet_ICRA2021/tree/18594b8f11d4d99022d9c80a86a6e2d4e854404a |
_VariableWeightsAndBiases | import torch
import torch.nn as nn
class _VariableWeightsAndBiases(nn.Module):
def __init__(self, in_features, hidden_features, out_features):
super(_VariableWeightsAndBiases, self).__init__()
self.linear = nn.Linear(in_features, hidden_features)
self.weights = nn.Linear(hidden_features, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | pjordan/dmch | _VariableWeightsAndBiases | false | 4,125 | [
"Apache-2.0"
] | 0 | 84e04ddb0679007b15acfdc275e0e3f51e50d9f2 | https://github.com/pjordan/dmch/tree/84e04ddb0679007b15acfdc275e0e3f51e50d9f2 |
Prototypes | import torch
import torch.nn as nn
from torch.nn import functional as F
class Prototypes(nn.Module):
def __init__(self, fdim, num_classes, temp=0.05):
super().__init__()
self.prototypes = nn.Linear(fdim, num_classes, bias=False)
self.temp = temp
def forward(self, x):
x = F.no... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | pmirallesr/Dassl.pytorch | Prototypes | false | 4,126 | [
"MIT"
] | 0 | ec41f816bb60a9af94c9b055c500f0e2e404cfc6 | https://github.com/pmirallesr/Dassl.pytorch/tree/ec41f816bb60a9af94c9b055c500f0e2e404cfc6 |
Value | import torch
import torch.nn as nn
class Value(nn.Module):
def __init__(self, num_inputs):
super(Value, self).__init__()
self.affine1 = nn.Linear(num_inputs, 64)
self.affine2 = nn.Linear(64, 64)
self.value_head = nn.Linear(64, 1)
self.value_head.weight.data.mul_(0.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.triton_helpers import libdevice
import torch.nn as ... | SaminYeasar/pytorch-trpo | Value | false | 4,127 | [
"MIT"
] | 0 | 653a3357cf0461c175fb741604c0cd4ad1f4b841 | https://github.com/SaminYeasar/pytorch-trpo/tree/653a3357cf0461c175fb741604c0cd4ad1f4b841 |
SpatialAttentionModule | import torch
import torch.nn as nn
class SpatialAttentionModule(nn.Module):
def __init__(self):
super(SpatialAttentionModule, self).__init__()
self.conv2d = nn.Conv2d(in_channels=2, out_channels=1, kernel_size=
7, stride=1, padding=3)
self.sigmoid = nn.Sigmoid()
def forwa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | poppy862/Qnet | SpatialAttentionModule | false | 4,128 | [
"Apache-2.0"
] | 0 | da751bc6eb9ae23e0ff9b96fe0afdfd6bed31f8b | https://github.com/poppy862/Qnet/tree/da751bc6eb9ae23e0ff9b96fe0afdfd6bed31f8b |
SumLossModule | import torch
import torch.nn.functional as F
class SumLossModule(torch.nn.Module):
def __init__(self):
super(SumLossModule, self).__init__()
def forward(self, predictions, targets):
y_losses = F.cross_entropy(predictions, targets, reduction='none')
y_losses = torch.sum(y_losses, 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
assert_size_stride = t... | pkalluri/specialized-conditional-pcnn | SumLossModule | false | 4,129 | [
"Apache-2.0"
] | 0 | ed94e47654ed749a7dd3492c4e074e2a8fb12df8 | https://github.com/pkalluri/specialized-conditional-pcnn/tree/ed94e47654ed749a7dd3492c4e074e2a8fb12df8 |
DQN | import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
def __init__(self, num_in_features, num_out_features):
super(DQN, self).__init__()
self.linear1 = nn.Linear(num_in_features, 32)
self.ln1 = nn.LayerNorm(32)
self.linear2 = 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.triton_helpers import libdevice
import torch.nn as ... | pgabriela/dqn-jitsi-autoscaler | DQN | false | 4,130 | [
"Apache-2.0"
] | 0 | b39eb335e584095ef66a9941dbe0b2ea21a02d4a | https://github.com/pgabriela/dqn-jitsi-autoscaler/tree/b39eb335e584095ef66a9941dbe0b2ea21a02d4a |
AttentiveNorm2d | import torch
import torch.nn as nn
import torch.utils.data
class AttentiveNorm2d(nn.BatchNorm2d):
def __init__(self, num_features, hidden_channels=32, eps=1e-05,
momentum=0.1, track_running_stats=False):
super(AttentiveNorm2d, self).__init__(num_features, eps=eps,
momentum=momentum, 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.triton_helpers import libdevice
import torch.nn as ... | ppomelo/Attentive-Transformation-Based-Normalization | AttentiveNorm2d | false | 4,131 | [
"Apache-2.0"
] | 0 | 62ad02eb025613e90f4fe0e0a9f0f85839e53092 | https://github.com/ppomelo/Attentive-Transformation-Based-Normalization/tree/62ad02eb025613e90f4fe0e0a9f0f85839e53092 |
DenseCrossEntropy | import torch
import torch.nn.functional as F
import torch.nn as nn
class DenseCrossEntropy(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits, labels):
logits = logits.float()
labels = labels.float()
logprobs = F.log_softmax(logits, dim=-1)
lo... | 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
... | prakhar154/Cassava-Leaf-Disease-Classification | DenseCrossEntropy | false | 4,132 | [
"MIT"
] | 0 | 04824834a6a1898c77858e8134bd3767c64789f2 | https://github.com/prakhar154/Cassava-Leaf-Disease-Classification/tree/04824834a6a1898c77858e8134bd3767c64789f2 |
BCEDiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class BCEDiceLoss(nn.Module):
def __init__(self):
super(BCEDiceLoss, self).__init__()
def forward(self, input, target):
bce = F.binary_cross_entropy_with_logits(input, target)
smooth = 1e-05
... | 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... | ppomelo/Attentive-Transformation-Based-Normalization | BCEDiceLoss | false | 4,133 | [
"Apache-2.0"
] | 0 | 62ad02eb025613e90f4fe0e0a9f0f85839e53092 | https://github.com/ppomelo/Attentive-Transformation-Based-Normalization/tree/62ad02eb025613e90f4fe0e0a9f0f85839e53092 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.