entry_point
stringlengths
1
65
original_triton_code
stringlengths
4.5k
619k
python_code
stringlengths
208
60.9k
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
pytorch_code
stringlengths
200
4.05k
Squash
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.jit class Squash(nn.Module): def forward(self, x): y = x ** 3 return torch.clamp(y, min=0) / (1 + y.abs()) 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 ...
ethanabrooks/teacher-RL
Squash
false
3,477
[ "MIT" ]
0
41b44fa4de1e8ce7e0c3eac726919c28ede63538
https://github.com/ethanabrooks/teacher-RL/tree/41b44fa4de1e8ce7e0c3eac726919c28ede63538
import torch import torch.nn as nn import torch.jit class Model(nn.Module): def forward(self, x): y = x ** 3 return torch.clamp(y, min=0) / (1 + y.abs()) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GeM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class GeM(nn.Module): def __init__(self, p=3, eps=1e-06): super(GeM, self).__init__() self.p = p self.eps = eps def forward(self, x): return self.gem(x, p=self.p, eps=self.eps) def gem(self, x, p=3, eps=1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional a...
esha-singh/DL_project
GeM
false
3,478
[ "MIT" ]
0
11ac2874845bc3982435cc37f4e0b8896b95660e
https://github.com/esha-singh/DL_project/tree/11ac2874845bc3982435cc37f4e0b8896b95660e
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, p=3, eps=1e-06): super().__init__() self.p = p self.eps = eps def forward(self, x): return self.gem(x, p=self.p, eps=self.eps) def gem(self, x, p=3, eps=1e-06): ...
Log
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.jit class Log(nn.Module): def forward(self, x): return torch.log(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.jit assert_size_stride = torch._C._dyn...
ethanabrooks/teacher-RL
Log
false
3,479
[ "MIT" ]
0
41b44fa4de1e8ce7e0c3eac726919c28ede63538
https://github.com/ethanabrooks/teacher-RL/tree/41b44fa4de1e8ce7e0c3eac726919c28ede63538
import torch import torch.nn as nn import torch.jit class Model(nn.Module): def forward(self, x): return torch.log(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
QREmbeddingBag
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch.nn.parameter import Parameter import torch.nn.functional as F class QREmbeddingBag(nn.Module): """Computes sums or means over two 'bags' of embeddings, one using the quotient of the indices and the other using the remainder of the indices, wi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np from torch import nn from torch.nn.parameter import Paramete...
divyanshugit/EnvisEdge
QREmbeddingBag
false
3,480
[ "Apache-2.0" ]
0
26b21fd0eb665fa23a8b8a825c9bf460994d6714
https://github.com/divyanshugit/EnvisEdge/tree/26b21fd0eb665fa23a8b8a825c9bf460994d6714
import torch import numpy as np from torch import nn from torch.nn.parameter import Parameter import torch.nn.functional as F class Model(nn.Module): """Computes sums or means over two 'bags' of embeddings, one using the quotient of the indices and the other using the remainder of the indices, without ins...
GatedActivation
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class GatedActivation(nn.Module): """Activation function which computes actiation_fn(f) * sigmoid(g). The f and g correspond to the top 1/2 and bottom 1/2 of the input channels. """ def __init__(self, activation_fn=torch.tanh): """Initializes a new GatedActiva...
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...
eyalbetzalel/pytorch-generative-1
GatedActivation
false
3,481
[ "MIT" ]
0
7c3adfdb57345220e14fdf3e827c041fa4db121c
https://github.com/eyalbetzalel/pytorch-generative-1/tree/7c3adfdb57345220e14fdf3e827c041fa4db121c
import torch from torch import nn class Model(nn.Module): """Activation function which computes actiation_fn(f) * sigmoid(g). The f and g correspond to the top 1/2 and bottom 1/2 of the input channels. """ def __init__(self, activation_fn=torch.tanh): """Initializes a new GatedActivation insta...
Hsigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(1.2 * x + 3.0, inplace=self.inplace) / 6.0 def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
eminem171333491/PaddleOCR2Pytorch
Hsigmoid
false
3,482
[ "Apache-2.0" ]
0
ec466bb3a689eccb9290e9f80812a45301d3b030
https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inplace=True): super().__init__() self.inplace = inplace def forward(self, x): return F.relu6(1.2 * x + 3.0, inplace=self.inplace) / 6.0 def get_inputs(): return [torch...
Conv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn class Conv(nn.Module): def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False, relu=True): super(Conv, self).__init__() self.inp_dim = inp_dim self.conv = nn.Conv2d(inp_dim, out_dim, kernel_size, stride, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
dmetehan/associative-embedding
Conv
false
3,483
[ "BSD-3-Clause" ]
0
a2c2e86e622cd97feec621fcfd34c3f97934e388
https://github.com/dmetehan/associative-embedding/tree/a2c2e86e622cd97feec621fcfd34c3f97934e388
import torch import torch.utils.data from torch import nn class Model(nn.Module): def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False, relu=True): super().__init__() self.inp_dim = inp_dim self.conv = nn.Conv2d(inp_dim, out_dim, kernel_size, stride, ...
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, state_dim, action_dim, hidden_dim=400): super(MLP, self).__init__() self.fc1 = nn.Linear(state_dim, hidden_dim) self.fc2 = nn.Linear(hidden_dim, hidden_dim) self.fc3 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
f2010126/DL_Labs
MLP
false
3,484
[ "BSD-3-Clause" ]
0
ee81d8aa6027846fc32c98feb9079211c59aa0e9
https://github.com/f2010126/DL_Labs/tree/ee81d8aa6027846fc32c98feb9079211c59aa0e9
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim, action_dim, hidden_dim=400): super().__init__() self.fc1 = nn.Linear(state_dim, hidden_dim) self.fc2 = nn.Linear(hidden_dim, hidden_dim) self.fc3 = nn.Linear(hi...
BertPooler
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch from torch import nn class BertPooler(nn.Module): def __init__(self, config): super(BertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Adoni/pytorch-pretrained-BERT
BertPooler
false
3,485
[ "Apache-2.0" ]
0
845c33f00e933626dcfc96e0923ecf034295ef75
https://github.com/Adoni/pytorch-pretrained-BERT/tree/845c33f00e933626dcfc96e0923ecf034295ef75
from _paritybench_helpers import _mock_config import torch from torch import nn class Model(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states): ...
Lookahead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data.distributed import torch.nn as nn import torch.nn.functional as F class Lookahead(nn.Module): def __init__(self, n_features, context): super(Lookahead, self).__init__() assert context > 0 self.context = context self.n_features = n_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.utils.data.distributed import torch.nn as nn assert_size_stride = t...
faboyds/deepspeech.pytorch
Lookahead
false
3,486
[ "MIT" ]
0
d20f3510a3c556a07f5d662a91a63acffc26633b
https://github.com/faboyds/deepspeech.pytorch/tree/d20f3510a3c556a07f5d662a91a63acffc26633b
import torch import torch.utils.data.distributed import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_features, context): super().__init__() assert context > 0 self.context = context self.n_features = n_features self.pad = 0, s...
make_binary
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor class make_binary(torch.nn.Module): def __init__(self, inplace=False): super().__init__() self.inplace = inplace def forward(self, tensor: 'Tensor') ->Tensor: return tensor % 2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_i...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
fcaretti/mitosis_MNIST
make_binary
false
3,487
[ "MIT" ]
0
3dce002ff41a09ddd65eb220dc6e5f5c0013a0ea
https://github.com/fcaretti/mitosis_MNIST/tree/3dce002ff41a09ddd65eb220dc6e5f5c0013a0ea
import torch from torch import Tensor class Model(torch.nn.Module): def __init__(self, inplace=False): super().__init__() self.inplace = inplace def forward(self, tensor: 'Tensor') ->Tensor: return tensor % 2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_in...
Convolutional
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class Convolutional(nn.Module): def __init__(self, num_classes=10): super().__init__() self.conv1 = nn.Conv2d(1, 16, 5) self.conv2 = nn.Conv2d(16, 32, 5) self.fc1 = nn.Linear(512, 128) self.fc2 = nn.Linear(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
f4str/digit-recognizer
Convolutional
false
3,488
[ "MIT" ]
0
67c175c683b22a3bf9d8a28dce812a82e08039d5
https://github.com/f4str/digit-recognizer/tree/67c175c683b22a3bf9d8a28dce812a82e08039d5
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, num_classes=10): super().__init__() self.conv1 = nn.Conv2d(1, 16, 5) self.conv2 = nn.Conv2d(16, 32, 5) self.fc1 = nn.Linear(512, 128) self.fc2 = nn.Linear(128, 64)...
FPNHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class FPNHead(nn.Module): def __init__(self, num_in, num_mid, num_out): super().__init__() self.block0 = nn.Conv2d(num_in, num_mid, kernel_size=3, padding=1, bias=False) self.block1 = nn.Conv2d(num_mid, num_out, kernel_size=3, padding=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 assert_...
emirkonuk/defocus
FPNHead
false
3,489
[ "Apache-2.0" ]
0
da2977d2698eb20e9ab2a3bcd1fa4d05e1dd9b50
https://github.com/emirkonuk/defocus/tree/da2977d2698eb20e9ab2a3bcd1fa4d05e1dd9b50
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_in, num_mid, num_out): super().__init__() self.block0 = nn.Conv2d(num_in, num_mid, kernel_size=3, padding=1, bias=False) self.block1 = nn.Conv2d(num_mid, num_out, kernel_size=3, padding=1, ...
FeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class FeedForward(nn.Module): def __init__(self, num_classes=10): super().__init__() self.linear1 = nn.Linear(784, 512) self.linear2 = nn.Linear(512, 128) self.linear3 = nn.Linear(128, num_classes) def forward...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
f4str/digit-recognizer
FeedForward
false
3,490
[ "MIT" ]
0
67c175c683b22a3bf9d8a28dce812a82e08039d5
https://github.com/f4str/digit-recognizer/tree/67c175c683b22a3bf9d8a28dce812a82e08039d5
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, num_classes=10): super().__init__() self.linear1 = nn.Linear(784, 512) self.linear2 = nn.Linear(512, 128) self.linear3 = nn.Linear(128, num_classes) def forward(self,...
PositionwiseFeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedForward(nn.Module): """Implements FFN equation.""" def __init__(self, d_model, d_ff, dropout=0.1): super(PositionwiseFeedForward, self).__init__() self.w_1 = nn.Linear(d_model, d_ff) self.norm = 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_...
fellenB/dcp
PositionwiseFeedForward
false
3,492
[ "MIT" ]
0
3ca7724799d38ff8a56acb4b8b9011bb41932cb0
https://github.com/fellenB/dcp/tree/3ca7724799d38ff8a56acb4b8b9011bb41932cb0
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Implements FFN equation.""" def __init__(self, d_model, d_ff, dropout=0.1): super().__init__() self.w_1 = nn.Linear(d_model, d_ff) self.norm = nn.Sequential() self.w_2 = nn.Linear(d_f...
MnistClassifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class MnistClassifier(nn.Module): def __init__(self, config): super(MnistClassifier, self).__init__() self.config = config self.h = self.config['image_h'] self.w = self.config['image_w'] 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DanielKalicki/homomorphic_mnist
MnistClassifier
false
3,493
[ "BSD-3-Clause" ]
0
954e9df2123527bfd266757f3b96897e405e5356
https://github.com/DanielKalicki/homomorphic_mnist/tree/954e9df2123527bfd266757f3b96897e405e5356
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Model(nn.Module): def __init__(self, config): super().__init__() self.config = config self.h = self.config['image_h'] self.w = self.config['image_w'] self.out_dim = self.config['class_nu...
MSBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class MSBlock(nn.Module): def __init__(self, c_in, rate=4): super(MSBlock, self).__init__() self.rate = rate self.conv = nn.Conv2d(c_in, 32, 3, stride=1, padding=1) self.relu = nn.ReLU(inplace=True) dilation = self.rate * 1 if self.rate >...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
farkoo/novel-seam-carving-method
MSBlock
false
3,494
[ "MIT" ]
0
aa3e9a4e3d5e13872eed412444e5be519542f7e5
https://github.com/farkoo/novel-seam-carving-method/tree/aa3e9a4e3d5e13872eed412444e5be519542f7e5
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, c_in, rate=4): super().__init__() self.rate = rate self.conv = nn.Conv2d(c_in, 32, 3, stride=1, padding=1) self.relu = nn.ReLU(inplace=True) dilation = self.rate * 1 if self.rate >= 1 else 1 ...
ChannelwiseAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class ChannelwiseAttention(nn.Module): def __init__(self, in_channels): super(ChannelwiseAttention, self).__init__() self.in_channels = in_channels self.linear_1 = nn.Linear(self.in_channels, self.in_channels // 4) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
farkoo/novel-seam-carving-method
ChannelwiseAttention
false
3,495
[ "MIT" ]
0
aa3e9a4e3d5e13872eed412444e5be519542f7e5
https://github.com/farkoo/novel-seam-carving-method/tree/aa3e9a4e3d5e13872eed412444e5be519542f7e5
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channels): super().__init__() self.in_channels = in_channels self.linear_1 = nn.Linear(self.in_channels, self.in_channels // 4) self.linear_2 = nn.Linear(self.in_channe...
DumbFeat
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.optim import torch.nn.parallel class DumbFeat(nn.Module): def __init__(self, opt): super(DumbFeat, self).__init__() dropout = opt['dropout'] if 'dropout' in opt else 0.0 self.dropout = torch.nn.D...
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 import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_stri...
Basasuya/FewShotWithoutForgetting
DumbFeat
false
3,496
[ "MIT" ]
0
eecc70e416ed82999124ddfca1b145f6dbcd74a6
https://github.com/Basasuya/FewShotWithoutForgetting/tree/eecc70e416ed82999124ddfca1b145f6dbcd74a6
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.optim import torch.nn.parallel class Model(nn.Module): def __init__(self, opt): super().__init__() dropout = opt['dropout'] if 'dropout' in opt else 0.0 self.dropout = torch.nn.Dropout(p=dropout,...
SubPixelConvolutionalBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class SubPixelConvolutionalBlock(nn.Module): """ A subpixel convolutional block, comprising convolutional, pixel-shuffle, and PReLU activation layers. """ def __init__(self, kernel_size=3, n_channels=64, scaling_factor=2): """ :param kernel_size: kern...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
f74066357/SR
SubPixelConvolutionalBlock
false
3,497
[ "MIT" ]
0
374ac141dfbfb4f851379d1c3c7c7f6bf1a21c67
https://github.com/f74066357/SR/tree/374ac141dfbfb4f851379d1c3c7c7f6bf1a21c67
import torch from torch import nn class Model(nn.Module): """ A subpixel convolutional block, comprising convolutional, pixel-shuffle, and PReLU activation layers. """ def __init__(self, kernel_size=3, n_channels=64, scaling_factor=2): """ :param kernel_size: kernel size of the convol...
Gaussianize
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Gaussianize(nn.Module): """ Gaussianization per RealNVP sec 3.6 / fig 4b -- at each step half the variables are directly modeled as Gaussians. Model as Gaussians: x2 = z2 * exp(logs) + mu, so x2 ~ N(mu, exp(logs)^2) where mu, logs = f(x1) then to recover th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ffraaz/flow_based_priors
Gaussianize
false
3,498
[ "MIT" ]
0
4f61ecc233a01375c9a069a8baf676152a3e20fa
https://github.com/ffraaz/flow_based_priors/tree/4f61ecc233a01375c9a069a8baf676152a3e20fa
import torch import torch.nn as nn class Model(nn.Module): """ Gaussianization per RealNVP sec 3.6 / fig 4b -- at each step half the variables are directly modeled as Gaussians. Model as Gaussians: x2 = z2 * exp(logs) + mu, so x2 ~ N(mu, exp(logs)^2) where mu, logs = f(x1) then to recover the rand...
SimpleAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class SimpleAttention(nn.Module): def __init__(self, input_dim): super(SimpleAttention, self).__init__() self.input_dim = input_dim self.scalar = nn.Linear(self.input_dim, 1, bias=False) def forward(self, M, x=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
filkar/CASTLE
SimpleAttention
false
3,499
[ "MIT" ]
0
128b316d24503875bcc298301c17b003e6d4599d
https://github.com/filkar/CASTLE/tree/128b316d24503875bcc298301c17b003e6d4599d
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim): super().__init__() self.input_dim = input_dim self.scalar = nn.Linear(self.input_dim, 1, bias=False) def forward(self, M, x=None): """ M -> (seq_l...
Net2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import as_tensor from torch import no_grad import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class AsModelNet(nn.Module): @staticmethod def chunk_it(xx): d = [] for x in xx: d.append(x) if len(d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
firemark/eye-detector
Net2
false
3,500
[ "MIT" ]
0
1efc4ccd0f0fc5d52e16b130d336eefd14324a02
https://github.com/firemark/eye-detector/tree/1efc4ccd0f0fc5d52e16b130d336eefd14324a02
import torch import numpy as np from torch import as_tensor from torch import no_grad import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class AsModelNet(nn.Module): @staticmethod def chunk_it(xx): d = [] for x in xx: d.append(x) if len(d...
Split
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Gaussianize(nn.Module): """ Gaussianization per RealNVP sec 3.6 / fig 4b -- at each step half the variables are directly modeled as Gaussians. Model as Gaussians: x2 = z2 * exp(logs) + mu, so x2 ~ N(mu, exp(logs)^2) where mu, logs = f(x1) then to recover th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ffraaz/flow_based_priors
Split
false
3,501
[ "MIT" ]
0
4f61ecc233a01375c9a069a8baf676152a3e20fa
https://github.com/ffraaz/flow_based_priors/tree/4f61ecc233a01375c9a069a8baf676152a3e20fa
import torch import torch.nn as nn class Gaussianize(nn.Module): """ Gaussianization per RealNVP sec 3.6 / fig 4b -- at each step half the variables are directly modeled as Gaussians. Model as Gaussians: x2 = z2 * exp(logs) + mu, so x2 ~ N(mu, exp(logs)^2) where mu, logs = f(x1) then to recover th...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
filkar/CASTLE
Attention
false
3,502
[ "MIT" ]
0
128b316d24503875bcc298301c17b003e6d4599d
https://github.com/filkar/CASTLE/tree/128b316d24503875bcc298301c17b003e6d4599d
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
BertSelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Adoni/pytorch-pretrained-BERT
BertSelfAttention
false
3,503
[ "Apache-2.0" ]
0
845c33f00e933626dcfc96e0923ecf034295ef75
https://github.com/Adoni/pytorch-pretrained-BERT/tree/845c33f00e933626dcfc96e0923ecf034295ef75
from _paritybench_helpers import _mock_config import math import torch from torch import nn class Model(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidden size (%d) is not a ...
ActionAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch as th import torch.nn as nn class ActionAttention(nn.Module): def __init__(self, model_dim, n_actions): super(ActionAttention, self).__init__() self.model_dim = model_dim self.n_actions = n_actions self.fcq = nn.Linear(model_dim, model_...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
footoredo/pymarl
ActionAttention
false
3,504
[ "Apache-2.0" ]
0
9c62dda7a7ed984e020f2cafab93601342305af2
https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2
import torch import numpy as np import torch as th import torch.nn as nn class Model(nn.Module): def __init__(self, model_dim, n_actions): super().__init__() self.model_dim = model_dim self.n_actions = n_actions self.fcq = nn.Linear(model_dim, model_dim * n_actions) self.f...
ActionAttentionV3
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F class ActionAttentionV3(nn.Module): def __init__(self, model_dim, n_actions): super(ActionAttentionV3, self).__init__() self.model_dim = model_dim self.n_actions = n_actions 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.triton_helpers import libdevice import torch.nn as ...
footoredo/pymarl
ActionAttentionV3
false
3,505
[ "Apache-2.0" ]
0
9c62dda7a7ed984e020f2cafab93601342305af2
https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, model_dim, n_actions): super().__init__() self.model_dim = model_dim self.n_actions = n_actions self.fcq = nn.Linear(model_dim, model...
Pointer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F def mask_logits(target, mask): mask = mask.type(torch.float32) return target * mask + (1 - mask) * -1e+30 class Initialized_Conv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, gro...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
dcy2018/QANA
Pointer
false
3,506
[ "MIT" ]
0
69d1e4ff408a56317479e22ecc854c91fc0f420f
https://github.com/dcy2018/QANA/tree/69d1e4ff408a56317479e22ecc854c91fc0f420f
import torch import torch.nn as nn import torch.nn.functional as F def mask_logits(target, mask): mask = mask.type(torch.float32) return target * mask + (1 - mask) * -1e+30 class Initialized_Conv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, gro...
AddSubNet
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data class AddSubNet(nn.Module): """ Simple AddSub network in PyTorch. This network outputs the sum and subtraction of the inputs. """ def __init__(self): super(AddSubNet, self).__init__() def forward(self, input0, input1): ...
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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
funny000/python_project
AddSubNet
false
3,507
[ "MIT" ]
0
190289765d0bdd908ce289c78969b3702a2c4292
https://github.com/funny000/python_project/tree/190289765d0bdd908ce289c78969b3702a2c4292
import torch from torch import nn import torch.utils.data class Model(nn.Module): """ Simple AddSub network in PyTorch. This network outputs the sum and subtraction of the inputs. """ def __init__(self): super().__init__() def forward(self, input0, input1): """ """ ...
ORPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ORPooling(nn.Module): def __init__(self, orientations): super(ORPooling, self).__init__() self.orientations = orientations def forward(self, x): B, C, H, W = x.shape assert C % self.orientations == 0 x = x.view(B, -1, self.orie...
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...
filick/torchcv
ORPooling
false
3,508
[ "MIT" ]
0
6e3f6780f00037e086c0ee48bf2b93a177a3b4bc
https://github.com/filick/torchcv/tree/6e3f6780f00037e086c0ee48bf2b93a177a3b4bc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, orientations): super().__init__() self.orientations = orientations def forward(self, x): B, C, H, W = x.shape assert C % self.orientations == 0 x = x.view(B, -1, self.orientations, H, W) ...
AdditiveAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class AdditiveAttention(nn.Module): def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim, internal_dim=None): super(AdditiveAttention, self).__init__() if internal_dim is None: internal_dim = i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
fireofearth/Trajectron-plus-plus
AdditiveAttention
false
3,509
[ "MIT" ]
0
b39df025b62a8ce466266936198baee9bfa14e89
https://github.com/fireofearth/Trajectron-plus-plus/tree/b39df025b62a8ce466266936198baee9bfa14e89
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim, internal_dim=None): super().__init__() if internal_dim is None: internal_dim = int((encoder_hidden_state_dim + ...
TemporallyBatchedAdditiveAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class AdditiveAttention(nn.Module): def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim, internal_dim=None): super(AdditiveAttention, self).__init__() if internal_dim is None: internal_dim = i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
fireofearth/Trajectron-plus-plus
TemporallyBatchedAdditiveAttention
false
3,510
[ "MIT" ]
0
b39df025b62a8ce466266936198baee9bfa14e89
https://github.com/fireofearth/Trajectron-plus-plus/tree/b39df025b62a8ce466266936198baee9bfa14e89
import torch import torch.nn as nn import torch.nn.functional as F class AdditiveAttention(nn.Module): def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim, internal_dim=None): super().__init__() if internal_dim is None: internal_dim = int((encoder_hidden_stat...
CoxPHLossSorted
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07 ) ->Tensor: """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import Tens...
gabrielasuchopar/pycox
CoxPHLossSorted
false
3,511
[ "BSD-2-Clause" ]
0
e4ea5f0ee26c6d3e3a468f164de2b7c426376e99
https://github.com/gabrielasuchopar/pycox/tree/e4ea5f0ee26c6d3e3a468f164de2b7c426376e99
import torch from torch import Tensor def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07 ) ->Tensor: """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where...
ActionAttentionV2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F class ActionAttentionV2(nn.Module): def __init__(self, model_dim, n_actions): super(ActionAttentionV2, self).__init__() self.model_dim = model_dim self.n_actions = n_actions 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....
footoredo/pymarl
ActionAttentionV2
false
3,512
[ "Apache-2.0" ]
0
9c62dda7a7ed984e020f2cafab93601342305af2
https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, model_dim, n_actions): super().__init__() self.model_dim = model_dim self.n_actions = n_actions self.fcq = nn.Linear(model_dim, model...
CoxPHLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07 ) ->Tensor: """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from ...
gabrielasuchopar/pycox
CoxPHLoss
false
3,513
[ "BSD-2-Clause" ]
0
e4ea5f0ee26c6d3e3a468f164de2b7c426376e99
https://github.com/gabrielasuchopar/pycox/tree/e4ea5f0ee26c6d3e3a468f164de2b7c426376e99
import torch from torch import Tensor def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07 ) ->Tensor: """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where...
ContrastiveLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from typing import * import torch.nn as nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin=2.0): super(ContrastiveLoss, 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from typing import * import ...
gaungalif/siamese.pytorch
ContrastiveLoss
false
3,514
[ "MIT" ]
0
2c06ef574147ea0b8b980943330eaeabe9892533
https://github.com/gaungalif/siamese.pytorch/tree/2c06ef574147ea0b8b980943330eaeabe9892533
import torch from typing import * import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin=2.0): super().__init__() self.ma...
Dave_norminit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class Dave_norminit(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 24, (5, 5), stride=(2, 2)) self.relu1 = nn.ReLU() self.conv2 = nn.Conv2d(24, 36, (5, 5), stride=(2, 2)) self.relu2 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fabriceyhc/diversity_attacks
Dave_norminit
false
3,515
[ "MIT" ]
0
69e948a5cdf6c6f9e895be5e2096a887bad99151
https://github.com/fabriceyhc/diversity_attacks/tree/69e948a5cdf6c6f9e895be5e2096a887bad99151
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 24, (5, 5), stride=(2, 2)) self.relu1 = nn.ReLU() self.conv2 = nn.Conv2d(24, 36, (5, 5), stride=(2, 2)) self.relu2 = nn.ReLU(...
Mix
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features 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.triton_helpers import libdevice import torch.nn as ...
gaopengcuhk/deit
Mix
false
3,516
[ "Apache-2.0" ]
0
de7db8f3a12c35e5e554b385030c574b7c78aaa6
https://github.com/gaopengcuhk/deit/tree/de7db8f3a12c35e5e554b385030c574b7c78aaa6
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features se...
CQAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F def mask_logits(target, mask): mask = mask.type(torch.float32) return target * mask + (1 - mask) * -1e+30 class CQAttention(nn.Module): def __init__(self, d_model, dropout=0.1): super().__init__() w4C = torch.empty(d_mod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
dcy2018/QANA
CQAttention
false
3,517
[ "MIT" ]
0
69d1e4ff408a56317479e22ecc854c91fc0f420f
https://github.com/dcy2018/QANA/tree/69d1e4ff408a56317479e22ecc854c91fc0f420f
import torch import torch.nn as nn import torch.nn.functional as F def mask_logits(target, mask): mask = mask.type(torch.float32) return target * mask + (1 - mask) * -1e+30 class Model(nn.Module): def __init__(self, d_model, dropout=0.1): super().__init__() w4C = torch.empty(d_model, 1)...
CMlp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CMlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features 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.triton_helpers import libdevice import torch.nn as ...
gaopengcuhk/deit
CMlp
false
3,518
[ "Apache-2.0" ]
0
de7db8f3a12c35e5e554b385030c574b7c78aaa6
https://github.com/gaopengcuhk/deit/tree/de7db8f3a12c35e5e554b385030c574b7c78aaa6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features ...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch import torch.nn.functional as F import torch.nn as nn class GraphConvolution(Module): """ A Graph Convolution Layer (GCN) """ def __init__(self, in_features, out_features, bias=True): super(GraphConvolution, self).__init__() self.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.nn import Module i...
duzhizhai/HGNN
GCN
false
3,519
[ "MIT" ]
0
1d219f9eb773e0d2f585295d6fc13c2eb093d908
https://github.com/duzhizhai/HGNN/tree/1d219f9eb773e0d2f585295d6fc13c2eb093d908
from torch.nn import Module import math import torch import torch.nn.functional as F import torch.nn as nn class GraphConvolution(Module): """ A Graph Convolution Layer (GCN) """ def __init__(self, in_features, out_features, bias=True): super().__init__() self.in_features = in_feature...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, model_dim, n_heads=1): super(Attention, self).__init__() self.model_dim = model_dim self.dim_per_head = model_dim // n_heads 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....
footoredo/pymarl
Attention
false
3,520
[ "Apache-2.0" ]
0
9c62dda7a7ed984e020f2cafab93601342305af2
https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, model_dim, n_heads=1): super().__init__() self.model_dim = model_dim self.dim_per_head = model_dim // n_heads self.n_heads = n_heads ...
MaskedMSELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class MaskedMSELoss(nn.Module): def __init__(self): super(MaskedMSELoss, self).__init__() self.loss = nn.MSELoss(reduction='sum') def forward(self, pred, target, mask): """ pred -> batch*seq_len target -> batch*seq_len mask -...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
filkar/CASTLE
MaskedMSELoss
false
3,521
[ "MIT" ]
0
128b316d24503875bcc298301c17b003e6d4599d
https://github.com/filkar/CASTLE/tree/128b316d24503875bcc298301c17b003e6d4599d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.loss = nn.MSELoss(reduction='sum') def forward(self, pred, target, mask): """ pred -> batch*seq_len target -> batch*seq_len mask -> batch*seq_len """...
Net16
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Net16(nn.Module): def __init__(self, input_dim, output_dim): super(Net16, self).__init__() self.linear1 = nn.Linear(input_dim, 16) self.linear2 = nn.Linear(16, output_dim) def forward(self, x): x = F.rel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gautam-sharma1/Imitation-Learning
Net16
false
3,522
[ "MIT" ]
0
20b6fcd2a8d6de8eb95e6831f5b379a083306361
https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 16) self.linear2 = nn.Linear(16, output_dim) def forward(self, x): x = F.relu(self.line...
LearnablePositionalEncoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class LearnablePositionalEncoding(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=1024): super(LearnablePositionalEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) self.pe = nn.Parameter(torch.empty(max_len, 1, d_model)) ...
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...
gaowanting/paper_code0
LearnablePositionalEncoding
false
3,523
[ "MIT" ]
0
15568fc9989b26df7c582b92163d2f262654712e
https://github.com/gaowanting/paper_code0/tree/15568fc9989b26df7c582b92163d2f262654712e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=1024): super().__init__() self.dropout = nn.Dropout(p=dropout) self.pe = nn.Parameter(torch.empty(max_len, 1, d_model)) nn.init.uniform_(self.pe, -0.02, 0.02) def forwa...
SBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features 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....
gaopengcuhk/deit
SBlock
false
3,524
[ "Apache-2.0" ]
0
de7db8f3a12c35e5e554b385030c574b7c78aaa6
https://github.com/gaopengcuhk/deit/tree/de7db8f3a12c35e5e554b385030c574b7c78aaa6
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features se...
PNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from collections import OrderedDict class PNet(nn.Module): def __init__(self): super().__init__() self.features = nn.Sequential(OrderedDict([('conv1', nn.Conv2d(3, 10, 3, 1)), ('prelu1', nn.PReLU(10)), ('pool1', nn.MaxPool2d(2, 2, ceil_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....
galbiati/mtcnn
PNet
false
3,525
[ "MIT" ]
0
6caa8e47ee6c7a01f6f990193129964a2d7e4b52
https://github.com/galbiati/mtcnn/tree/6caa8e47ee6c7a01f6f990193129964a2d7e4b52
import torch import torch.nn as nn from collections import OrderedDict class Model(nn.Module): def __init__(self): super().__init__() self.features = nn.Sequential(OrderedDict([('conv1', nn.Conv2d(3, 10, 3, 1)), ('prelu1', nn.PReLU(10)), ('pool1', nn.MaxPool2d(2, 2, ceil_...
FocusLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class FocusLayer(nn.Module): def __init__(self, c1, c2, k=1): super().__init__() def forward(self, x): return torch.cat([x[..., ::2], x[..., 1::2]], dim=1) 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...
gdevos010/Informer2020
FocusLayer
false
3,526
[ "Apache-2.0" ]
0
607a1981ff8b8009eda3570a1ea4c9617289c9f2
https://github.com/gdevos010/Informer2020/tree/607a1981ff8b8009eda3570a1ea4c9617289c9f2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, c1, c2, k=1): super().__init__() def forward(self, x): return torch.cat([x[..., ::2], x[..., 1::2]], dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [4, 4]
NNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class NNet(nn.Module): def __init__(self, input_dim, output_dim): super(NNet, self).__init__() self.linear1 = nn.Linear(input_dim, 64) self.linear2 = nn.Linear(64, 256) self.linear3 = nn.Linear(256, output_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 import torch.nn as nn assert_...
gautam-sharma1/Imitation-Learning
NNet
false
3,527
[ "MIT" ]
0
20b6fcd2a8d6de8eb95e6831f5b379a083306361
https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 64) self.linear2 = nn.Linear(64, 256) self.linear3 = nn.Linear(256, output_dim) def for...
Temp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Temp(nn.Module): def __init__(self, input_dim, output_dim): super(Temp, self).__init__() self.linear1 = nn.Linear(input_dim, 256) self.linear2 = nn.Linear(256, 256) self.linear3 = nn.Linear(256, 256) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
gautam-sharma1/Imitation-Learning
Temp
false
3,528
[ "MIT" ]
0
20b6fcd2a8d6de8eb95e6831f5b379a083306361
https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 256) self.linear2 = nn.Linear(256, 256) self.linear3 = nn.Linear(256, 256) self.line...
Netleaky
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Netleaky(nn.Module): def __init__(self, input_dim, output_dim): super(Netleaky, self).__init__() self.linear1 = nn.Linear(input_dim, 32) self.linear2 = nn.Linear(32, 32) self.linear3 = nn.Linear(32, 64) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gautam-sharma1/Imitation-Learning
Netleaky
false
3,529
[ "MIT" ]
0
20b6fcd2a8d6de8eb95e6831f5b379a083306361
https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 32) self.linear2 = nn.Linear(32, 32) self.linear3 = nn.Linear(32, 64) self.linear4 =...
HardSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F class HardSigmoid(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
gentlebreeze1/dbnet
HardSigmoid
false
3,530
[ "Apache-2.0" ]
0
be28a7ae835af7d6f8b7c2b636b875adc9fc187c
https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold(-x, -...
ActorNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch.nn import Linear import torch.nn.functional as F class ActorNet(Module): def __init__(self, hidden_size, num_programs): super(ActorNet, self).__init__() self.l1 = Linear(hidden_size, hidden_size // 2) self.l2 = Linear(hidden_size // 2, n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
geektoni/AlphaNPI
ActorNet
false
3,531
[ "MIT" ]
0
ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
from torch.nn import Module import torch from torch.nn import Linear import torch.nn.functional as F class Model(Module): def __init__(self, hidden_size, num_programs): super().__init__() self.l1 = Linear(hidden_size, hidden_size // 2) self.l2 = Linear(hidden_size // 2, num_programs) ...
ListEnvEncoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class ListEnvEncoder(nn.Module): """ Implement an encoder (f_enc) specific to the List environment. It encodes observations e_t into vectors s_t of size D = encoding_dim. """ def __init__(self, observation_dim, encoding_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....
geektoni/AlphaNPI
ListEnvEncoder
false
3,532
[ "MIT" ]
0
ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ Implement an encoder (f_enc) specific to the List environment. It encodes observations e_t into vectors s_t of size D = encoding_dim. """ def __init__(self, observation_dim, encoding_dim): super...
MaskL1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class MaskL1Loss(nn.Module): def __init__(self, eps=1e-06): super(MaskL1Loss, self).__init__() self.eps = eps def forward(self, pred: 'torch.Tensor', gt, mask): loss = (torch.abs(pred - gt) * mask).sum() / (mask.sum() + self.eps) return loss ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
gentlebreeze1/dbnet
MaskL1Loss
false
3,533
[ "Apache-2.0" ]
0
be28a7ae835af7d6f8b7c2b636b875adc9fc187c
https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c
import torch from torch import nn class Model(nn.Module): def __init__(self, eps=1e-06): super().__init__() self.eps = eps def forward(self, pred: 'torch.Tensor', gt, mask): loss = (torch.abs(pred - gt) * mask).sum() / (mask.sum() + self.eps) return loss def get_inputs(): ...
CriticNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch.nn import Linear import torch.nn.functional as F class CriticNet(Module): def __init__(self, hidden_size): super(CriticNet, self).__init__() self.l1 = Linear(hidden_size, hidden_size // 2) self.l2 = Linear(hidden_size // 2, 1) def 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....
geektoni/AlphaNPI
CriticNet
false
3,534
[ "MIT" ]
0
ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
from torch.nn import Module import torch from torch.nn import Linear import torch.nn.functional as F class Model(Module): def __init__(self, hidden_size): super().__init__() self.l1 = Linear(hidden_size, hidden_size // 2) self.l2 = Linear(hidden_size // 2, 1) def forward(self, hidden...
HanoiEnvEncoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class HanoiEnvEncoder(nn.Module): """ Implement an encoder (f_enc) specific to the List environment. It encodes observations e_t into vectors s_t of size D = encoding_dim. """ def __init__(self, observation_dim, encoding_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 import torch.nn as nn assert_...
geektoni/AlphaNPI
HanoiEnvEncoder
false
3,535
[ "MIT" ]
0
ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ Implement an encoder (f_enc) specific to the List environment. It encodes observations e_t into vectors s_t of size D = encoding_dim. """ def __init__(self, observation_dim, encoding_dim): super...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
felixyu7/perceiver-io-1
MultiHeadAttention
false
3,536
[ "Apache-2.0" ]
0
895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e
https://github.com/felixyu7/perceiver-io-1/tree/895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_heads, kdim=num_k...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class DiceLoss(nn.Module): """ Loss function from https://arxiv.org/abs/1707.03237, where iou computation is introduced heatmap manner to measure the diversity bwtween tow heatmaps. """ def __init__(self, eps=1e-06): super(DiceLoss, self).__init__() ...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
gentlebreeze1/dbnet
DiceLoss
false
3,537
[ "Apache-2.0" ]
0
be28a7ae835af7d6f8b7c2b636b875adc9fc187c
https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c
import torch from torch import nn class Model(nn.Module): """ Loss function from https://arxiv.org/abs/1707.03237, where iou computation is introduced heatmap manner to measure the diversity bwtween tow heatmaps. """ def __init__(self, eps=1e-06): super().__init__() self.eps =...
SEBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class HardSigmoid(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
gentlebreeze1/dbnet
SEBlock
false
3,538
[ "Apache-2.0" ]
0
be28a7ae835af7d6f8b7c2b636b875adc9fc187c
https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c
import torch from torch import nn import torch.nn.functional as F class HardSigmoid(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold...
L1Linear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import warnings from torch import Tensor from torch.nn.parameter import Parameter from torch.nn import functional as F from torch.nn import init class L1Linear(torch.nn.Module): def __init__(self, l1: 'float', in_features: 'int', out_features: 'int', bias: 'bool'=True, init_zero=...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 warnings from torch.nn.parameter import Parameter from torch....
fabian-sp/regular-layers
L1Linear
false
3,539
[ "BSD-3-Clause" ]
0
573b652d1e66c4e44cc740dcc8dc618669af5c96
https://github.com/fabian-sp/regular-layers/tree/573b652d1e66c4e44cc740dcc8dc618669af5c96
import math import torch import warnings from torch import Tensor from torch.nn.parameter import Parameter from torch.nn import functional as F from torch.nn import init class Model(torch.nn.Module): def __init__(self, l1: 'float', in_features: 'int', out_features: 'int', bias: 'bool'=True, init_zero=Fal...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
felixyu7/perceiver-io-1
SelfAttention
false
3,540
[ "Apache-2.0" ]
0
895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e
https://github.com/felixyu7/perceiver-io-1/tree/895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
CrossAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
felixyu7/perceiver-io-1
CrossAttention
false
3,541
[ "Apache-2.0" ]
0
895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e
https://github.com/felixyu7/perceiver-io-1/tree/895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
ReflectionPad3d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class ReflectionPad3d(nn.Module): def __init__(self, padding): super(ReflectionPad3d, self).__init__() self.padding = padding if isinstance(padding, int): self.padding = (padding,) * 6 def forward(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 import torch.utils.data import torch import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
giuliabaldini/Pix2PixNIfTI
ReflectionPad3d
false
3,542
[ "BSD-3-Clause" ]
0
59ff825760f682d2734bd5e95503a03f80d32414
https://github.com/giuliabaldini/Pix2PixNIfTI/tree/59ff825760f682d2734bd5e95503a03f80d32414
import torch import torch.utils.data import torch import torch.nn as nn class Model(nn.Module): def __init__(self, padding): super().__init__() self.padding = padding if isinstance(padding, int): self.padding = (padding,) * 6 def forward(self, input): """ ...
CNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils class CNN(nn.Module): """ Convolutional layer of a character-based convolutional encoder that outputs word embeddings. """ def __init__(self, char_embed_size: 'int', word_embed_size: 'int', kernel_size: '...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
giwankim/cs224n
CNN
false
3,543
[ "MIT" ]
0
d05d018dd3026aa48810260be50c94cda596dc82
https://github.com/giwankim/cs224n/tree/d05d018dd3026aa48810260be50c94cda596dc82
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils class Model(nn.Module): """ Convolutional layer of a character-based convolutional encoder that outputs word embeddings. """ def __init__(self, char_embed_size: 'int', word_embed_size: 'int', kernel_size:...
LinearAdditiveUpsample
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class LinearAdditiveUpsample(nn.Module): """Bi/Trilinear Additive Upsample Upsampling strategy described in Wojna et al (https://doi.org/10.1007/s11263-019-01170-8) to avoid checkerboard patterns while keeping a better performance fo...
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 import torch.nn as nn assert_size_stride = torch._C....
giuliabaldini/Pix2PixNIfTI
LinearAdditiveUpsample
false
3,544
[ "BSD-3-Clause" ]
0
59ff825760f682d2734bd5e95503a03f80d32414
https://github.com/giuliabaldini/Pix2PixNIfTI/tree/59ff825760f682d2734bd5e95503a03f80d32414
import torch import torch.utils.data import torch import torch.nn as nn class Model(nn.Module): """Bi/Trilinear Additive Upsample Upsampling strategy described in Wojna et al (https://doi.org/10.1007/s11263-019-01170-8) to avoid checkerboard patterns while keeping a better performance for the convolution...
Entmax15
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.autograd import Function import torch from torch import nn def _make_ix_like(X, dim): d = X.size(dim) rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype) view = [1] * X.dim() view[0] = -1 return rho.view(view).transpose(0, dim) def _roll_last(X, dim): if dim == -1: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.autograd import F...
gitlost-murali/awesome-align
Entmax15
false
3,545
[ "BSD-3-Clause" ]
0
39fb45ca85a98e005447bddb52c48e65ce7d399b
https://github.com/gitlost-murali/awesome-align/tree/39fb45ca85a98e005447bddb52c48e65ce7d399b
from torch.autograd import Function import torch from torch import nn def _make_ix_like(X, dim): d = X.size(dim) rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype) view = [1] * X.dim() view[0] = -1 return rho.view(view).transpose(0, dim) def _roll_last(X, dim): if dim == -1: ...
DoubleSwish
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor class DoubleSwishFunction(torch.autograd.Function): """ double_swish(x) = x * torch.sigmoid(x-1) This is a definition, originally motivated by its close numerical similarity to swish(swish(x)), where swish(x) = x * sigmoid(x). Memory-efficient derivative c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import Tensor assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty...
glynpu/icefall
DoubleSwish
false
3,546
[ "Apache-2.0" ]
0
d766dc5aeea1a8aefab033e581948b07c4ac4bc0
https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0
import torch from torch import Tensor class DoubleSwishFunction(torch.autograd.Function): """ double_swish(x) = x * torch.sigmoid(x-1) This is a definition, originally motivated by its close numerical similarity to swish(swish(x)), where swish(x) = x * sigmoid(x). Memory-efficient derivative c...
UpConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torchvision.transforms.functional as TF class UpConv(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.tconv = nn.ConvTranspose2d(in_channels=in_channels, out_channels=out_channels, kernel_size=2, stride=2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gandhisamay/Drone-Cam-Segmentation
UpConv
false
3,547
[ "MIT" ]
0
7e93b6bb65300aea94dd5e35bb8ca3bd1efbe043
https://github.com/gandhisamay/Drone-Cam-Segmentation/tree/7e93b6bb65300aea94dd5e35bb8ca3bd1efbe043
import torch import torch.nn as nn import torchvision.transforms.functional as TF class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.tconv = nn.ConvTranspose2d(in_channels=in_channels, out_channels=out_channels, kernel_size=2, stride=2) ...
BertPSIHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch from torch import nn class BertPSIHead(nn.Module): def __init__(self, config): super().__init__() self.transform = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() self.decoder = nn.Linear(conf...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
gitlost-murali/awesome-align
BertPSIHead
false
3,548
[ "BSD-3-Clause" ]
0
39fb45ca85a98e005447bddb52c48e65ce7d399b
https://github.com/gitlost-murali/awesome-align/tree/39fb45ca85a98e005447bddb52c48e65ce7d399b
from _paritybench_helpers import _mock_config import torch from torch import nn class Model(nn.Module): def __init__(self, config): super().__init__() self.transform = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() self.decoder = nn.Linear(config.hid...
MultConst
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class MultConst(nn.Module): def forward(self, input): return 255 * input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
globz-eu/PyTorch-Multi-Style-Transfer
MultConst
false
3,549
[ "MIT" ]
0
d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2
https://github.com/globz-eu/PyTorch-Multi-Style-Transfer/tree/d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): return 255 * input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Vgg16
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn from torch.nn import * class Vgg16(nn.Module): def __init__(self): super(Vgg16, self).__init__() self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, 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 from torch import nn from tor...
entc17-fyp-27/GCL
Vgg16
false
3,550
[ "MIT" ]
0
df3964b1ea07a5b825e35720377153f3c143f79b
https://github.com/entc17-fyp-27/GCL/tree/df3964b1ea07a5b825e35720377153f3c143f79b
import torch import torch.nn.functional as F from torch import nn from torch.nn import * class Model(nn.Module): def __init__(self): super().__init__() self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1) ...
GramMatrix
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, y): b, ch, h, w = y.size() features = y.view(b, ch, w * h) features_t = features.transpose(1, 2) gram = features.bmm(features_t) / (ch * h * w) return gram def get_inputs(): return [tor...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
globz-eu/PyTorch-Multi-Style-Transfer
GramMatrix
false
3,551
[ "MIT" ]
0
d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2
https://github.com/globz-eu/PyTorch-Multi-Style-Transfer/tree/d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2
import torch import torch.nn as nn class Model(nn.Module): def forward(self, y): b, ch, h, w = y.size() features = y.view(b, ch, w * h) features_t = features.transpose(1, 2) gram = features.bmm(features_t) / (ch * h * w) return gram def get_inputs(): return [torch.ra...
ScaledConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn class ScaledConv2d(nn.Conv2d): def __init__(self, *args, initial_scale: float=1.0, initial_speed: float=1.0, **kwargs): super(ScaledConv2d, self).__init__(*args, **kwargs) initial_scale = torch.tensor(initial_scale).log() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
glynpu/icefall
ScaledConv2d
false
3,552
[ "Apache-2.0" ]
0
d766dc5aeea1a8aefab033e581948b07c4ac4bc0
https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0
import torch from torch import Tensor from torch import nn class Model(nn.Conv2d): def __init__(self, *args, initial_scale: float=1.0, initial_speed: float=1.0, **kwargs): super().__init__(*args, **kwargs) initial_scale = torch.tensor(initial_scale).log() self.weight_scale = nn.Pa...
BasicNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn class BasicNorm(torch.nn.Module): """ This is intended to be a simpler, and hopefully cheaper, replacement for LayerNorm. The observation this is based on, is that Transformer-type networks, especially with pre-norm, sometimes seem to set one...
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 import nn assert_size_stride = torch._C._dynamo.gua...
glynpu/icefall
BasicNorm
false
3,553
[ "Apache-2.0" ]
0
d766dc5aeea1a8aefab033e581948b07c4ac4bc0
https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0
import torch from torch import Tensor from torch import nn class Model(torch.nn.Module): """ This is intended to be a simpler, and hopefully cheaper, replacement for LayerNorm. The observation this is based on, is that Transformer-type networks, especially with pre-norm, sometimes seem to set one of ...
Sparsemax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.autograd import Function import torch from torch import nn def _make_ix_like(X, dim): d = X.size(dim) rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype) view = [1] * X.dim() view[0] = -1 return rho.view(view).transpose(0, dim) def _roll_last(X, dim): if dim == -1: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.autograd import Function from torch import nn assert_size_stride = torch._C._d...
gitlost-murali/awesome-align
Sparsemax
false
3,554
[ "BSD-3-Clause" ]
0
39fb45ca85a98e005447bddb52c48e65ce7d399b
https://github.com/gitlost-murali/awesome-align/tree/39fb45ca85a98e005447bddb52c48e65ce7d399b
from torch.autograd import Function import torch from torch import nn def _make_ix_like(X, dim): d = X.size(dim) rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype) view = [1] * X.dim() view[0] = -1 return rho.view(view).transpose(0, dim) def _roll_last(X, dim): if dim == -1: ...
ScaledLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn class ScaledLinear(nn.Linear): """ A modified version of nn.Linear where the parameters are scaled before use, via: weight = self.weight * self.weight_scale.exp() bias = self.bias * self.bias_scale.exp() Args: Accept...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
glynpu/icefall
ScaledLinear
false
3,555
[ "Apache-2.0" ]
0
d766dc5aeea1a8aefab033e581948b07c4ac4bc0
https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0
import torch from torch import Tensor from torch import nn class Model(nn.Linear): """ A modified version of nn.Linear where the parameters are scaled before use, via: weight = self.weight * self.weight_scale.exp() bias = self.bias * self.bias_scale.exp() Args: Accepts the s...
BPR
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class BPR(nn.Module): def __init__(self, user_size, item_size, dim, weight_decay): super().__init__() self.W = nn.Parameter(torch.empty(user_size, dim)) self.H = nn.Parameter(torch.empty(item_size, dim)) nn.init.xa...
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...
georgezzzh/bpr
BPR
false
3,556
[ "MIT" ]
0
dd2f39d99f7f06ebb305b66363c89c3606a811a1
https://github.com/georgezzzh/bpr/tree/dd2f39d99f7f06ebb305b66363c89c3606a811a1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, user_size, item_size, dim, weight_decay): super().__init__() self.W = nn.Parameter(torch.empty(user_size, dim)) self.H = nn.Parameter(torch.empty(item_size, dim)) nn.init....
RegressionModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=5, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReL...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
glhr/swig
RegressionModel
false
3,557
[ "MIT" ]
0
d6465862ae9adaab6594f79ec8eed211b5d7e4d8
https://github.com/glhr/swig/tree/d6465862ae9adaab6594f79ec8eed211b5d7e4d8
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features_in, num_anchors=5, feature_size=256): super().__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReLU() self.conv2 = nn.Con...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class LayerNorm(nn.Module): """ Layer Normalization (https://arxiv.org/abs/1607.06450) """ def __init__(self, normalized_shape, eps=1e-05): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(normalized_shape)) self.bet...
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_...
hamishivi/claf
LayerNorm
false
3,558
[ "MIT" ]
0
8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2
https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2
import torch import torch.nn as nn class Model(nn.Module): """ Layer Normalization (https://arxiv.org/abs/1607.06450) """ def __init__(self, normalized_shape, eps=1e-05): super().__init__() self.gamma = nn.Parameter(torch.ones(normalized_shape)) self.beta = nn.Parameter(to...
Network
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed import torch class Network(nn.Module): def __init__(self, num_classes): super(Network, self).__init__() self.conv1 = nn.Conv2d(1, 32, kernel_size=3) self.conv2 = nn.Conv2d(32, 64, kernel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gregmbi/polyaxon
Network
false
3,559
[ "Apache-2.0" ]
0
8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d
https://github.com/gregmbi/polyaxon/tree/8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed import torch class Model(nn.Module): def __init__(self, num_classes): super().__init__() self.conv1 = nn.Conv2d(1, 32, kernel_size=3) self.conv2 = nn.Conv2d(32, 64, kernel_size=3) ...
CNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CNN(nn.Module): """CNN class - defines model and forward operations""" def __init__(self): super(CNN, self).__init__() self.relu = nn.ReLU() self.pooling = nn.MaxPool2d(kernel_size=2) self.conv1 = nn.Conv2d(in_channels=1, out_channels=8...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gnzeleven/Hand-Written-Digits-Recognition-Web-App
CNN
false
3,560
[ "Apache-2.0" ]
0
b2c654f8b897273323a4930e3064b843b45cd5c6
https://github.com/gnzeleven/Hand-Written-Digits-Recognition-Web-App/tree/b2c654f8b897273323a4930e3064b843b45cd5c6
import torch import torch.nn as nn class Model(nn.Module): """CNN class - defines model and forward operations""" def __init__(self): super().__init__() self.relu = nn.ReLU() self.pooling = nn.MaxPool2d(kernel_size=2) self.conv1 = nn.Conv2d(in_channels=1, out_channels=8, kerne...
SeqAttnMatch
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class SeqAttnMatch(nn.Module): """ Given sequences X and Y, match sequence Y to each element in X. * o_i = sum(alpha_j * y_j) for i in X * alpha_j = softmax(y_j * x_i) """ def __init__(self, embed_dim, identity=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
hamishivi/claf
SeqAttnMatch
false
3,561
[ "MIT" ]
0
8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2
https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """ Given sequences X and Y, match sequence Y to each element in X. * o_i = sum(alpha_j * y_j) for i in X * alpha_j = softmax(y_j * x_i) """ def __init__(self, embed_dim, identity=False): s...
OutputGenerator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class OutputGenerator(nn.Module): def __init__(self, model_dim, tgt_vocab_size): super().__init__() self.tgt_vocab_size = tgt_vocab_size self.linear = nn.Linear(model_dim, tgt_vocab_size, bias=False) self.log_softmax = nn.LogSoftmax(dim=-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 from torch._inductor.runtime....
guyjacoby/original-transformer-pytorch
OutputGenerator
false
3,562
[ "MIT" ]
0
19e9ab4af3f0ee1ca81f6436eb18c36382bfbc1d
https://github.com/guyjacoby/original-transformer-pytorch/tree/19e9ab4af3f0ee1ca81f6436eb18c36382bfbc1d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, model_dim, tgt_vocab_size): super().__init__() self.tgt_vocab_size = tgt_vocab_size self.linear = nn.Linear(model_dim, tgt_vocab_size, bias=False) self.log_softmax = nn.LogSoftmax(dim=-1) def forwar...
PositionwiseFeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class PointwiseConv(nn.Module): """ Pointwise Convolution (1x1 Conv) Convolution 1 Dimension (Faster version) (cf. https://github.com/huggingface/pytorch-openai-transformer-lm/blob/ eafc28abdfadfa0732f03a0fc65805c5bfb2ffe7...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
hamishivi/claf
PositionwiseFeedForward
false
3,563
[ "MIT" ]
0
8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2
https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2
import torch import torch.nn as nn from torch.nn import functional as F class PointwiseConv(nn.Module): """ Pointwise Convolution (1x1 Conv) Convolution 1 Dimension (Faster version) (cf. https://github.com/huggingface/pytorch-openai-transformer-lm/blob/ eafc28abdfadfa0732f03a0fc65805c5bfb2ffe7...
UNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class UNet(nn.Module): def __init__(self): super().__init__() self.lrelu = nn.LeakyReLU(0.2) self.maxpool = nn.MaxPool2d(2) self.conv1_0 = nn.Conv2d(3, 32, 3, padding=1) self.conv1_1 = nn.Conv2d(32, 32, 3, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
frankgu968/learning-to-see-in-the-dark-pytorch
UNet
false
3,564
[ "MIT" ]
0
6a59fc64d1f152a2410b9128a6a51687a9b179d1
https://github.com/frankgu968/learning-to-see-in-the-dark-pytorch/tree/6a59fc64d1f152a2410b9128a6a51687a9b179d1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.lrelu = nn.LeakyReLU(0.2) self.maxpool = nn.MaxPool2d(2) self.conv1_0 = nn.Conv2d(3, 32, 3, padding=1) self.conv1_1 = nn.Conv2d(32, 32, 3,...
decoder3
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class decoder3(nn.Module): def __init__(self): super(decoder3, self).__init__() self.reflecPad7 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv7 = nn.Conv2d(256, 128, 3, 1, 0) self.relu7 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingNea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
guswl8033/ARtists
decoder3
false
3,565
[ "Apache-2.0" ]
0
d353195872c1ef1a1aa68659a32fb47779a416fc
https://github.com/guswl8033/ARtists/tree/d353195872c1ef1a1aa68659a32fb47779a416fc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.reflecPad7 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv7 = nn.Conv2d(256, 128, 3, 1, 0) self.relu7 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingNearest2d(scale_fact...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, embed_size, heads): super(SelfAttention, self).__init__() self.embed_size = embed_size self.heads = heads self.head_dim = embed_size // heads assert self.head_dim * self.heads == self.emb...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
h851206/NLP
SelfAttention
false
3,566
[ "MIT" ]
0
f6dd78db78536f203cf9a6748075351df9daeba3
https://github.com/h851206/NLP/tree/f6dd78db78536f203cf9a6748075351df9daeba3
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, embed_size, heads): super().__init__() self.embed_size = embed_size self.heads = heads self.head_dim = embed_size // heads assert self.head_dim * self.heads == self.embed_size, 'Embed size need t...
Gate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Gate(nn.Module): """Gate Unit g = sigmoid(Wx) x = g * x """ def __init__(self, input_size): super(Gate, self).__init__() self.linear = nn.Linear(input_size, input_size, bias=False) def forward(self, x): "...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
hansd410/mnemonic
Gate
false
3,567
[ "BSD-3-Clause" ]
0
409508d08da7f5d5940ffb56fd9715e6ef1e68a3
https://github.com/hansd410/mnemonic/tree/409508d08da7f5d5940ffb56fd9715e6ef1e68a3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Gate Unit g = sigmoid(Wx) x = g * x """ def __init__(self, input_size): super().__init__() self.linear = nn.Linear(input_size, input_size, bias=False) def forward(self, x): """ Args...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, observations_dim, actions_dim, hidden_dim=500): super(Net, self).__init__() self._input_layer = nn.Linear(observations_dim, hidden_dim) self._hidden1 = nn.Linear(hidden_dim, hidden_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
hany606/PMLDL-Project
Net
false
3,568
[ "MIT" ]
0
40ccf97720c8fd28ed2a8d8101a0499ff58c2b38
https://github.com/hany606/PMLDL-Project/tree/40ccf97720c8fd28ed2a8d8101a0499ff58c2b38
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, observations_dim, actions_dim, hidden_dim=500): super().__init__() self._input_layer = nn.Linear(observations_dim, hidden_dim) self._hidden1 = nn.Linear(hidden_dim, hidden_dim) ...
CAM_Module
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CAM_Module(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super(CAM_Module, self).__init__() self.chanel_in = in_dim self.gamma = nn.Parameter(torch.zeros(1)) self.softmax = nn.Softmax(dim=-1) def forward(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....
hanhanminnan/Trans-on-BME
CAM_Module
false
3,569
[ "Apache-2.0" ]
0
f4e27c946a30d11a9e9d2bee8f199fd06fe4bef2
https://github.com/hanhanminnan/Trans-on-BME/tree/f4e27c946a30d11a9e9d2bee8f199fd06fe4bef2
import torch import torch.nn as nn class Model(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super().__init__() self.chanel_in = in_dim self.gamma = nn.Parameter(torch.zeros(1)) self.softmax = nn.Softmax(dim=-1) def forward(self, x): """ ...
encoder3
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class encoder3(nn.Module): def __init__(self): super(encoder3, self).__init__() self.conv1 = nn.Conv2d(3, 3, 1, 1, 0) self.reflecPad1 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv2 = nn.Conv2d(3, 64, 3, 1, 0) self.relu2 = nn.ReLU(inplace=T...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
guswl8033/ARtists
encoder3
false
3,570
[ "Apache-2.0" ]
0
d353195872c1ef1a1aa68659a32fb47779a416fc
https://github.com/guswl8033/ARtists/tree/d353195872c1ef1a1aa68659a32fb47779a416fc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 3, 1, 1, 0) self.reflecPad1 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv2 = nn.Conv2d(3, 64, 3, 1, 0) self.relu2 = nn.ReLU(inplace=True) self...
Policy
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn def orthog_layer_init(layer, std=np.sqrt(2), bias_const=0.0): torch.nn.init.orthogonal_(layer.weight, std) torch.nn.init.constant_(layer.bias, bias_const) return layer class Policy(nn.Module): def __init__(self, num_inputs, num_outputs): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
gebob19/natural-policy-gradient-reinforcement-learning
Policy
false
3,571
[ "MIT" ]
0
23faa28d746521d6291034bc87d750c665934ff7
https://github.com/gebob19/natural-policy-gradient-reinforcement-learning/tree/23faa28d746521d6291034bc87d750c665934ff7
import torch import numpy as np import torch.nn as nn def orthog_layer_init(layer, std=np.sqrt(2), bias_const=0.0): torch.nn.init.orthogonal_(layer.weight, std) torch.nn.init.constant_(layer.bias, bias_const) return layer class Model(nn.Module): def __init__(self, num_inputs, num_outputs): ...
ActorNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class ActorNetwork(nn.Module): def __init__(self, obs_dim, hidden_size=256): super(ActorNetwork, self).__init__() self._obs_dim = obs_dim self._l1 = nn.Linear(obs_dim, hidden_size) self._l2 = nn.Linear(hidden_size,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
harwiltz/sac
ActorNetwork
false
3,572
[ "MIT" ]
0
076e01e63d8933665fbf4038513f163bbfd62800
https://github.com/harwiltz/sac/tree/076e01e63d8933665fbf4038513f163bbfd62800
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, obs_dim, hidden_size=256): super().__init__() self._obs_dim = obs_dim self._l1 = nn.Linear(obs_dim, hidden_size) self._l2 = nn.Linear(hidden_size, hidden_size) sel...
LogisticRegressionModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class LogisticRegressionModel(nn.Module): def __init__(self, input_dim, output_dim): super(LogisticRegressionModel, self).__init__() self.linear1 = nn.Linear(input_dim, 1500) self.linear2 = nn.Linear(1500, 1000) self.linear3 = nn.Linear(1000, out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
harimaruthachalam/PyTorchNNs
LogisticRegressionModel
false
3,573
[ "MIT" ]
0
94fe173204e18fbe5087643e3da1cd9cdd6bd2ef
https://github.com/harimaruthachalam/PyTorchNNs/tree/94fe173204e18fbe5087643e3da1cd9cdd6bd2ef
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 1500) self.linear2 = nn.Linear(1500, 1000) self.linear3 = nn.Linear(1000, output_dim) self.sigmoid = nn.Sigmoid() ...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class ConvRelu(nn.Module): def __init__(self, in_: 'int', out: 'int', activate=True): super(ConvRelu, self).__init__() self.activate = activate self.conv = nn.Conv2d(in_, out, 3, padding=1) self.activation = nn.ReLU(inplace=True) def forward(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
haonguyen1107/style_transfer
ResidualBlock
false
3,574
[ "MIT" ]
0
8df9b20ce8ebc446cf2c0a67393001b3cf318fed
https://github.com/haonguyen1107/style_transfer/tree/8df9b20ce8ebc446cf2c0a67393001b3cf318fed
import torch from torch import nn class ConvRelu(nn.Module): def __init__(self, in_: 'int', out: 'int', activate=True): super().__init__() self.activate = activate self.conv = nn.Conv2d(in_, out, 3, padding=1) self.activation = nn.ReLU(inplace=True) def forward(self, x): ...
SQNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class Fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand_planes): super(Fire, self).__init__() self.conv1 = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1, stride=1) self.relu1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
dcrmg/Efficient-Segmentation-Networks
SQNet
false
3,575
[ "MIT" ]
0
e2f2d90d69e4e9af464678b0f02bc754c28f643d
https://github.com/dcrmg/Efficient-Segmentation-Networks/tree/e2f2d90d69e4e9af464678b0f02bc754c28f643d
import math import torch import torch.nn as nn import torch.nn.functional as F class Fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand_planes): super().__init__() self.conv1 = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1, stride=1) self.relu1 = nn.ELU(i...
LinearFeedforward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class Linear(nn.Linear): def forward(self, x): size = x.size() return super().forward(x.contiguous().view(-1, size[-1])).view(* size[:-1], -1) class Feedforward(nn.Module): def __init__(self, d_in, d_out, activation=Non...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
harmdevries89/genienlp
LinearFeedforward
false
3,576
[ "BSD-3-Clause" ]
0
adf163c63a43adaddecb4b3645635f6ba92772f2
https://github.com/harmdevries89/genienlp/tree/adf163c63a43adaddecb4b3645635f6ba92772f2
import torch import torch.nn as nn import torch.utils.data class Linear(nn.Linear): def forward(self, x): size = x.size() return super().forward(x.contiguous().view(-1, size[-1])).view(* size[:-1], -1) class Feedforward(nn.Module): def __init__(self, d_in, d_out, activation=Non...
SFU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class SFU(nn.Module): """Semantic Fusion Unit The ouput vector is expected to not only retrieve correlative information from fusion vectors, but also retain partly unchange as the input vector """ def __init__(self, input_size, fusion_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
hansd410/mnemonic
SFU
false
3,577
[ "BSD-3-Clause" ]
0
409508d08da7f5d5940ffb56fd9715e6ef1e68a3
https://github.com/hansd410/mnemonic/tree/409508d08da7f5d5940ffb56fd9715e6ef1e68a3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Semantic Fusion Unit The ouput vector is expected to not only retrieve correlative information from fusion vectors, but also retain partly unchange as the input vector """ def __init__(self, input_size, fusion_si...