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
Conv2dSamePadding
# 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 def conv2d_same_padding(input, weight, bias=None, stride=1, dilation=1, groups=1): input_rows = input.size(2) filter_rows = weight.size(2) effective_filter_size_rows = (filter_rows - 1) * dilation[0] + 1 out_rows = (input_rows + str...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.nn.functional as F assert_size_stride = torch....
hulaba/pycrop-yield-prediction
Conv2dSamePadding
false
6,830
[ "MIT" ]
1
b4790dc2f87a73e8a0604e8c22466314090c5abf
https://github.com/hulaba/pycrop-yield-prediction/tree/b4790dc2f87a73e8a0604e8c22466314090c5abf
import torch from torch import nn import torch.nn.functional as F def conv2d_same_padding(input, weight, bias=None, stride=1, dilation=1, groups=1): input_rows = input.size(2) filter_rows = weight.size(2) effective_filter_size_rows = (filter_rows - 1) * dilation[0] + 1 out_rows = (input_rows + str...
GCNModelVAE
# 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 import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.parameter import Parameter import torch.nn.modules.loss class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
hurraygong/scGNN
GCNModelVAE
false
6,831
[ "MIT" ]
1
bc555895fbd5740ddd82e03187171116889cc10e
https://github.com/hurraygong/scGNN/tree/bc555895fbd5740ddd82e03187171116889cc10e
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.parameter import Parameter import torch.nn.modules.loss class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 ...
_ASPPModule
# 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 GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super(GCT, self).__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 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....
huanglf714/COMatchNet
_ASPPModule
false
6,832
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
import torch import torch.nn as nn class GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super().__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 1, 1)) ...
MyMaxPool1dPadSame
# 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 MyMaxPool1dPadSame(nn.Module): """ extend nn.MaxPool1d to support SAME padding """ def __init__(self, kernel_size): super(MyMaxPool1dPadSame, self).__init__() self.kernel_size = kernel_size self.stride = ...
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...
huynhnhathao/hum_to_find
MyMaxPool1dPadSame
false
6,833
[ "MIT" ]
1
a0d7ec4bab1a7e2f7175956ff2721e23e2448840
https://github.com/huynhnhathao/hum_to_find/tree/a0d7ec4bab1a7e2f7175956ff2721e23e2448840
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ extend nn.MaxPool1d to support SAME padding """ def __init__(self, kernel_size): super().__init__() self.kernel_size = kernel_size self.stride = 1 self.max_pool = torch.nn.Ma...
AE
# 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.modules.loss class AE(nn.Module): """ Autoencoder for dimensional reduction""" def __init__(self, dim): super(AE, self).__init__() self.dim = dim self.fc1 = nn.Linear(dim, 512) self.fc2 = nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
hurraygong/scGNN
AE
false
6,834
[ "MIT" ]
1
bc555895fbd5740ddd82e03187171116889cc10e
https://github.com/hurraygong/scGNN/tree/bc555895fbd5740ddd82e03187171116889cc10e
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.modules.loss class Model(nn.Module): """ Autoencoder for dimensional reduction""" def __init__(self, dim): super().__init__() self.dim = dim self.fc1 = nn.Linear(dim, 512) self.fc2 = nn.Linear(5...
VAE
# 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.modules.loss class VAE(nn.Module): """ Variational Autoencoder for dimensional reduction""" def __init__(self, dim): super(VAE, self).__init__() self.dim = dim self.fc1 = nn.Linear(dim, 400) sel...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
hurraygong/scGNN
VAE
false
6,835
[ "MIT" ]
1
bc555895fbd5740ddd82e03187171116889cc10e
https://github.com/hurraygong/scGNN/tree/bc555895fbd5740ddd82e03187171116889cc10e
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.modules.loss class Model(nn.Module): """ Variational Autoencoder for dimensional reduction""" def __init__(self, dim): super().__init__() self.dim = dim self.fc1 = nn.Linear(dim, 400) self.fc21 ...
eca_block
# 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 class eca_block(nn.Module): def __init__(self, channel, b=1, gamma=2): super(eca_block, self).__init__() kernel_size = int(abs((math.log(channel, 2) + b) / gamma)) kernel_size = kernel_size if kernel_size % 2 else kernel_size + 1 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 math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
huuthieu/pytorch-yolov4-tiny
eca_block
false
6,836
[ "MIT" ]
1
fac82da75e161221af74b56242272a42cf64c17e
https://github.com/huuthieu/pytorch-yolov4-tiny/tree/fac82da75e161221af74b56242272a42cf64c17e
import math import torch import torch.nn as nn class Model(nn.Module): def __init__(self, channel, b=1, gamma=2): super().__init__() kernel_size = int(abs((math.log(channel, 2) + b) / gamma)) kernel_size = kernel_size if kernel_size % 2 else kernel_size + 1 self.avg_pool = nn.Adap...
IrisClassifier
# 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.onnx class IrisClassifier(nn.Module): def __init__(self): super(IrisClassifier, self).__init__() self.fc1 = nn.Linear(4, 10) self.fc2 = nn.Linear(10, 10) self.fc3 = nn.Linear(10, 3) def forward(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
huxuan/mlflow
IrisClassifier
false
6,837
[ "Apache-2.0" ]
1
7b4ab0e4cac5d4c2d2cbfcd3d12aa55b2ee83efe
https://github.com/huxuan/mlflow/tree/7b4ab0e4cac5d4c2d2cbfcd3d12aa55b2ee83efe
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 10) self.fc2 = nn.Linear(10, 10) self.fc3 = nn.Linear(10, 3) def forward(self, x): x = F.relu(se...
DynamicPreHead
# 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 DynamicPreHead(nn.Module): def __init__(self, in_dim=3, embed_dim=100, kernel_size=1): super(DynamicPreHead, self).__init__() self.conv = nn.Conv2d(in_dim, embed_dim, kernel_size=kernel_size, stride=1, padding=int((kernel_size - 1) / 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
huanglf714/COMatchNet
DynamicPreHead
false
6,838
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim=3, embed_dim=100, kernel_size=1): super().__init__() self.conv = nn.Conv2d(in_dim, embed_dim, kernel_size=kernel_size, stride=1, padding=int((kernel_size - 1) / 2)) self.bn = nn.GroupNorm(int(...
NormalizationLayer
# 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 class NormalizationLayer(torch.nn.Module): """Class for normalization layer.""" def __init__(self, normalize_scale=1.0, learn_scale=True): super(NormalizationLayer, self).__init__() self.norm_s = float(normalize_scale) if learn_scale: s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_siz...
huynhtruc0309/tirg
NormalizationLayer
false
6,839
[ "Apache-2.0" ]
1
14ac6dcb41624729a6f4144a7c9e7899074f0eec
https://github.com/huynhtruc0309/tirg/tree/14ac6dcb41624729a6f4144a7c9e7899074f0eec
import torch import torch.utils.data class Model(torch.nn.Module): """Class for normalization layer.""" def __init__(self, normalize_scale=1.0, learn_scale=True): super().__init__() self.norm_s = float(normalize_scale) if learn_scale: self.norm_s = torch.nn.Parameter(torch...
decoder2
# 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 decoder2(nn.Module): def __init__(self, dropout=0.5, act=torch.sigmoid): super(decoder2, self).__init__() self.dropout = nn.Dropout(dropout) self.act = act def forward(self, z_node, z_hyperedge): z_node_ = self.dropout(z_node) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
iMoonLab/HHDTI
decoder2
false
6,840
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dropout=0.5, act=torch.sigmoid): super().__init__() self.dropout = nn.Dropout(dropout) self.act = act def forward(self, z_node, z_hyperedge): z_node_ = self.dropout(z_node) z_hyperedge_ = se...
node_encoder
# 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 node_encoder(nn.Module): def __init__(self, num_in_node, num_hidden, dropout, act=F.tanh): super(node_encoder, self).__init__() self.num_in_node = num_in_node self.num_hidden = num_hidden self.dropout = dropo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
iMoonLab/HHDTI
node_encoder
false
6,841
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_in_node, num_hidden, dropout, act=F.tanh): super().__init__() self.num_in_node = num_in_node self.num_hidden = num_hidden self.dropout = dropout self.act = act...
hyperedge_encoder
# 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 hyperedge_encoder(nn.Module): def __init__(self, num_in_edge, num_hidden, dropout, act=F.tanh): super(hyperedge_encoder, self).__init__() self.num_in_edge = num_in_edge self.num_hidden = num_hidden self.dropo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
iMoonLab/HHDTI
hyperedge_encoder
false
6,842
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_in_edge, num_hidden, dropout, act=F.tanh): super().__init__() self.num_in_edge = num_in_edge self.num_hidden = num_hidden self.dropout = dropout self.act = act...
kl_loss
# 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.nn import Module import torch from torch.nn.modules.module import Module class kl_loss(Module): def __init__(self, num_nodes, num_edges): super(kl_loss, self).__init__() self.num_nodes = num_nodes self.num_edges = num_edges def forward(self, z_node_log_std, z_node_mean, z_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module from torch.nn.modules.module import Module as...
iMoonLab/HHDTI
kl_loss
false
6,843
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
from torch.nn import Module import torch from torch.nn.modules.module import Module class Model(Module): def __init__(self, num_nodes, num_edges): super().__init__() self.num_nodes = num_nodes self.num_edges = num_edges def forward(self, z_node_log_std, z_node_mean, z_edge_log_std, z...
HGNN_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 math import torch import torch.nn as nn from torch.nn.parameter import Parameter class HGNN_conv(nn.Module): def __init__(self, in_ft, out_ft, bias=True): super(HGNN_conv, self).__init__() self.weight = Parameter(torch.Tensor(in_ft, out_ft)) if bias: self.bias = Paramet...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn from torch.nn.parameter import Parameter asser...
iMoonLab/HHDTI
HGNN_conv
false
6,844
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, in_ft, out_ft, bias=True): super().__init__() self.weight = Parameter(torch.Tensor(in_ft, out_ft)) if bias: self.bias = Parameter(torch.Tensor(out...
ArcFace
# 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 math import torch from itertools import product as product import torch.nn as nn import torch.utils.data.distributed class ArcFace(nn.Module): def __init__(self, s=64.0, m=0.5): """ArcFace formula: cos(m + theta) = cos(m)cos(theta) - sin(m)sin(theta) Note that: 0 <=...
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 math from itertools i...
iChenning/face_project
ArcFace
false
6,845
[ "MIT" ]
1
8d70858817da4d15c7b513ae492034784f57f35f
https://github.com/iChenning/face_project/tree/8d70858817da4d15c7b513ae492034784f57f35f
import math import torch from itertools import product as product import torch.nn as nn import torch.utils.data.distributed class Model(nn.Module): def __init__(self, s=64.0, m=0.5): """ArcFace formula: cos(m + theta) = cos(m)cos(theta) - sin(m)sin(theta) Note that: 0 <= m...
Model
# 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 Model(nn.Module): def forward(self, img: 'torch.Tensor', scale: 'torch.Tensor', mean: 'torch.Tensor'): return torch.div(torch.sub(img, mean), scale) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand( [4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
ibaiGorordo/depthai-experiments
Model
false
6,846
[ "MIT" ]
1
cde67e277120ddac815cbad6360695759cca900f
https://github.com/ibaiGorordo/depthai-experiments/tree/cde67e277120ddac815cbad6360695759cca900f
import torch from torch import nn class Model(nn.Module): def forward(self, img: 'torch.Tensor', scale: 'torch.Tensor', mean: 'torch.Tensor'): return torch.div(torch.sub(img, mean), scale) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand( [4, ...
Actor
# 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 Actor(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super(Actor, self).__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_inp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
icml2019-anonymous-author/Action-Robust-Reinforcement-Learning
Actor
false
6,847
[ "MIT" ]
1
03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
https://github.com/icml2019-anonymous-author/Action-Robust-Reinforcement-Learning/tree/03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super().__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_inputs, hidden...
Block
# 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._C import torch.serialization from torch import nn import torch.nn.functional as F class DropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). """ def __init__(self, drop_prob=None): super(DropPath, self).__init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
huazai-1994/24th-resolution-for-STAC-Overflow
Block
false
6,848
[ "Apache-2.0" ]
1
80bb3b367a126264823ffc597dc01586c262f9d9
https://github.com/huazai-1994/24th-resolution-for-STAC-Overflow/tree/80bb3b367a126264823ffc597dc01586c262f9d9
import torch import torch._C import torch.serialization from torch import nn import torch.nn.functional as F class DropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). """ def __init__(self, drop_prob=None): super().__init__() s...
EncoderBlock
# 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 from torch.autograd import Variable import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
howardchenhd/Transformer-pytorch
EncoderBlock
false
6,849
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
import math import torch from torch.autograd import Variable import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super().__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) ...
DecoderBlock
# 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 from torch.autograd import Variable import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
howardchenhd/Transformer-pytorch
DecoderBlock
false
6,850
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
import math import torch from torch.autograd import Variable import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super().__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) ...
Biaffine
# 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 Biaffine(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True): super(Biaffine, self).__init__() self.n_in = n_in self.n_out = n_out self.bias_x = bias_x self.bias_y = bias_y self.weight = nn.Parameter(torc...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
icewing1996/biaffine-parser
Biaffine
false
6,851
[ "MIT" ]
1
f5a4ece7ba9a087d81b76dd6a8ea6aa7d90c6c82
https://github.com/icewing1996/biaffine-parser/tree/f5a4ece7ba9a087d81b76dd6a8ea6aa7d90c6c82
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True): super().__init__() self.n_in = n_in self.n_out = n_out self.bias_x = bias_x self.bias_y = bias_y self.weight = nn.Parameter(torch.Tensor(n_out, n...
Critic
# 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 Critic(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super(Critic, self).__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
icml2019-anonymous-author/Action-Robust-Reinforcement-Learning
Critic
false
6,852
[ "MIT" ]
1
03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
https://github.com/icml2019-anonymous-author/Action-Robust-Reinforcement-Learning/tree/03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super().__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_inputs + num_o...
ScaledDotProductAttention
# 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 numpy as np import torch.utils.data class ScaledDotProductAttention(torch.nn.Module): """ Scaled, softmax attention module for Transformer as defined by Attention(Q, K, V) on pg 4. Returns the final attention vectors as well as the attention matrices (pairwise scores). """ def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
icemansina/protein-transformer
ScaledDotProductAttention
false
6,853
[ "BSD-3-Clause" ]
1
4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
https://github.com/icemansina/protein-transformer/tree/4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
import torch import numpy as np import torch.utils.data class Model(torch.nn.Module): """ Scaled, softmax attention module for Transformer as defined by Attention(Q, K, V) on pg 4. Returns the final attention vectors as well as the attention matrices (pairwise scores). """ def __init__(self): ...
Actor
# 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 as t import torch.nn as nn class Actor(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) self.action_range ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ikamensh/machin
Actor
false
6,854
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) self.action_range ...
MultiHeadedAttention
# 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 MultiHeadedAttention(nn.Module): def __init__(self, num_head, d_model, dropout=0.1): super(MultiHeadedAttention, self).__init__() assert d_model % num_head == 0 self.d_k = d_model // num_head 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....
iamxpy/pointer_summarizer
MultiHeadedAttention
false
6,855
[ "Apache-2.0" ]
1
ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
https://github.com/iamxpy/pointer_summarizer/tree/ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_head, d_model, dropout=0.1): super().__init__() assert d_model % num_head == 0 self.d_k = d_model // num_head self.h = num_head self.linear_key = n...
A2CCritic
# 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 as t import torch.nn as nn class A2CCritic(nn.Module): def __init__(self, state_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state): v = t.relu(self.fc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ikamensh/machin
A2CCritic
false
6,856
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, state_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state): v = t.relu(self.fc1(st...
DDPGCritic
# 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 as t import torch.nn as nn class DDPGCritic(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim + action_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ikamensh/machin
DDPGCritic
false
6,857
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim + action_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state, action...
CO_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 torch.nn as nn import torch.nn.functional as F class CO_Attention(nn.Module): def __init__(self, in_dim, co_attention_dim): super(CO_Attention, self).__init__() self.leak_relu = nn.LeakyReLU() self.relu = nn.ReLU() self.conv1 = nn.Conv2d(in_dim, 64, 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 assert_...
huanglf714/COMatchNet
CO_Attention
false
6,858
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_dim, co_attention_dim): super().__init__() self.leak_relu = nn.LeakyReLU() self.relu = nn.ReLU() self.conv1 = nn.Conv2d(in_dim, 64, kernel_size=3, padding=1) se...
ActorDiscrete
# 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 as t import torch.nn as nn class ActorDiscrete(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) def forward(self, state): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ikamensh/machin
ActorDiscrete
false
6,859
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) def forward(self, state): a...
A2CActorDisc
# 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.distributions import Categorical import torch as t import torch.nn as nn class A2CActorDisc(nn.Module): def __init__(self, state_dim, action_num): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ikamensh/machin
A2CActorDisc
false
6,860
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch from torch.distributions import Categorical import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, state_dim, action_num): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_n...
MultiHeadedAttention
# 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.utils.data class ScaledDotProductAttention(torch.nn.Module): """ Scaled, softmax attention module for Transformer as defined by Attention(Q, K, V) on pg 4. Returns the final attention vectors as well as the attention matrices (pairwise scores). """ def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
icemansina/protein-transformer
MultiHeadedAttention
false
6,861
[ "BSD-3-Clause" ]
1
4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
https://github.com/icemansina/protein-transformer/tree/4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
import torch import numpy as np import torch.utils.data class ScaledDotProductAttention(torch.nn.Module): """ Scaled, softmax attention module for Transformer as defined by Attention(Q, K, V) on pg 4. Returns the final attention vectors as well as the attention matrices (pairwise scores). """ def...
QNet
# 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 as t import torch.nn as nn class QNet(nn.Module): def __init__(self, state_dim, action_num, atom_num=10): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_num * atom_num) self.acti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ikamensh/machin
QNet
false
6,862
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, state_dim, action_num, atom_num=10): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_num * atom_num) self.act...
CosineBasisLinear
# 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 cosine_basis_functions(x, n_basis_functions=64): """Cosine basis functions used to embed quantile thresholds. Args: x (torch.Tensor): Input. n_basis_functions (int): Number of cosine basis functions. Returns: ndarray: Embe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
imatge-upc/pixelcoordEDL
CosineBasisLinear
false
6,863
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import numpy as np import torch.nn as nn def cosine_basis_functions(x, n_basis_functions=64): """Cosine basis functions used to embed quantile thresholds. Args: x (torch.Tensor): Input. n_basis_functions (int): Number of cosine basis functions. Returns: ndarray: Embe...
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 import torch.nn as nn import torch.nn.functional as F class GatedActivation(nn.Module): def __init__(self): super().__init__() def forward(self, x): x, y = x.chunk(2, dim=1) return F.tanh(x) * F.sigmoid(y) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def g...
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_...
imatge-upc/pixelcoordEDL
GatedActivation
false
6,864
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): x, y = x.chunk(2, dim=1) return F.tanh(x) * F.sigmoid(y) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_in...
A2CActorCont
# 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 as t import torch.nn as nn from torch.distributions import Normal import torch.nn.functional as F class A2CActorCont(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(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....
ikamensh/machin
A2CActorCont
false
6,865
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn from torch.distributions import Normal import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) ...
Attention
# 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 Attention(nn.Module): def __init__(self): super().__init__() self.softmax = nn.Softmax(dim=-1) def forward(self, Q, K, V, mask=None, dk=64): w = torch.bmm(Q, K.transpose(1, 2)) if mask is not None: assert w.size() == mask.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....
iml1111/machine-translation
Attention
false
6,866
[ "MIT" ]
1
a7dd673efbe8a172c1df49e0d50482dc84008c37
https://github.com/iml1111/machine-translation/tree/a7dd673efbe8a172c1df49e0d50482dc84008c37
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.softmax = nn.Softmax(dim=-1) def forward(self, Q, K, V, mask=None, dk=64): w = torch.bmm(Q, K.transpose(1, 2)) if mask is not None: assert w.size() == mask.size(...
HSwishV2
# 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 HSwishFunctionV2(torch.autograd.Function): @staticmethod def forward(ctx, feat): act = F.relu6(feat + 3).mul_(feat).div_(6) ctx.variables = feat return act @staticmethod def backward(ctx, grad_output): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
imvladikon/pytorch-loss
HSwishV2
false
6,867
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn import torch.nn.functional as F class HSwishFunctionV2(torch.autograd.Function): @staticmethod def forward(ctx, feat): act = F.relu6(feat + 3).mul_(feat).div_(6) ctx.variables = feat return act @staticmethod def backward(ctx, grad_output): ...
TemperatureHolder
# 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 TemperatureHolder(nn.Module): """Module that holds a temperature as a learnable value. Args: initial_log_temperature (float): Initial value of log(temperature). """ def __init__(self, initial_log_temperature=0): super().__init__() self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
imatge-upc/pixelcoordEDL
TemperatureHolder
false
6,868
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import torch.nn as nn class Model(nn.Module): """Module that holds a temperature as a learnable value. Args: initial_log_temperature (float): Initial value of log(temperature). """ def __init__(self, initial_log_temperature=0): super().__init__() self.log_tempera...
AsymmetricLossOptimized
# 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 AsymmetricLossOptimized(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=False): ...
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...
imvladikon/pytorch-loss
AsymmetricLossOptimized
false
6,869
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn class Model(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=False): super().__init__(...
Self_Attentive_Pooling
# 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 Self_Attentive_Pooling(nn.Module): def __init__(self, dim): """SAP Paper: Self-Attentive Speaker Embeddings for Text-Independent Speaker Verification Link: https://danielpovey.com/files/2018_interspeech_xvector_atten...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ikunsaikou/lhy_ML2021Spring
Self_Attentive_Pooling
false
6,870
[ "WTFPL" ]
1
80d8922077e2f5abba6a440c17654a143ebc8c9c
https://github.com/ikunsaikou/lhy_ML2021Spring/tree/80d8922077e2f5abba6a440c17654a143ebc8c9c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim): """SAP Paper: Self-Attentive Speaker Embeddings for Text-Independent Speaker Verification Link: https://danielpovey.com/files/2018_interspeech_xvector_attention.pdf ...
FCLateActionSAQFunction
# 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 import torch.nn.functional as F from abc import ABCMeta from abc import abstractmethod def init_lecun_normal(tensor, scale=1.0): """Initializes the tensor with LeCunNormal.""" fan_in = torch.nn.init._calculate_correct_fan(tensor, 'fan_in') std = scale ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
imatge-upc/pixelcoordEDL
FCLateActionSAQFunction
false
6,871
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from abc import ABCMeta from abc import abstractmethod def init_lecun_normal(tensor, scale=1.0): """Initializes the tensor with LeCunNormal.""" fan_in = torch.nn.init._calculate_correct_fan(tensor, 'fan_in') std = scale ...
TransformerEncoderLayer
# 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 TransformerEncoderLayer(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=16, dropout=0): super(TransformerEncoderLayer, self).__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.linear1 = 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 from torch._inductor.runtime....
imperial-qore/CAROL
TransformerEncoderLayer
false
6,872
[ "BSD-3-Clause" ]
1
57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
https://github.com/imperial-qore/CAROL/tree/57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=16, dropout=0): super().__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.linear1 = nn.Linear(d_model, dim_feedforward) self.dropout ...
WNConv2d
# 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 WNConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, activation=None): super().__init__() self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel, kernel_size, stride=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 ...
imatge-upc/pixelcoordEDL
WNConv2d
false
6,873
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, activation=None): super().__init__() self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel, kernel_size, stride=stri...
TransformerDecoderLayer
# 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 TransformerDecoderLayer(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=16, dropout=0): super(TransformerDecoderLayer, self).__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.multihead_attn = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
imperial-qore/CAROL
TransformerDecoderLayer
false
6,874
[ "BSD-3-Clause" ]
1
57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
https://github.com/imperial-qore/CAROL/tree/57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=16, dropout=0): super().__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.multihead_attn = nn.MultiheadAttention(d_model, nhead, dropout ...
FocalLossV1
# 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 FocalLossV1(nn.Module): def __init__(self, alpha=0.25, gamma=2, reduction='mean'): super(FocalLossV1, self).__init__() self.alpha = alpha self.gamma = gamma self.reduction = reduction self.crit = nn.BCEWithLogitsLoss(reduction='none...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
imvladikon/pytorch-loss
FocalLossV1
false
6,875
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, alpha=0.25, gamma=2, reduction='mean'): super().__init__() self.alpha = alpha self.gamma = gamma self.reduction = reduction self.crit = nn.BCEWithLogitsLoss(reduction='none') def forward(sel...
SoftDiceLossV1
# 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 SoftDiceLossV1(nn.Module): """ soft-dice loss, useful in binary segmentation """ def __init__(self, p=1, smooth=1, reduction='mean'): super(SoftDiceLossV1, self).__init__() self.p = p self.smooth = smooth self.reduction = reduct...
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...
imvladikon/pytorch-loss
SoftDiceLossV1
false
6,876
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn class Model(nn.Module): """ soft-dice loss, useful in binary segmentation """ def __init__(self, p=1, smooth=1, reduction='mean'): super().__init__() self.p = p self.smooth = smooth self.reduction = reduction def forward(self, lo...
CoordConv2d
# 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 CoordConv2d(nn.Conv2d): def __init__(self, in_chan, out_chan, kernel_size=3, stride=1, padding= 1, dilation=1, groups=1, bias=True): super(CoordConv2d, self).__init__(in_chan + 2, out_chan, kernel_size, stride=st...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
imvladikon/pytorch-loss
CoordConv2d
false
6,877
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Conv2d): def __init__(self, in_chan, out_chan, kernel_size=3, stride=1, padding= 1, dilation=1, groups=1, bias=True): super().__init__(in_chan + 2, out_chan, kernel_size, stride=stride, padding=padding, ...
EncoderLayer
# 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 AffineLayer(nn.Module): def __init__(self, dropout, d_model, d_ff): super(AffineLayer, self).__init__() self.w_1 = nn.Linear(d_model, d_ff) self.w_2 = nn.Linear(d_ff, d_model) self.dropout = nn.Dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
iamxpy/pointer_summarizer
EncoderLayer
false
6,878
[ "Apache-2.0" ]
1
ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
https://github.com/iamxpy/pointer_summarizer/tree/ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
import math import torch import torch.nn as nn import torch.nn.functional as F class AffineLayer(nn.Module): def __init__(self, dropout, d_model, d_ff): super().__init__() self.w_1 = nn.Linear(d_model, d_ff) self.w_2 = nn.Linear(d_ff, d_model) self.dropout = nn.Dropout(dropout) ...
SoftDiceLossV2
# 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.cuda.amp as amp class SoftDiceLossV2Func(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod @amp.custom_fwd def forward(ctx, logits, labels, p, smooth): logits = logits.float() ...
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.cuda.amp as amp assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
imvladikon/pytorch-loss
SoftDiceLossV2
false
6,879
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn import torch.cuda.amp as amp class SoftDiceLossV2Func(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod @amp.custom_fwd def forward(ctx, logits, labels, p, smooth): logits = logits.float() ...
DilConv1dWithGLU
# 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 DilConv1dWithGLU(nn.Module): def __init__(self, num_channels, dilation, lenght=100, kernel_size=2, activation=F.leaky_relu, residual_connection=True, dropout=0.2): super(DilConv1dWithGLU, self).__init__() self.dilati...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
icyray/proGENTRL
DilConv1dWithGLU
false
6,880
[ "MIT" ]
1
c48305c3411ecb604c4f26f5e6b62f285e42e696
https://github.com/icyray/proGENTRL/tree/c48305c3411ecb604c4f26f5e6b62f285e42e696
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_channels, dilation, lenght=100, kernel_size=2, activation=F.leaky_relu, residual_connection=True, dropout=0.2): super().__init__() self.dilation = dilation self.start_...
CausalConv2d
# 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 WNConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, activation=None): super().__init__() self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel, kernel_size, stride=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 ...
imatge-upc/pixelcoordEDL
CausalConv2d
false
6,881
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import torch.nn as nn class WNConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, activation=None): super().__init__() self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel, kernel_size, stride=s...
DY_Conv2d
# 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 DY_Conv2d(nn.Conv2d): def __init__(self, in_chan, out_chan, kernel_size=3, stride=1, padding= 1, dilation=1, groups=1, bias=False, act=nn.ReLU(inplace=True), K=4, temperature=30, temp_anneal_steps=3000): super(DY_Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
imvladikon/pytorch-loss
DY_Conv2d
false
6,882
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Conv2d): def __init__(self, in_chan, out_chan, kernel_size=3, stride=1, padding= 1, dilation=1, groups=1, bias=False, act=nn.ReLU(inplace=True), K=4, temperature=30, temp_anneal_steps=3000): super().__init__...
Conv2dSame
# 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.functional as F import torch.nn as nn from typing import List from typing import Optional from typing import Tuple from torch.jit.annotations import List def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 -...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn.functional as F import torch.nn as nn from typing im...
infomon/meta_nas
Conv2dSame
false
6,883
[ "Apache-2.0" ]
1
b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
https://github.com/infomon/meta_nas/tree/b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
import math import torch import torch.nn.functional as F import torch.nn as nn from typing import List from typing import Optional from typing import Tuple from torch.jit.annotations import List def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 -...
SelfAttention_naive
# 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 from torch import nn import torch.nn.functional as F class SelfAttention_naive(nn.Module): def __init__(self, dim_emb, dim_internal, heads=8, mask=False, dropout= 0.0, dtype=torch.float32): """ A single self attention block :param dim_emb: embedding dimen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
insop/transformer_simple
SelfAttention_naive
false
6,884
[ "Apache-2.0" ]
1
d07e6c3b9ddc9687d332ac3a980bbce22880ad46
https://github.com/insop/transformer_simple/tree/d07e6c3b9ddc9687d332ac3a980bbce22880ad46
import math import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim_emb, dim_internal, heads=8, mask=False, dropout= 0.0, dtype=torch.float32): """ A single self attention block :param dim_emb: embedding dimension :...
MultiHead
# 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 Attention(nn.Module): def __init__(self): super().__init__() self.softmax = nn.Softmax(dim=-1) def forward(self, Q, K, V, mask=None, dk=64): w = torch.bmm(Q, K.transpose(1, 2)) if mask is not None: assert w.size() == mask.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....
iml1111/machine-translation
MultiHead
false
6,885
[ "MIT" ]
1
a7dd673efbe8a172c1df49e0d50482dc84008c37
https://github.com/iml1111/machine-translation/tree/a7dd673efbe8a172c1df49e0d50482dc84008c37
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self): super().__init__() self.softmax = nn.Softmax(dim=-1) def forward(self, Q, K, V, mask=None, dk=64): w = torch.bmm(Q, K.transpose(1, 2)) if mask is not None: assert w.size() == mask.s...
IOU
# 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.multiprocessing def _iou(pred, target, size_average=True): b = pred.shape[0] IoU = 0.0 for i in range(0, b): Iand1 = torch.sum(target[i, :, :, :] * pred[i, :, :, :]) Ior1 = torch.sum(target[i, :, :, :]) + torch.sum(pred[i, :, :, :] ) - Iand1 Io...
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.multiprocessing assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._e...
intchous/SmartText
IOU
false
6,886
[ "MIT" ]
1
81abb84ce135a3859c32257d861c9e87b51f8c3f
https://github.com/intchous/SmartText/tree/81abb84ce135a3859c32257d861c9e87b51f8c3f
import torch import torch.multiprocessing def _iou(pred, target, size_average=True): b = pred.shape[0] IoU = 0.0 for i in range(0, b): Iand1 = torch.sum(target[i, :, :, :] * pred[i, :, :, :]) Ior1 = torch.sum(target[i, :, :, :]) + torch.sum(pred[i, :, :, :] ) - Iand1 Io...
CecaModule
# 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.functional as F import torch.nn as nn class CecaModule(nn.Module): """Constructs a circular ECA module. ECA module where the conv uses circular padding rather than zero padding. Unlike the spatial dimension, the channels do not have inherent ordering nor local...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
infomon/meta_nas
CecaModule
false
6,887
[ "Apache-2.0" ]
1
b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
https://github.com/infomon/meta_nas/tree/b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
import math import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """Constructs a circular ECA module. ECA module where the conv uses circular padding rather than zero padding. Unlike the spatial dimension, the channels do not have inherent ordering nor locality. ...
Binarizer
# 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 abc import ABC from sklearn.preprocessing import Binarizer class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detecti...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from abc import ABC assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
hannahaih/hummingbird
Binarizer
false
6,888
[ "MIT" ]
1
b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
https://github.com/hannahaih/hummingbird/tree/b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
import torch from abc import ABC from sklearn.preprocessing import Binarizer class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detecti...
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 as T import torch.nn as nn import torch.optim as optim class ActorNetwork(nn.Module): def __init__(self, alpha, state_dim, action_dim, fc1_dim, fc2_dim): super(ActorNetwork, self).__init__() self.fc1 = nn.Linear(state_dim, fc1_dim) self.ln1 = nn.LayerNorm(fc1_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....
indigoLovee/TD3
ActorNetwork
false
6,889
[ "MIT" ]
1
0e86a40c27ec376b52e9f8e0e70db28e7411276b
https://github.com/indigoLovee/TD3/tree/0e86a40c27ec376b52e9f8e0e70db28e7411276b
import torch import torch as T import torch.nn as nn import torch.optim as optim class Model(nn.Module): def __init__(self, alpha, state_dim, action_dim, fc1_dim, fc2_dim): super().__init__() self.fc1 = nn.Linear(state_dim, fc1_dim) self.ln1 = nn.LayerNorm(fc1_dim) self.fc2 = nn.L...
CriticNetwork
# 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 as T import torch.nn as nn import torch.optim as optim class CriticNetwork(nn.Module): def __init__(self, beta, state_dim, action_dim, fc1_dim, fc2_dim): super(CriticNetwork, self).__init__() self.fc1 = nn.Linear(state_dim + action_dim, fc1_dim) self.ln1 = nn.Lay...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
indigoLovee/TD3
CriticNetwork
false
6,890
[ "MIT" ]
1
0e86a40c27ec376b52e9f8e0e70db28e7411276b
https://github.com/indigoLovee/TD3/tree/0e86a40c27ec376b52e9f8e0e70db28e7411276b
import torch import torch as T import torch.nn as nn import torch.optim as optim class Model(nn.Module): def __init__(self, beta, state_dim, action_dim, fc1_dim, fc2_dim): super().__init__() self.fc1 = nn.Linear(state_dim + action_dim, fc1_dim) self.ln1 = nn.LayerNorm(fc1_dim) sel...
ChannelSqueeze
# 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 def channel_squeeze(x, groups): """ Channel squeeze operation. Parameters: ---------- x : Tensor Input tensor. groups : int Number of groups. Returns ------- Tensor Resulted tensor. """ batch, channels, height, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
iofthetiger/pkuad
ChannelSqueeze
false
6,891
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn def channel_squeeze(x, groups): """ Channel squeeze operation. Parameters: ---------- x : Tensor Input tensor. groups : int Number of groups. Returns ------- Tensor Resulted tensor. """ batch, channels, height, wi...
MP
# 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.nn import Module import torch import torch.utils.data from torch.nn import MaxPool2d class MP(Module): def __init__(self, k=2): super().__init__() self.m = MaxPool2d(kernel_size=k, stride=k) def forward(self, x): return self.m(x) def get_inputs(): return [torch.rand(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module import torch.utils.data from torch.nn import MaxPool2d assert...
ioangatop/yolo
MP
false
6,892
[ "MIT" ]
1
c65a72337369572bc07090f39123e2bf6ff5f4a3
https://github.com/ioangatop/yolo/tree/c65a72337369572bc07090f39123e2bf6ff5f4a3
from torch.nn import Module import torch import torch.utils.data from torch.nn import MaxPool2d class Model(Module): def __init__(self, k=2): super().__init__() self.m = MaxPool2d(kernel_size=k, stride=k) def forward(self, x): return self.m(x) def get_inputs(): return [torch.ra...
BasicBlockWN
# 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 as t import torch.nn as nn from abc import ABC from torch.nn.utils.weight_norm import weight_norm def conv1x1(in_planes, out_planes, stride=1): """ Create a 1x1 2d convolution block """ return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ikamensh/machin
BasicBlockWN
false
6,893
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
import torch import torch as t import torch.nn as nn from abc import ABC from torch.nn.utils.weight_norm import weight_norm def conv1x1(in_planes, out_planes, stride=1): """ Create a 1x1 2d convolution block """ return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) ...
Gated_Conv_1d
# 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 Gated_Conv_1d(nn.Module): def __init__(self, channels, kernel_size, stride=1, padding=0, dilation =1, groups=1, bias=True): super(Gated_Conv_1d, self).__init__() self.dilation = dilation self.channels = channels self.conv_dil = nn.C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
ioanvl/wavenet_classifier_torch
Gated_Conv_1d
false
6,894
[ "MIT" ]
1
de29bfce59d52ae46143f62c4d7a6158a04edf00
https://github.com/ioanvl/wavenet_classifier_torch/tree/de29bfce59d52ae46143f62c4d7a6158a04edf00
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, channels, kernel_size, stride=1, padding=0, dilation =1, groups=1, bias=True): super().__init__() self.dilation = dilation self.channels = channels self.conv_dil = nn.Conv1d(in_channels=channels,...
IRevInjectivePad
# 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 IRevInjectivePad(nn.Module): """ i-RevNet channel zero padding block. Parameters: ---------- padding : int Size of the padding. """ def __init__(self, padding): super(IRevInjectivePad, self).__init__() self.padding = paddin...
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...
iofthetiger/pkuad
IRevInjectivePad
false
6,895
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn class Model(nn.Module): """ i-RevNet channel zero padding block. Parameters: ---------- padding : int Size of the padding. """ def __init__(self, padding): super().__init__() self.padding = padding self.pad = nn.ZeroPad2d...
BERTIntermediate
# 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 import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
DAQuestionAnswering/Bert-n-Pals
BERTIntermediate
false
6,896
[ "MIT" ]
1
d5a288b9ac62259e70c249635108ba3906e19f00
https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math...
Decoder5
# 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 Decoder5(nn.Module): def __init__(self): super(Decoder5, self).__init__() self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv15 = nn.Conv2d(512, 512, 3, 1, 0) self.relu15 = nn.ReLU(inplace=True) self.unpool = nn.Upsampling...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
hologerry/wct_experiment
Decoder5
false
6,897
[ "MIT" ]
1
890d885561dc8df8c4ae732aebd902aa838257e6
https://github.com/hologerry/wct_experiment/tree/890d885561dc8df8c4ae732aebd902aa838257e6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv15 = nn.Conv2d(512, 512, 3, 1, 0) self.relu15 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingNearest2d(scale_f...
FirstLSTMAmp
# 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 FirstLSTMAmp(nn.Module): """ First LSTM amplifier branch. Parameters: ---------- in_features : int Number of input channels. out_features : int Number of output channels. """ def __init__(self, in_features, out_features): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
iofthetiger/pkuad
FirstLSTMAmp
false
6,898
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn class Model(nn.Module): """ First LSTM amplifier branch. Parameters: ---------- in_features : int Number of input channels. out_features : int Number of output channels. """ def __init__(self, in_features, out_features): supe...
AlexConv
# 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 from inspect import isfunction def get_activation_layer(activation): """ Create activation layer from string/function. Parameters: ---------- activation : function, or str, or nn.Module Activation function or name of activ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
iofthetiger/pkuad
AlexConv
false
6,899
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn import torch.nn.functional as F from inspect import isfunction def get_activation_layer(activation): """ Create activation layer from string/function. Parameters: ---------- activation : function, or str, or nn.Module Activation function or name of activ...
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 torch.nn.functional as F class Attention(torch.nn.Module): """Scaled dot product attention.""" def __init__(self, hidden_dim, **kwargs): super(Attention, self).__init__(**kwargs) self.projection_layer = torch.nn.Linear(hidden_dim, 1) def forward(self, atten_post): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
isspek/Cross-Lingual-Cyberbullying
Attention
false
6,900
[ "MIT" ]
1
710c136b9233f0be87af72e43e25722e73158c52
https://github.com/isspek/Cross-Lingual-Cyberbullying/tree/710c136b9233f0be87af72e43e25722e73158c52
import torch import torch.nn.functional as F class Model(torch.nn.Module): """Scaled dot product attention.""" def __init__(self, hidden_dim, **kwargs): super().__init__(**kwargs) self.projection_layer = torch.nn.Linear(hidden_dim, 1) def forward(self, atten_post): posts_attentio...
MobileNetV3Classifier
# 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 conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
iofthetiger/pkuad
MobileNetV3Classifier
false
6,901
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn import torch.nn.functional as F def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels...
SPHead
# 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 from inspect import isfunction def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
iofthetiger/pkuad
SPHead
false
6,902
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn import torch.nn.functional as F from inspect import isfunction def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int ...
NTXent
# 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 NTXent(nn.Module): def forward(self, z1, z2, t): batch_size = z1.shape[0] device = z1.device z1 = F.normalize(z1, dim=-1) z2 = F.normalize(z2, dim=-1) similarity = torch.matmul(z1, z2.T) simil...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
isaaccorley/contrastive-surface-image-pretraining
NTXent
false
6,903
[ "MIT" ]
1
a918d4fd3b9cc61ec512af978fb4f086d3b46a70
https://github.com/isaaccorley/contrastive-surface-image-pretraining/tree/a918d4fd3b9cc61ec512af978fb4f086d3b46a70
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def forward(self, z1, z2, t): batch_size = z1.shape[0] device = z1.device z1 = F.normalize(z1, dim=-1) z2 = F.normalize(z2, dim=-1) similarity = torch.matmul(z1, z2.T) simila...
VectorQuantizer
# 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 VectorQuantizer(nn.Module): def __init__(self, num_embeddings, embedding_dim, commitment_cost): super(VectorQuantizer, self).__init__() self._embedding_dim = embedding_dim self._num_embeddings = num_embeddings ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
imatge-upc/pixelcoordEDL
VectorQuantizer
false
6,904
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_embeddings, embedding_dim, commitment_cost): super().__init__() self._embedding_dim = embedding_dim self._num_embeddings = num_embeddings self._embedding = nn.Embeddin...
NavigatorBranch
# 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 def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int or tuple/list...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
iofthetiger/pkuad
NavigatorBranch
false
6,905
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int or tuple/list...
SCLN
# 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 LinearNorm(nn.Module): """ LinearNorm Projection """ def __init__(self, in_features, out_features, bias=False): super(LinearNorm, self).__init__() self.linear = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(self.linear.weig...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ishine/Cross-Speaker-Emotion-Transfer
SCLN
false
6,906
[ "MIT" ]
1
9d38e8058f5abc06167bac244d8ace083e2a6220
https://github.com/ishine/Cross-Speaker-Emotion-Transfer/tree/9d38e8058f5abc06167bac244d8ace083e2a6220
import torch import torch.nn as nn class LinearNorm(nn.Module): """ LinearNorm Projection """ def __init__(self, in_features, out_features, bias=False): super().__init__() self.linear = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(self.linear.weight) if b...
Tile
# 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 Tile(nn.Module): def __init__(self, max_size, dim): super(Tile, self).__init__() self.max_size = max_size self.dim = dim def forward(self, input): return input.repeat(*[(self.max_size if x == self.dim else 1) for x in range...
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...
ixaxaar/pytorch-npi
Tile
false
6,907
[ "MIT" ]
1
50b028840c00f7807fb6490ce6bb0918832dc360
https://github.com/ixaxaar/pytorch-npi/tree/50b028840c00f7807fb6490ce6bb0918832dc360
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, max_size, dim): super().__init__() self.max_size = max_size self.dim = dim def forward(self, input): return input.repeat(*[(self.max_size if x == self.dim else 1) for x in range(len(inpu...
GlobalAvgPool2d
# 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.utils class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): in_size = inputs.size() inputs = inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
jameslong95/FasterSeg
GlobalAvgPool2d
false
6,908
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
import torch import torch.nn as nn import torch.utils class Model(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super().__init__() def forward(self, inputs): in_size = inputs.size() inputs = inputs.view((in_size[0], in_size[1...
Vec2ArousalNet
# 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 class Vec2ArousalNet(torch.nn.Module): def __init__(self, D_in, H, D_out): super(Vec2ArousalNet, self).__init__() self.layer_1 = torch.nn.Linear(D_in, H) self.layer_2 = torch.nn.Linear(H, D_out) def forward(self, x): h = self.layer_1(x).cl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 asser...
jackvandrunen/hackuci18
Vec2ArousalNet
false
6,909
[ "BSD-2-Clause" ]
1
fff3fd7d116a6a83f19229a17377b84922145ebd
https://github.com/jackvandrunen/hackuci18/tree/fff3fd7d116a6a83f19229a17377b84922145ebd
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, D_in, H, D_out): super().__init__() self.layer_1 = torch.nn.Linear(D_in, H) self.layer_2 = torch.nn.Linear(H, D_out) def forward(self, x): h = self.layer_1(x).clamp(min=0) y = self.l...
LinearAttention2d
# 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 class LinearAttention2d(torch.nn.Module): """ Linear attention based on parametrized compatibility score function with softmax normalization. """ def __init__(self, in_features, out_features): super(LinearAttention2d, self).__init__() self.in_features = in_features ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
itsfrank98/CT-COVID
LinearAttention2d
false
6,911
[ "MIT" ]
1
3f054000ca0518be2486cf00cfab695b09e39a26
https://github.com/itsfrank98/CT-COVID/tree/3f054000ca0518be2486cf00cfab695b09e39a26
import torch class Model(torch.nn.Module): """ Linear attention based on parametrized compatibility score function with softmax normalization. """ def __init__(self, in_features, out_features): super().__init__() self.in_features = in_features self.out_features = out_features ...
UpConv2x2
# 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 from torch.cuda import * class UpConv2x2(nn.Module): def __init__(self, channels): super(UpConv2x2, self).__init__() self.conv = nn.Conv2d(channels, channels // 2, kernel_size=2, stride=1, paddi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data from torch.cuda import * assert_si...
jabae/detectEM
UpConv2x2
false
6,912
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * class Model(nn.Module): def __init__(self, channels): super().__init__() self.conv = nn.Conv2d(channels, channels // 2, kernel_size=2, stride=1, padding=0, bias=True) ...
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 numpy as np from typing import Optional import torch.nn as nn class MultiheadAttention(nn.Module): """Multihead scaled dot-product attention. """ def __init__(self, contexts: 'int', queries: 'int', channels: 'int', heads: 'int'): """Initializer. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ishine/torch-retriever-vc
MultiheadAttention
false
6,913
[ "MIT" ]
1
db5119d9d703ea819e2ac9185871ea3db52c14e1
https://github.com/ishine/torch-retriever-vc/tree/db5119d9d703ea819e2ac9185871ea3db52c14e1
import torch import numpy as np from typing import Optional import torch.nn as nn class Model(nn.Module): """Multihead scaled dot-product attention. """ def __init__(self, contexts: 'int', queries: 'int', channels: 'int', heads: 'int'): """Initializer. Args: contexts: ...
Bilinear
# 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 Bilinear(nn.Module): def __init__(self, size): super(Bilinear, self).__init__() self.size = size self.mat = nn.Parameter(torch.FloatTensor(self.size, self.size)) self.reset_parameters() def reset_parameters(self): params = [p 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jalshr21/diora-1
Bilinear
false
6,914
[ "Apache-2.0" ]
1
a9b680fde6a840707340e9e8232643b0f0e637bd
https://github.com/jalshr21/diora-1/tree/a9b680fde6a840707340e9e8232643b0f0e637bd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, size): super().__init__() self.size = size self.mat = nn.Parameter(torch.FloatTensor(self.size, self.size)) self.reset_parameters() def reset_parameters(self): params = [p for p in self.para...
SigmoidFocalLoss
# 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.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha ...
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 ...
jameslong95/FasterSeg
SigmoidFocalLoss
false
6,915
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
import torch import torch.nn as nn import torch.utils class Model(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super().__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha self.reduction = reduction ...
ScaledDotProductAttention
# 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 numpy as np import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, q, k, v, mask=None, rpe_q=None, rpe_v=None): """ Args: q: query (...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jahsylla/stochastic-cslr
ScaledDotProductAttention
false
6,916
[ "MIT" ]
1
d12d48ebec34183d939917cda2d54f38593dcddb
https://github.com/jahsylla/stochastic-cslr/tree/d12d48ebec34183d939917cda2d54f38593dcddb
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, dropout): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, q, k, v, mask=None, rpe_q=None, rpe_v=None): """ Args: q: query (*, query_len, dim) ...
JSloss
# 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 JSloss(nn.Module): """ Compute the Jensen-Shannon loss using the torch native kl_div""" def __init__(self, reduction='batchmean'): super().__init__() self.red = reduction def forward(self, input, target): n...
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...
jaredaevans/UltrafastNST
JSloss
false
6,917
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Compute the Jensen-Shannon loss using the torch native kl_div""" def __init__(self, reduction='batchmean'): super().__init__() self.red = reduction def forward(self, input, target): ne...
USConv2d
# 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 def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value is 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 import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.g...
jameslong95/FasterSeg
USConv2d
false
6,918
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
import torch import torch.nn as nn import torch.utils def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value is None: ...
GetStyleLoss
# 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 def gram_matrix(input): """ gram matrix for feature assignments """ a, b, c, d = input.size() allG = [] for i in range(a): features = input[i].view(b, c * d) gram = torch.mm(features, features.t()) gram = gram.d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
jaredaevans/UltrafastNST
GetStyleLoss
false
6,919
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
import torch import torch.nn as nn import torch.nn.functional as F def gram_matrix(input): """ gram matrix for feature assignments """ a, b, c, d = input.size() allG = [] for i in range(a): features = input[i].view(b, c * d) gram = torch.mm(features, features.t()) gram = gram.d...
ConvBlock
# 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 from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) class ConvBlock(nn.Module): def __init__(self, in_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jabae/detectEM
ConvBlock
false
6,920
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) class Model(nn.Module): def __init__(self, in_channe...
BertAttention
# 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 import torch.nn as nn class BertAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The 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 import triton_helpers from torch._inductor.runtime....
AsmitaBhat30/lxmert
BertAttention
false
6,921
[ "MIT" ]
1
90292dc36a25c04c4f76fe9119e3141d5dc05874
https://github.com/AsmitaBhat30/lxmert/tree/90292dc36a25c04c4f76fe9119e3141d5dc05874
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class Model(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidden size...
TVLoss
# 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 TVLoss(nn.Module): """L2 total variation loss, as in Mahendran et al.""" def forward(self, input): input = F.pad(input, (0, 1, 0, 1), 'replicate') x_diff = input[..., :-1, 1:] - input[..., :-1, :-1] y_diff = inpu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
jayChung0302/SideProject-sudalchongbo
TVLoss
false
6,922
[ "MIT" ]
1
fb0a3d0aee53ba24d3b8ec2dd8c52d0e8f6c33d7
https://github.com/jayChung0302/SideProject-sudalchongbo/tree/fb0a3d0aee53ba24d3b8ec2dd8c52d0e8f6c33d7
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """L2 total variation loss, as in Mahendran et al.""" def forward(self, input): input = F.pad(input, (0, 1, 0, 1), 'replicate') x_diff = input[..., :-1, 1:] - input[..., :-1, :-1] y_diff = input...
FocalLoss
# 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 FocalSigmoidLossFunc(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod def forward(ctx, logits, label, alpha, gamma): logits = logits.float() coeff = torch...
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...
jaredaevans/UltrafastNST
FocalLoss
false
6,923
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
import torch import torch.nn as nn import torch.nn.functional as F class FocalSigmoidLossFunc(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod def forward(ctx, logits, label, alpha, gamma): logits = logits.float() coeff = torch...
LogisticRegression
# 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 LogisticRegression(nn.Module): """ A logistic regression model of the form P(y = 1 | x) = 1 / (1 + exp(-(mx + b))) """ def __init__(self, init_m=1.0, init_b=1.0): """ Initialize a logistic regression model by defining its initial pa...
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...
jayelm/pytorch-project-template
LogisticRegression
false
6,924
[ "MIT" ]
1
30306ce07b21c97c6993432764cbbe0a73092a0c
https://github.com/jayelm/pytorch-project-template/tree/30306ce07b21c97c6993432764cbbe0a73092a0c
import torch import torch.nn as nn class Model(nn.Module): """ A logistic regression model of the form P(y = 1 | x) = 1 / (1 + exp(-(mx + b))) """ def __init__(self, init_m=1.0, init_b=1.0): """ Initialize a logistic regression model by defining its initial parameters. ...
DownConvBlock
# 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 from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) def maxpool2x2(): return nn.MaxPool2d(kernel_size=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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jabae/detectEM
DownConvBlock
false
6,925
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) def maxpool2x2(): return nn.MaxPool2d(kernel_size=2, ...
VariationalLoss
# 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 VariationalLoss(nn.Module): """ Variational loss to enforce continuity of images """ def forward(self, input): """ forward pass """ self.loss = F.mse_loss(input[:, :, 1:, :], input[:, :, :-1, :] ) + F.mse...
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...
jaredaevans/UltrafastNST
VariationalLoss
false
6,926
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Variational loss to enforce continuity of images """ def forward(self, input): """ forward pass """ self.loss = F.mse_loss(input[:, :, 1:, :], input[:, :, :-1, :] ) + F.mse_loss(inpu...
TwoHiddenLayerFc
# 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 TwoHiddenLayerFc(nn.Module): def __init__(self, input_shape, out_dim): super(TwoHiddenLayerFc, self).__init__() self.fc1 = nn.Linear(input_shape, 200) self.fc2 = nn.Linear(200, 200) self.fc3 = nn.Linear(200, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
jasonyanglu/fedavgpy
TwoHiddenLayerFc
false
6,927
[ "MIT" ]
1
cefbe5854f02d3df1197d849872286439c86e949
https://github.com/jasonyanglu/fedavgpy/tree/cefbe5854f02d3df1197d849872286439c86e949
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_shape, out_dim): super().__init__() self.fc1 = nn.Linear(input_shape, 200) self.fc2 = nn.Linear(200, 200) self.fc3 = nn.Linear(200, out_dim) def forward(self, x...
SoftCrossEntropyLoss2d
# 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 import torch.utils class SoftCrossEntropyLoss2d(nn.Module): def __init__(self): super(SoftCrossEntropyLoss2d, self).__init__() def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, 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....
jameslong95/FasterSeg
SoftCrossEntropyLoss2d
false
6,928
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils class Model(nn.Module): def __init__(self): super().__init__() def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, dim=1) for index in range(inputs.size()[0]): ...
StyleTrack
# 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 def gram_matrix(input): """ gram matrix for feature assignments """ a, b, c, d = input.size() allG = [] for i in range(a): features = input[i].view(b, c * d) gram = torch.mm(features, features.t()) gram = gram.div(c * d) allG.append(gr...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
jaredaevans/UltrafastNST
StyleTrack
false
6,929
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
import torch import torch.nn as nn def gram_matrix(input): """ gram matrix for feature assignments """ a, b, c, d = input.size() allG = [] for i in range(a): features = input[i].view(b, c * d) gram = torch.mm(features, features.t()) gram = gram.div(c * d) allG.append(gr...
ReflectPad2d
# 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 class ReflectPad2d(torch.nn.Module): """ reflectionpad2d that can be transfered across onnx etc size : int (the size of padding) """ def __init__(self, size): super().__init__() self.size = size def forward(self, ins): size = self.size l_list, r_l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
jaredaevans/UltrafastNST
ReflectPad2d
false
6,930
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
import torch class Model(torch.nn.Module): """ reflectionpad2d that can be transfered across onnx etc size : int (the size of padding) """ def __init__(self, size): super().__init__() self.size = size def forward(self, ins): size = self.size l_list, r_list = [...