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
ANN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch from torch import nn class ANN(nn.Module): def __init__(self, args, name): super(ANN, self).__init__() self.name = name self.len = 0 self.loss = 0 self.fc1 = nn.Linear(args.input_dim, 20) self.relu = nn.ReL...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
luoyang97/FedProx-PyTorch
ANN
false
7,133
[ "MIT" ]
1
b19263e22420251ad8c3a9701951a37b5c0a3569
https://github.com/luoyang97/FedProx-PyTorch/tree/b19263e22420251ad8c3a9701951a37b5c0a3569
from _paritybench_helpers import _mock_config import torch from torch import nn class Model(nn.Module): def __init__(self, args, name): super().__init__() self.name = name self.len = 0 self.loss = 0 self.fc1 = nn.Linear(args.input_dim, 20) self.relu = nn.ReLU() ...
Predict_Network1_combine
# 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.optim as optim def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class LayerNorm(nn.Module): """ Simple 1D LayerNorm. ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ltzheng/CDS
Predict_Network1_combine
false
7,134
[ "Apache-2.0" ]
1
397282147498647a9f26577adfa451e8478de76d
https://github.com/ltzheng/CDS/tree/397282147498647a9f26577adfa451e8478de76d
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class LayerNorm(nn.Module): """ Simple 1D LayerNorm. ""...
GeM
# 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 from torch.nn.parameter import Parameter class GeM(nn.Module): def __init__(self, p=3, eps=1e-06): super(GeM, self).__init__() self.p = Parameter(torch.ones(1) * p) self.eps = eps def forward(self, x): return F...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn from to...
lulor/project_vg
GeM
false
7,135
[ "MIT" ]
1
27b0c3b3038c5a666dde516a0a265ae8ddf2059f
https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f
import torch from torch import nn import torch.nn.functional as F from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, p=3, eps=1e-06): super().__init__() self.p = Parameter(torch.ones(1) * p) self.eps = eps def forward(self, x): return F.avg_po...
SEModule
# 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 torchvision.transforms import functional as F import torch.utils.data from torch import nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): retu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torchvision.transforms i...
ljjyxz123/CenterMask
SEModule
false
7,136
[ "BSD-2-Clause" ]
1
443eebde30e209eeb3b953f7ef35d3f7f14aaca5
https://github.com/ljjyxz123/CenterMask/tree/443eebde30e209eeb3b953f7ef35d3f7f14aaca5
import torch from torchvision.transforms import functional as F import torch.utils.data from torch import nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super().__init__() self.inplace = inplace def forward(self, x): return F.relu6(x +...
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.utils class Conv2d(nn.Module): def __init__(self, C_in, C_out, kernel_size, padding): super(Conv2d, self).__init__() self.conv = nn.Conv2d(C_in, C_out, kernel_size=kernel_size, stride= 1, padding=padding) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.g...
lorylei/DARTS-et
Conv2d
false
7,137
[ "Apache-2.0" ]
1
f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
https://github.com/lorylei/DARTS-et/tree/f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
import torch import torch.nn as nn import torch.utils class Model(nn.Module): def __init__(self, C_in, C_out, kernel_size, padding): super().__init__() self.conv = nn.Conv2d(C_in, C_out, kernel_size=kernel_size, stride= 1, padding=padding) def forward(self, x): return sel...
GeneralizedMeanPooling
# 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 from torch.optim.lr_scheduler import * from torch.optim import * class GeneralizedMeanPooling(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn from to...
lxc86739795/fast-reid
GeneralizedMeanPooling
false
7,138
[ "Apache-2.0" ]
1
29178d70c591ef64021f10767eb606f3053156b9
https://github.com/lxc86739795/fast-reid/tree/29178d70c591ef64021f10767eb606f3053156b9
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * class Model(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = in...
net2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class net2(nn.Module): """ """ def __init__(self, n_classes=2): super(net2, self).__init__() if torch.cuda.is_available(): torch.device('cuda') else: torch.device('cpu') self.n_class...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
luisesanmartin/dwelling-recognition
net2
false
7,139
[ "MIT" ]
1
b2437b64088a26746947c1c88077c96332e7b9c6
https://github.com/luisesanmartin/dwelling-recognition/tree/b2437b64088a26746947c1c88077c96332e7b9c6
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ """ def __init__(self, n_classes=2): super().__init__() if torch.cuda.is_available(): torch.device('cuda') else: torch.device('cpu') self.n_classes = n_cl...
LSTM
# 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 import torch.nn import torch.optim import torch.nn as nn from torch.autograd import Variable class LSTM(nn.Module): def __init__(self, input_size, hidden_size, output_size=1, cell_size=2): super(LSTM, self).__init__() self.hidden_size = hidden_size sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
lwaekfjlk/Light-the-Torch
LSTM
false
7,140
[ "MIT" ]
1
eed1df3d28016aee86385959b5e94e2108ee0571
https://github.com/lwaekfjlk/Light-the-Torch/tree/eed1df3d28016aee86385959b5e94e2108ee0571
import torch import torch.utils.data import torch.nn import torch.optim import torch.nn as nn from torch.autograd import Variable class Model(nn.Module): def __init__(self, input_size, hidden_size, output_size=1, cell_size=2): super().__init__() self.hidden_size = hidden_size self.cell_si...
Attloss
# 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 class Attloss(nn.Module): def __init__(self): super(Attloss, self).__init__() self.bce = nn.BCEWithLogitsLoss() def forward(self, x_org, y_mask, att): loss_att = ((x_org * y_mask[:, 1, ...].unsqueeze(dim=1) - att) ** 2 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional assert_size_stride = torch._C._dynamo.gu...
lvxiuwang/ferattention
Attloss
false
7,141
[ "MIT" ]
1
02e97df4a12129ed6706bddf0d2109650eae8765
https://github.com/lvxiuwang/ferattention/tree/02e97df4a12129ed6706bddf0d2109650eae8765
import torch import torch.nn as nn import torch.nn.functional class Model(nn.Module): def __init__(self): super().__init__() self.bce = nn.BCEWithLogitsLoss() def forward(self, x_org, y_mask, att): loss_att = ((x_org * y_mask[:, 1, ...].unsqueeze(dim=1) - att) ** 2 ).mean...
SOSLoss
# 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 SOSLoss(nn.Module): def __init__(self): super().__init__() def forward(self, anchors, positives, negatives): dist_an = torch.sum(torch.pow(anchors - negatives, 2), dim=1) dist_pn = torch.sum(torch.pow(positives - negatives, 2), dim=1) 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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
lulor/project_vg
SOSLoss
false
7,142
[ "MIT" ]
1
27b0c3b3038c5a666dde516a0a265ae8ddf2059f
https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, anchors, positives, negatives): dist_an = torch.sum(torch.pow(anchors - negatives, 2), dim=1) dist_pn = torch.sum(torch.pow(positives - negatives, 2), dim=1) nq ...
AttentionLayer
# 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 AttentionLayer(nn.Module): def __init__(self, hidden_dim_en, hidden_dim_de, projected_size): super(AttentionLayer, self).__init__() self.linear1 = nn.Linear(hidden_dim_en, projected_size) self.linear2 = nn.Linear(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....
lost-person/AREL
AttentionLayer
false
7,143
[ "MIT" ]
1
cee8bc542a2226f41fcbf65ed805fd585512689d
https://github.com/lost-person/AREL/tree/cee8bc542a2226f41fcbf65ed805fd585512689d
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_dim_en, hidden_dim_de, projected_size): super().__init__() self.linear1 = nn.Linear(hidden_dim_en, projected_size) self.linear2 = nn.Linear(hidden_dim_de, projected_size) ...
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 math import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super(ScaledDotProductAttention, self).__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
luyu-fan/LRCM
MultiHeadAttention
false
7,144
[ "MIT" ]
1
6b0e4d7998bc4969afa764eb753077e3f858f1ba
https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba
import math import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()[-1] dim = query.size()...
ComprehensionLayer_step3
# 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 ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super(ScaledDotProductAttention, self).__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
luyu-fan/LRCM
ComprehensionLayer_step3
false
7,145
[ "MIT" ]
1
6b0e4d7998bc4969afa764eb753077e3f858f1ba
https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba
import math import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()[-1] dim = query.size()...
Tanh
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn import torch._utils from torch import optim as optim import torch.nn.parallel class Tanh(nn.Module): def __init__(self, inplace=False): super(Tanh, self).__init__() self.inplace = inplace def forward(self, x): return x.tanh_(...
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 import torch.nn as nn import torch._utils from torch im...
lovelinability/pytorch_image_models
Tanh
false
7,146
[ "Apache-2.0" ]
1
7c54200f3de7611ab1222a37088eb7f66ae2858f
https://github.com/lovelinability/pytorch_image_models/tree/7c54200f3de7611ab1222a37088eb7f66ae2858f
import torch import torch.utils.data import torch.nn as nn import torch._utils from torch import optim as optim import torch.nn.parallel class Model(nn.Module): def __init__(self, inplace=False): super().__init__() self.inplace = inplace def forward(self, x): return x.tanh_() if self...
LayerNormalization
# 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 LayerNormalization(nn.Module): def __init__(self, d_hid, eps=0.001): super(LayerNormalization, self).__init__() self.gamma = nn.Parameter(torch.ones(d_hid), requires_grad=True) self.beta = nn.Parameter(torch.zeros(d_hid), requires_grad=True) ...
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_...
lz-chen/ner-bert
LayerNormalization
false
7,147
[ "MIT" ]
1
86e73c1e7124a4fb6ee65d42b72333573841fe5b
https://github.com/lz-chen/ner-bert/tree/86e73c1e7124a4fb6ee65d42b72333573841fe5b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_hid, eps=0.001): super().__init__() self.gamma = nn.Parameter(torch.ones(d_hid), requires_grad=True) self.beta = nn.Parameter(torch.zeros(d_hid), requires_grad=True) self.eps = eps def forward(sel...
Conv2dUntiedBias
# 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 from torch.nn.modules.utils import _pair class Conv2dUntiedBias(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, input_len, stride=1, padding=0, dilation=1, groups=1): super(Conv2dUntiedBias, 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 from torch.nn.modules.utils import _pair asser...
lzamparo/SeqDemote
Conv2dUntiedBias
false
7,148
[ "MIT" ]
1
3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a
https://github.com/lzamparo/SeqDemote/tree/3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, input_len, stride=1, padding=0, dilation=1, groups=1): super().__init__() kernel_size ...
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 class FocalLoss(nn.Module): def __init__(self, reduce=True, gamma=1.5, alpha=0.7): super(FocalLoss, self).__init__() self.reduce = reduce self.gamma = gamma self.alpha = alpha def _get_weights(self, x, t): """ Helper to get t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
lzamparo/SeqDemote
FocalLoss
false
7,149
[ "MIT" ]
1
3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a
https://github.com/lzamparo/SeqDemote/tree/3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, reduce=True, gamma=1.5, alpha=0.7): super().__init__() self.reduce = reduce self.gamma = gamma self.alpha = alpha def _get_weights(self, x, t): """ Helper to get the weights for foca...
SoftTargetCrossEntropy
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F import torch._utils from torch import optim as optim import torch.nn.parallel class SoftTargetCrossEntropy(nn.Module): def __init__(self): super(SoftTargetCrossEntropy,...
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.utils.dat...
lovelinability/pytorch_image_models
SoftTargetCrossEntropy
false
7,150
[ "Apache-2.0" ]
1
7c54200f3de7611ab1222a37088eb7f66ae2858f
https://github.com/lovelinability/pytorch_image_models/tree/7c54200f3de7611ab1222a37088eb7f66ae2858f
import torch import torch.utils.data import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F import torch._utils from torch import optim as optim import torch.nn.parallel class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x, t...
SimpleConv
# 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 SimpleConv(nn.Module): def __init__(self): super(SimpleConv, self).__init__() self.conv1 = nn.Conv2d(3, 50, 5, 1) self.conv2 = nn.Conv2d(50, 100, 5, 1) self.fc1 = nn.Linear(21 * 21 * 100, 1600) self.f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
junoon53/pcam_challenge
SimpleConv
false
7,151
[ "MIT" ]
1
283c98b2d2e211424cdcb56d8230a7a29dc5af46
https://github.com/junoon53/pcam_challenge/tree/283c98b2d2e211424cdcb56d8230a7a29dc5af46
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 50, 5, 1) self.conv2 = nn.Conv2d(50, 100, 5, 1) self.fc1 = nn.Linear(21 * 21 * 100, 1600) self.fc2 = nn.Linear(1600, ...
BilinearConvLayer
# 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 def setup_conv(in_channels, out_channels, kernel_size, bias, padding_mode, stride=1, Conv=torch.nn.Conv2d): return Conv(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, padding=(kernel_size - 1) // 2, stride= stride, bias=bias) class BilinearConvLayer...
import torch from torch._inductor.select_algorithm import extern_kernels import 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_cu...
m-dml/lil2021swe
BilinearConvLayer
false
7,152
[ "Apache-2.0" ]
1
45352f214ec28c9f91dd24ed3669f492d8b68382
https://github.com/m-dml/lil2021swe/tree/45352f214ec28c9f91dd24ed3669f492d8b68382
import torch def setup_conv(in_channels, out_channels, kernel_size, bias, padding_mode, stride=1, Conv=torch.nn.Conv2d): return Conv(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, padding=(kernel_size - 1) // 2, stride= stride, bias=bias) class Model(torch.nn.Mo...
FFN
# 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 GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU came from : https://github.com/codertimo/BERT-pytorch/blob/master/bert_pytorch/model/utils/gelu.py """ def __init__(self): super(GELU,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
luyu-fan/LRCM
FFN
false
7,153
[ "MIT" ]
1
6b0e4d7998bc4969afa764eb753077e3f858f1ba
https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba
import math import torch import torch.nn as nn class GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU came from : https://github.com/codertimo/BERT-pytorch/blob/master/bert_pytorch/model/utils/gelu.py """ def __init__(self): super().__i...
CRN
# 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 CRN(torch.nn.Module): def __init__(self, dim): super(CRN, self).__init__() self.h_w = 13, 13 self.downsample = torch.nn.AdaptiveAvgPool2d(self.h_w) n_filters = [32, 32, 20] self.conv1 = torch.nn.Conv2d(dim, n_filters[0], 3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
lulor/project_vg
CRN
false
7,154
[ "MIT" ]
1
27b0c3b3038c5a666dde516a0a265ae8ddf2059f
https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self, dim): super().__init__() self.h_w = 13, 13 self.downsample = torch.nn.AdaptiveAvgPool2d(self.h_w) n_filters = [32, 32, 20] self.conv1 = torch.nn.Conv2d(dim, n_filters[0], 3, paddi...
DeepLiftRegressor
# 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 DeepLiftRegressor(nn.Module): def __init__(self): super(DeepLiftRegressor, self).__init__() self.conv1 = nn.Conv2d(in_channels=4, out_channels=50, kernel_size= (1, 11)) self.conv2 = nn.Conv2d(in_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 assert_...
lzamparo/SeqDemote
DeepLiftRegressor
false
7,155
[ "MIT" ]
1
3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a
https://github.com/lzamparo/SeqDemote/tree/3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(in_channels=4, out_channels=50, kernel_size= (1, 11)) self.conv2 = nn.Conv2d(in_channels=50, out_channels=50, kernel_size ...
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 math import torch import numpy as np import torch.nn as nn def logistic(x, c=1, a=20, b=np.e): return c / (1 + a * b ** -x) def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
lysecret2/explainability-simulation
MultiHeadAttention
false
7,156
[ "MIT" ]
1
e558f6f527ac2ff66f00fcb37aeeaf404c32ff66
https://github.com/lysecret2/explainability-simulation/tree/e558f6f527ac2ff66f00fcb37aeeaf404c32ff66
import math import torch import numpy as np import torch.nn as nn def logistic(x, c=1, a=20, b=np.e): return c / (1 + a * b ** -x) def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) ...
L2Norm
# 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 L2Norm(nn.Module): """l2-normalization as layer. """ def __init__(self, *, eps: float=1e-10) ->None: super().__init__() self.eps = eps def forward(self, x: 'torch.Tensor') ->torch.Tensor: norm = torch.sqrt(torch.sum(x * x, dim=-1) + self.e...
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_...
manyids2/mkd_pytorch
L2Norm
false
7,157
[ "MIT" ]
1
fb97c4285f93f38371b2aac904a133f970be247e
https://github.com/manyids2/mkd_pytorch/tree/fb97c4285f93f38371b2aac904a133f970be247e
import torch import torch.nn as nn class Model(nn.Module): """l2-normalization as layer. """ def __init__(self, *, eps: float=1e-10) ->None: super().__init__() self.eps = eps def forward(self, x: 'torch.Tensor') ->torch.Tensor: norm = torch.sqrt(torch.sum(x * x, dim=-1) + self.ep...
MLP_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 from torch import nn class MLP_VAE(nn.Module): def __init__(self, ZDIMS): super().__init__() self.z_dims = ZDIMS self.fc1 = nn.Linear(1024, 400) self.relu = nn.ReLU() self.fc21 = nn.Linear(400, ZDIMS) self.fc22 = nn.Linear(400, ZDIMS) self.fc3 ...
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...
manuelladron/artistic_style_robotic_painting
MLP_VAE
false
7,158
[ "MIT" ]
1
3769fc470bb4f69d2ea77d2713e4eb9bf0eaa4e9
https://github.com/manuelladron/artistic_style_robotic_painting/tree/3769fc470bb4f69d2ea77d2713e4eb9bf0eaa4e9
import torch from torch import nn class Model(nn.Module): def __init__(self, ZDIMS): super().__init__() self.z_dims = ZDIMS self.fc1 = nn.Linear(1024, 400) self.relu = nn.ReLU() self.fc21 = nn.Linear(400, ZDIMS) self.fc22 = nn.Linear(400, ZDIMS) self.fc3 = ...
SoftDiceLoss
# 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 SoftDiceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, logits, labels): probs = torch.sigmoid(logits) num = labels.size(0) m1 = probs.view(num, -1) m2 = labels.view(num, -1) intersection = m1 ...
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...
marcomatteo/steel-segmentation-nbdev
SoftDiceLoss
false
7,159
[ "Apache-2.0" ]
1
dde19b0b3bf7657ab575e691bca1751592aecc67
https://github.com/marcomatteo/steel-segmentation-nbdev/tree/dde19b0b3bf7657ab575e691bca1751592aecc67
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, logits, labels): probs = torch.sigmoid(logits) num = labels.size(0) m1 = probs.view(num, -1) m2 = labels.view(num, -1) intersection = m1 * m2 ...
ResizeTransform
# 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 nnf class ResizeTransform(nn.Module): """ Resize a transform, which involves resizing the vector field *and* rescaling it. """ def __init__(self, vel_resize, ndims): super().__init__() self.factor = 1.0 / vel_resize ...
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...
mariakesa/ZebraFishRegistrationPipeline
ResizeTransform
false
7,160
[ "MIT" ]
1
4955044eb69dc04c579f59ccb24e02e4451aebcc
https://github.com/mariakesa/ZebraFishRegistrationPipeline/tree/4955044eb69dc04c579f59ccb24e02e4451aebcc
import torch import torch.nn as nn import torch.nn.functional as nnf class Model(nn.Module): """ Resize a transform, which involves resizing the vector field *and* rescaling it. """ def __init__(self, vel_resize, ndims): super().__init__() self.factor = 1.0 / vel_resize self.m...
BahdanauAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor import torch.nn as nn from typing import Tuple import torch.nn.functional as F class BahdanauAttention(nn.Module): def __init__(self, dec_dim: 'int', enc_dim: 'int', num_hiddens: 'int'): super().__init__() self.W1 = nn.Linear(dec_dim, num_hiddens, 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....
manhtrantienhn/Sentiment-with-pretrain-model
BahdanauAttention
false
7,161
[ "MIT" ]
1
bbbbaa94cf481afcfe704cbcb27b602308f43de5
https://github.com/manhtrantienhn/Sentiment-with-pretrain-model/tree/bbbbaa94cf481afcfe704cbcb27b602308f43de5
import torch from torch import Tensor import torch.nn as nn from typing import Tuple import torch.nn.functional as F class Model(nn.Module): def __init__(self, dec_dim: 'int', enc_dim: 'int', num_hiddens: 'int'): super().__init__() self.W1 = nn.Linear(dec_dim, num_hiddens, bias=False) sel...
CRF
# 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.dataloader import torch.nn class CRF(torch.nn.Module): """ Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data.dataloader import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
marleneDebatin/flair
CRF
false
7,162
[ "MIT" ]
1
4d17509f358158f66d43e85db1b6990523b0b095
https://github.com/marleneDebatin/flair/tree/4d17509f358158f66d43e85db1b6990523b0b095
import torch import torch.utils.data.dataloader import torch.nn class Model(torch.nn.Module): """ Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on pre...
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.functional as F from torch import nn as nn class FocalLoss(nn.Module): """Focal loss function for imbalanced dataset. Args: alpha (float): weighing factor between 0 and 1. Alpha may be set by inverse class frequency gamma (float): modulati...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
marshuang80/pe-slice-finder
FocalLoss
false
7,163
[ "Apache-2.0" ]
1
2426a55c404e8eb694110351d604d6bdd613e5ae
https://github.com/marshuang80/pe-slice-finder/tree/2426a55c404e8eb694110351d604d6bdd613e5ae
import torch import torch.nn.functional as F from torch import nn as nn class Model(nn.Module): """Focal loss function for imbalanced dataset. Args: alpha (float): weighing factor between 0 and 1. Alpha may be set by inverse class frequency gamma (float): modulating f...
TFBCELoss
# 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 TFBCELoss(nn.Module): def __init__(self, pos_weight): super().__init__() self.pos_weight = pos_weight def forward(self, logits, targets): relu_logits = F.relu(logits) neg_abs_logits = -torch.abs(logits) ...
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...
marload/DAFT
TFBCELoss
false
7,164
[ "Apache-2.0" ]
1
22ebe1cc1d1ca8d4b1f7557bf5833983c63ba330
https://github.com/marload/DAFT/tree/22ebe1cc1d1ca8d4b1f7557bf5833983c63ba330
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, pos_weight): super().__init__() self.pos_weight = pos_weight def forward(self, logits, targets): relu_logits = F.relu(logits) neg_abs_logits = -torch.abs(logits) ...
PyramidDown
# 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 from torch.nn import functional as F class PyramidDown(nn.Module): def __init__(self) ->None: super(PyramidDown, self).__init__() self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 4], [...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
masanorihirano/pytorch_extra_mhirano
PyramidDown
false
7,165
[ "MIT" ]
1
d19e07445567c069793b7ca1a22a846d7cbce58d
https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self) ->None: super().__init__() self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 4], [1, 4, 6, 4, ...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) self.conv2_drop = nn.Dropout2d() self.fc1 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
lzhbrian/FashionAI-1
Net
false
7,166
[ "MIT" ]
1
1fede16044c8a4516ba4dd6766add44d47245f6b
https://github.com/lzhbrian/FashionAI-1/tree/1fede16044c8a4516ba4dd6766add44d47245f6b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) self.conv2_drop = nn.Dropout2d() self.fc1 = nn.Linea...
DotProductAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import warnings from typing import Optional from typing import Tuple import torch.nn as nn class DotProductAttention(nn.Module): """DotProductAttention. .. math:: \\mathrm{DotProductAttention}(Q, K, V) &=& \\mathrm{softmax}(qk^T) v q &=& QW_1 + b_1 k &=& KW...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
masanorihirano/pytorch_extra_mhirano
DotProductAttention
false
7,167
[ "MIT" ]
1
d19e07445567c069793b7ca1a22a846d7cbce58d
https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d
import math import torch import warnings from typing import Optional from typing import Tuple import torch.nn as nn class Model(nn.Module): """DotProductAttention. .. math:: \\mathrm{DotProductAttention}(Q, K, V) &=& \\mathrm{softmax}(qk^T) v q &=& QW_1 + b_1 k &=& KW_2 + b_2 ...
KLDivLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from typing import Optional from torch.nn import functional as F from torch.nn.modules.loss import _Loss class KLDivLoss(_Loss): def __init__(self, size_average: 'Optional[bool]'=None, reduce: 'Optional[bool]'=None, reduction: 'str'='mean') ->None: super(KLDivLoss, self).__init__(siz...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from typing...
masanorihirano/pytorch_extra_mhirano
KLDivLoss
false
7,168
[ "MIT" ]
1
d19e07445567c069793b7ca1a22a846d7cbce58d
https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d
import torch from typing import Optional from torch.nn import functional as F from torch.nn.modules.loss import _Loss class Model(_Loss): def __init__(self, size_average: 'Optional[bool]'=None, reduce: 'Optional[bool]'=None, reduction: 'str'='mean') ->None: super().__init__(size_average, reduce, ...
VGGBase
# 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 torchvision from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data def decimate(tensor, m): """ Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value. This is used when we conve...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 torchvision from torch...
dee-walia20/SSD-Implementation-using-Pytorch
VGGBase
false
7,169
[ "MIT" ]
1
2a7dcdcea2787f4bffd45f335819f08af2b525dd
https://github.com/dee-walia20/SSD-Implementation-using-Pytorch/tree/2a7dcdcea2787f4bffd45f335819f08af2b525dd
import torch import torchvision from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data def decimate(tensor, m): """ Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value. This is used when we conve...
ComprehensionLayer_step1
# 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 ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super(ScaledDotProductAttention, self).__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
luyu-fan/LRCM
ComprehensionLayer_step1
false
7,170
[ "MIT" ]
1
6b0e4d7998bc4969afa764eb753077e3f858f1ba
https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba
import math import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()[-1] dim = query.size()...
PyramidUp
# 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 from torch.nn import functional as F class PyramidUp(nn.Module): def __init__(self) ->None: super(PyramidUp, self).__init__() self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 4], [1, 4...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
masanorihirano/pytorch_extra_mhirano
PyramidUp
false
7,171
[ "MIT" ]
1
d19e07445567c069793b7ca1a22a846d7cbce58d
https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self) ->None: super().__init__() self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 4], [1, 4, 6, 4, ...
ComprehensionLayer_step2
# 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 ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super(ScaledDotProductAttention, self).__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
luyu-fan/LRCM
ComprehensionLayer_step2
false
7,172
[ "MIT" ]
1
6b0e4d7998bc4969afa764eb753077e3f858f1ba
https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba
import math import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout=0.0): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value): assert query.size()[-1] == key.size()[-1] dim = query.size()...
ClassHead
# 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 ClassHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(ClassHead, self).__init__() self.num_anchors = num_anchors self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 2, kernel_size=(1, 1), stride=1, padding=0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
lurenjia307/RetinaPedestrian_Pytorch
ClassHead
false
7,173
[ "MIT" ]
1
59c4aa50f3ef2ecb1113ad3b9950e8bbbff1206f
https://github.com/lurenjia307/RetinaPedestrian_Pytorch/tree/59c4aa50f3ef2ecb1113ad3b9950e8bbbff1206f
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super().__init__() self.num_anchors = num_anchors self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 2, kernel_size=(1, 1), stride=1, padding=0) self.outp...
LaplacianPyramidLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from typing import Tuple import torch.nn as nn from torch.nn import functional as F class PyramidDown(nn.Module): def __init__(self) ->None: super(PyramidDown, self).__init__() self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn import functional as F assert_size_stride = ...
masanorihirano/pytorch_extra_mhirano
LaplacianPyramidLayer
false
7,174
[ "MIT" ]
1
d19e07445567c069793b7ca1a22a846d7cbce58d
https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d
import torch from typing import Tuple import torch.nn as nn from torch.nn import functional as F class PyramidDown(nn.Module): def __init__(self) ->None: super().__init__() self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 1...
ActorNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class ActorNet(nn.Module): def __init__(self): super(ActorNet, self).__init__() self.fc1 = nn.Linear(4, 20) self.fc2 = nn.Linear(20, 40) self.fc3 = nn.Linear(40, 50) self.fc4 = nn.Linear(50, 30) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
mathildebadoual/RL_power_systems
ActorNet
false
7,175
[ "MIT" ]
1
825e60bad16129e0a0229d15af5110b26e0a1577
https://github.com/mathildebadoual/RL_power_systems/tree/825e60bad16129e0a0229d15af5110b26e0a1577
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 20) self.fc2 = nn.Linear(20, 40) self.fc3 = nn.Linear(40, 50) self.fc4 = nn.Linear(50, 30) self.fc5 = nn.Linear...
MyKernelTorch
# 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 MyKernelTorch(nn.Module): def __init__(self, n_features: 'int'): super().__init__() self.dense1 = nn.Linear(n_features, 20) self.dense2 = nn.Linear(20, 2) def forward(self, x: 'torch.Tensor') ->torch.Tensor: x = nn.ReLU()(self.dense1(x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
maxpark/alibi-detect
MyKernelTorch
false
7,176
[ "Apache-2.0" ]
1
84384297a85764c18537aa1c8699c4ad040cf7cd
https://github.com/maxpark/alibi-detect/tree/84384297a85764c18537aa1c8699c4ad040cf7cd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_features: 'int'): super().__init__() self.dense1 = nn.Linear(n_features, 20) self.dense2 = nn.Linear(20, 2) def forward(self, x: 'torch.Tensor') ->torch.Tensor: x = nn.ReLU()(self.dense1(x)) ...
ResidualConnection
# 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 ResidualConnection(nn.Module): def __init__(self, *layers): super(ResidualConnection, self).__init__() self.layers = nn.Sequential(*layers) def forward(self, input): return (input + self.layers(input)) / 2.0 def get_inputs(): return [tor...
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...
maxkvant/LinearizedNNs
ResidualConnection
false
7,177
[ "Apache-2.0" ]
1
eb0198be70ca55e7463b97a5023d2f6ffe0f8ba6
https://github.com/maxkvant/LinearizedNNs/tree/eb0198be70ca55e7463b97a5023d2f6ffe0f8ba6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, *layers): super().__init__() self.layers = nn.Sequential(*layers) def forward(self, input): return (input + self.layers(input)) / 2.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
NormalizeImages
# 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 NormalizeImages(nn.Module): def __init__(self): super().__init__() def forward(self, x): flat = x.view(x.size(0), -1) mp = torch.mean(flat, dim=1) sp = torch.std(flat, dim=1) + 1e-07 return (x - mp.detach().unsqueeze(-1).unsque...
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_...
matteo-ronchetti/IKA
NormalizeImages
false
7,178
[ "MIT" ]
1
29d1752a059c3ab7659b332b72bf8c1506e7dd20
https://github.com/matteo-ronchetti/IKA/tree/29d1752a059c3ab7659b332b72bf8c1506e7dd20
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): flat = x.view(x.size(0), -1) mp = torch.mean(flat, dim=1) sp = torch.std(flat, dim=1) + 1e-07 return (x - mp.detach().unsqueeze(-1).unsqueeze(-1).un...
SoftmaxAttention
# 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 masked_softmax(tensor, mask): """ Apply a masked softmax on the last dimension of a tensor. The input tensor and mask should be of size (batch, *, sequence_length). Args: tensor: The tensor on which the softmax function must be applied along ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
marvosyntactical/fs2018ex3viz
SoftmaxAttention
false
7,179
[ "Apache-2.0" ]
1
9002133a45b52c596efa91d842f691fe1f066a6c
https://github.com/marvosyntactical/fs2018ex3viz/tree/9002133a45b52c596efa91d842f691fe1f066a6c
import torch import torch.nn as nn def masked_softmax(tensor, mask): """ Apply a masked softmax on the last dimension of a tensor. The input tensor and mask should be of size (batch, *, sequence_length). Args: tensor: The tensor on which the softmax function must be applied along ...
_leaky_relu
# 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 _leaky_relu(nn.Module): def __init__(self): super(_leaky_relu, self).__init__() def forward(self, x): x_neg = 0.1 * x return torch.max(x_neg, x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
maxuanquang/SfmLearner-Redesign
_leaky_relu
false
7,180
[ "MIT" ]
1
0250a9cc443b5754ba45f69153a03ca26f903a7b
https://github.com/maxuanquang/SfmLearner-Redesign/tree/0250a9cc443b5754ba45f69153a03ca26f903a7b
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): x_neg = 0.1 * x return torch.max(x_neg, x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
CriticNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class CriticNet(nn.Module): def __init__(self): super(CriticNet, self).__init__() self.fc1 = nn.Linear(4, 20) self.fc2 = nn.Linear(20, 40) self.fc3 = nn.Linear(40, 30) self.fc4 = nn.Linear(30, 8) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
mathildebadoual/RL_power_systems
CriticNet
false
7,181
[ "MIT" ]
1
825e60bad16129e0a0229d15af5110b26e0a1577
https://github.com/mathildebadoual/RL_power_systems/tree/825e60bad16129e0a0229d15af5110b26e0a1577
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 20) self.fc2 = nn.Linear(20, 40) self.fc3 = nn.Linear(40, 30) self.fc4 = nn.Linear(30, 8) self.fc5 = nn.Linear(...
ZeroConv2d
# 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 from torch.nn import functional as F class ZeroConv2d(nn.Module): def __init__(self, in_channel, out_channel, padding=1): super().__init__() self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0) self.conv.weight.data.zero_() self.conv.bias....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
mbaddar1/glow-pytorch
ZeroConv2d
false
7,182
[ "MIT" ]
1
e07ca542ce4dd93ddf680c51eda25d1f9db252a1
https://github.com/mbaddar1/glow-pytorch/tree/e07ca542ce4dd93ddf680c51eda25d1f9db252a1
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channel, out_channel, padding=1): super().__init__() self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0) self.conv.weight.data.zero_() self.conv.bias.data....
BasicGraphConvolutionLayer
# 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.nn.parameter import Parameter class BasicGraphConvolutionLayer(torch.nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.W2 = Parameter(torch.rand((in_channels, o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.g...
mbrukman/machine-learning-book
BasicGraphConvolutionLayer
false
7,183
[ "MIT" ]
1
f29a0f8aafa63a77081f3bcec68866e33dd41776
https://github.com/mbrukman/machine-learning-book/tree/f29a0f8aafa63a77081f3bcec68866e33dd41776
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.W2 = Parameter(torch.rand((in_channels, out_channels), dtype= ...
InvConv2d
# 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 from torch.nn import functional as F class InvConv2d(nn.Module): def __init__(self, in_channel): super().__init__() weight = torch.randn(in_channel, in_channel) q, _ = torch.qr(weight) weight = q.unsqueeze(2).unsqueeze(3) self.weight = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn import functional as F assert_size_stride = t...
mbaddar1/glow-pytorch
InvConv2d
false
7,184
[ "MIT" ]
1
e07ca542ce4dd93ddf680c51eda25d1f9db252a1
https://github.com/mbaddar1/glow-pytorch/tree/e07ca542ce4dd93ddf680c51eda25d1f9db252a1
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channel): super().__init__() weight = torch.randn(in_channel, in_channel) q, _ = torch.qr(weight) weight = q.unsqueeze(2).unsqueeze(3) self.weight = nn.Para...
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 torch.optim.lr_scheduler import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, d_model, attention_dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temper = d_model ** 0.5 self.dropout = nn.Dropout(attention_dropout) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mcoavoux/self-attentive-parser
ScaledDotProductAttention
false
7,185
[ "MIT" ]
1
fa5814ecfdbf4fde329ea725e1d2ddaa55f247d6
https://github.com/mcoavoux/self-attentive-parser/tree/fa5814ecfdbf4fde329ea725e1d2ddaa55f247d6
import torch import torch.optim.lr_scheduler import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, attention_dropout=0.1): super().__init__() self.temper = d_model ** 0.5 self.dropout = nn.Dropout(attention_dropout) self.softmax = nn.Softmax(dim=-1) def fo...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.multiprocessing from torch import nn from torch.nn import functional as F import torch.optim import torch.utils.data import torch.distributed class LayerNorm(nn.Module): def __init__(self, channels: 'int', eps: 'float'=1e-05): super().__init__() self.channels = channels ...
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.multiprocessing from torch import nn import torch.optim import tor...
mbarnig/vits-train
LayerNorm
false
7,186
[ "MIT" ]
1
cfb8a0fc91daad868fe3d062ebf85d62edbd7506
https://github.com/mbarnig/vits-train/tree/cfb8a0fc91daad868fe3d062ebf85d62edbd7506
import torch import torch.multiprocessing from torch import nn from torch.nn import functional as F import torch.optim import torch.utils.data import torch.distributed class Model(nn.Module): def __init__(self, channels: 'int', eps: 'float'=1e-05): super().__init__() self.channels = channels ...
AvgPoolShortening
# 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 import nn import torch.utils.data import torch.nn.functional import torch.autograd class AvgPoolShortening(Module): """ ### Average pool shortening This down-samples by a given factor with average pooling """ def __init__(self, k: 'int'): ...
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.nn import Module from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd assert_size_stride...
mcx/annotated_deep_learning_paper_implementations
AvgPoolShortening
false
7,187
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ### Average pool shortening This down-samples by a given factor with average pooling """ def __init__(self, k: 'int'): """ ...
AttentionNet
# 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.functional def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activation = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
lvxiuwang/ferattention
AttentionNet
false
7,188
[ "MIT" ]
1
02e97df4a12129ed6706bddf0d2109650eae8765
https://github.com/lvxiuwang/ferattention/tree/02e97df4a12129ed6706bddf0d2109650eae8765
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activation = n...
MaxPool3x3
# 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.data class MaxPool3x3(nn.Module): """3x3 max pool with no subsampling.""" def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super(MaxPool3x3, self).__init__() self.maxpool = nn.MaxPool2d(kernel_size...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
mc-nya/unnas
MaxPool3x3
false
7,189
[ "MIT" ]
1
f778bb743144cf56ce2a48ccca20e9f3a97a7b84
https://github.com/mc-nya/unnas/tree/f778bb743144cf56ce2a48ccca20e9f3a97a7b84
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """3x3 max pool with no subsampling.""" def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super().__init__() self.maxpool = nn.MaxPool2d(kernel_size, stride, padding) ...
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 math import torch import typing import torch.multiprocessing from torch import nn from torch.nn import functional as F import torch.optim import torch.utils.data import torch.distributed class MultiHeadAttention(nn.Module): def __init__(self, channels: 'int', out_channels: 'int', n_heads: 'int', p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mbarnig/vits-train
MultiHeadAttention
false
7,190
[ "MIT" ]
1
cfb8a0fc91daad868fe3d062ebf85d62edbd7506
https://github.com/mbarnig/vits-train/tree/cfb8a0fc91daad868fe3d062ebf85d62edbd7506
import math import torch import typing import torch.multiprocessing from torch import nn from torch.nn import functional as F import torch.optim import torch.utils.data import torch.distributed class Model(nn.Module): def __init__(self, channels: 'int', out_channels: 'int', n_heads: 'int', p_dropout: 'fl...
ChannelNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class ChannelNorm(Module): """ ## Channel Normalization This is similar to [Group Normalization](../group_norm/index.html) but affine transform is done group wise. ""...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module from torch import nn import torch.utils.data import...
mcx/annotated_deep_learning_paper_implementations
ChannelNorm
false
7,191
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Channel Normalization This is similar to [Group Normalization](../group_norm/index.html) but affine transform is done group wise. """ ...
NodeNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch.nn.parameter import Parameter def global_sum_pool(X, batch_mat): if batch_mat is None or batch_mat.dim() == 1: return torch.sum(X, dim=0).unsqueeze(0) else: return torch.mm(batch_mat, X) class BasicGraphConvolutionLayer(torch.nn.Module)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
mbrukman/machine-learning-book
NodeNetwork
false
7,192
[ "MIT" ]
1
f29a0f8aafa63a77081f3bcec68866e33dd41776
https://github.com/mbrukman/machine-learning-book/tree/f29a0f8aafa63a77081f3bcec68866e33dd41776
import torch import torch.nn.functional as F from torch.nn.parameter import Parameter def global_sum_pool(X, batch_mat): if batch_mat is None or batch_mat.dim() == 1: return torch.sum(X, dim=0).unsqueeze(0) else: return torch.mm(batch_mat, X) class BasicGraphConvolutionLayer(torch.nn.Module)...
FFN
# 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 typing import torch.multiprocessing from torch import nn from torch.nn import functional as F import torch.optim import torch.utils.data import torch.distributed class FFN(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', filter_channels: 'int', kernel_size: '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 typing import torch.mu...
mbarnig/vits-train
FFN
false
7,193
[ "MIT" ]
1
cfb8a0fc91daad868fe3d062ebf85d62edbd7506
https://github.com/mbarnig/vits-train/tree/cfb8a0fc91daad868fe3d062ebf85d62edbd7506
import torch import typing import torch.multiprocessing from torch import nn from torch.nn import functional as F import torch.optim import torch.utils.data import torch.distributed class Model(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', filter_channels: 'int', kernel_size: 'i...
DiscriminatorLoss
# 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.nn.functional as F import torch.utils.data import torch.nn.functional import torch.autograd class DiscriminatorLoss(Module): """ ## Discriminator Loss We want to find $w$ to maximize $$\\mathbb{E}_{x \\sim \\mathbb{P}_r} [f_w(x)]- \\mathbb{E}_{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 import triton_helpers from torch.nn import Module import torch.utils.data import torch.nn.functional import tor...
mcx/annotated_deep_learning_paper_implementations
DiscriminatorLoss
false
7,194
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.nn.functional as F import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Discriminator Loss We want to find $w$ to maximize $$\\mathbb{E}_{x \\sim \\mathbb{P}_r} [f_w(x)]- \\mathbb{E}_{z \\sim p(z)} [...
Model
# 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 Model(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(Model, self).__init__() self.layer1 = nn.Linear(input_size, hidden_size) self.layer2 = nn.Linear(hidden_size, output_size) def forward(self, x): x = 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....
mbrukman/machine-learning-book
Model
false
7,195
[ "MIT" ]
1
f29a0f8aafa63a77081f3bcec68866e33dd41776
https://github.com/mbrukman/machine-learning-book/tree/f29a0f8aafa63a77081f3bcec68866e33dd41776
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(Model, self).__init__() self.layer1 = nn.Linear(input_size, hidden_size) self.layer2 = nn.Linear(hidden_size, output_size) def forward(self, x): x = self...
ClippedValueFunctionLoss
# 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 import torch.nn.functional import torch.autograd class ClippedValueFunctionLoss(Module): """ ## Clipped Value Function Loss Similarly we clip the value function update also. egin{align} V^{\\pi_ heta}_{CLIP}(s_t) &= clip\\Big...
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 import torch.nn.functional import tor...
mcx/annotated_deep_learning_paper_implementations
ClippedValueFunctionLoss
false
7,196
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Clipped Value Function Loss Similarly we clip the value function update also. egin{align} V^{\\pi_ heta}_{CLIP}(s_t) &= clip\\Bigl(V^{\\pi_ heta}(s_...
CrossEntropyBayesRisk
# 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 import torch.nn.functional import torch.autograd class CrossEntropyBayesRisk(Module): """ <a id="CrossEntropyBayesRisk"></a> ## Bayes Risk with Cross Entropy Loss Bayes risk is the overall maximum cost of making incorrect estimates. ...
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.nn import Module import torch.utils.data import torch.nn.functional import torch.autograd assert_size_stride = torch._C._dynamo.g...
mcx/annotated_deep_learning_paper_implementations
CrossEntropyBayesRisk
false
7,197
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ <a id="CrossEntropyBayesRisk"></a> ## Bayes Risk with Cross Entropy Loss Bayes risk is the overall maximum cost of making incorrect estimates. It takes a cos...
DPFP
# 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 import nn import torch.utils.data import torch.nn.functional import torch.autograd class DPFP(Module): """ ## Deterministic Parameter Free Project (DPFP) This is the new projection function $ extcolor{lightgreen}{\\phi}$ introduced in the paper. DPF...
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 from torch import nn import torch.utils.data import torch.nn....
mcx/annotated_deep_learning_paper_implementations
DPFP
false
7,198
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Deterministic Parameter Free Project (DPFP) This is the new projection function $ extcolor{lightgreen}{\\phi}$ introduced in the paper. DP...
KLDivLoss
# 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 import torch.nn.functional import torch.autograd class KLDivLoss(Module): """ ## KL-Divergence loss This calculates the KL divergence between a given normal distribution and $\\mathcal{N}(0, 1)$ """ def forward(self, sigma_hat: 'to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import M...
mcx/annotated_deep_learning_paper_implementations
KLDivLoss
false
7,199
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## KL-Divergence loss This calculates the KL divergence between a given normal distribution and $\\mathcal{N}(0, 1)$ """ def forward(self, sigma_hat: 'torch....
MaximumLikelihoodLoss
# 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 import torch.nn.functional import torch.autograd class MaximumLikelihoodLoss(Module): """ <a id="MaximumLikelihoodLoss"></a> ## Type II Maximum Likelihood Loss The distribution $D(\\mathbf{p} ert extcolor{orange}{\\mathbf{lpha}})$ i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module import torch.utils.data import torch.nn.funct...
mcx/annotated_deep_learning_paper_implementations
MaximumLikelihoodLoss
false
7,200
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ <a id="MaximumLikelihoodLoss"></a> ## Type II Maximum Likelihood Loss The distribution $D(\\mathbf{p} ert extcolor{orange}{\\mathbf{lpha}})$ is a prior on the...
FCVAE
# 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.nn import functional as F from torch import nn class BaseVAE(nn.Module): """ Base abstract class for the Variational Autoencoders """ def __init__(self, channels=1, width=28, height=28, z_dim=2): """ Constructor Parameters: channels - The n...
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...
mbusy/vae
FCVAE
false
7,201
[ "MIT" ]
1
455e382a557b72fc944460331e5dd010ff83a76a
https://github.com/mbusy/vae/tree/455e382a557b72fc944460331e5dd010ff83a76a
import torch from torch.nn import functional as F from torch import nn class BaseVAE(nn.Module): """ Base abstract class for the Variational Autoencoders """ def __init__(self, channels=1, width=28, height=28, z_dim=2): """ Constructor Parameters: channels - The n...
PatchEmbeddings
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class PatchEmbeddings(Module): """ <a id="PatchEmbeddings"></a> ## Get patch embeddings The paper splits the image into patches of equal size and do a linear transfo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import nn import torch.utils.data import ...
mcx/annotated_deep_learning_paper_implementations
PatchEmbeddings
false
7,202
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ <a id="PatchEmbeddings"></a> ## Get patch embeddings The paper splits the image into patches of equal size and do a linear transformation ...
LearnedPositionalEmbeddings
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class LearnedPositionalEmbeddings(Module): """ <a id="LearnedPositionalEmbeddings"></a> ## Add parameterized positional encodings This adds learned positional embedd...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd assert_size_stride...
mcx/annotated_deep_learning_paper_implementations
LearnedPositionalEmbeddings
false
7,203
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ <a id="LearnedPositionalEmbeddings"></a> ## Add parameterized positional encodings This adds learned positional embeddings to patch embeddin...
LSTMCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class LSTMCell(Module): """ ## Long Short-Term Memory Cell LSTM Cell computes $c$, and $h$. $c$ is like the long-term memory, and $h$ is like the short term memory. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn impor...
mcx/annotated_deep_learning_paper_implementations
LSTMCell
false
7,204
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Long Short-Term Memory Cell LSTM Cell computes $c$, and $h$. $c$ is like the long-term memory, and $h$ is like the short term memory. ...
SquaredReLU
# 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 import nn import torch.utils.data import torch.nn.functional import torch.autograd class SquaredReLU(Module): """ ## Squared ReLU activation $$y = {\\max(x, 0)}^2$$ Squared ReLU is used as the activation function in the [position wise feedforw...
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 from torch import nn import torch.utils.data import torch.nn....
mcx/annotated_deep_learning_paper_implementations
SquaredReLU
false
7,205
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Squared ReLU activation $$y = {\\max(x, 0)}^2$$ Squared ReLU is used as the activation function in the [position wise feedforward mo...
MarginLoss
# 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.nn.functional as F import torch.utils.data import torch.nn.functional import torch.autograd class MarginLoss(Module): '\n ## Margin loss for class existence\n\n A separate margin loss is used for each output capsule and the total loss is the sum of them....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module ...
mcx/annotated_deep_learning_paper_implementations
MarginLoss
false
7,206
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.nn.functional as F import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): '\n ## Margin loss for class existence\n\n A separate margin loss is used for each output capsule and the total loss is the sum of them.\n ...
Squash
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Squash(Module): '\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2}{1 + {\\lVert \\math...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module import torch.utils.data import torch.nn.functional ...
mcx/annotated_deep_learning_paper_implementations
Squash
false
7,207
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): '\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2}{1 + {\\lVert \\mathb...
FeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class FeedForward(nn.Module): """ ### Position-wise Feed Forward Layer $ ext{F\\small{FW}}$ This consists of two linear layers and an activation in the middle. """ def __init__(self, d_mode...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mcx/annotated_deep_learning_paper_implementations
FeedForward
false
7,208
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(nn.Module): """ ### Position-wise Feed Forward Layer $ ext{F\\small{FW}}$ This consists of two linear layers and an activation in the middle. """ def __init__(self, d_model: 'in...
BehaviorClone
# 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 BehaviorClone(nn.Module): def __init__(self, input_shape, output_shape): super(BehaviorClone, self).__init__() self.input_shape = input_shape self.output_shape = output_shape self.fc1 = nn.Linear(input_shape,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
mdiephuis/Berkeley-cs294-112
BehaviorClone
false
7,209
[ "MIT" ]
1
99559e046b635ca8d229f19ca4ad45c2c02a1c01
https://github.com/mdiephuis/Berkeley-cs294-112/tree/99559e046b635ca8d229f19ca4ad45c2c02a1c01
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_shape, output_shape): super().__init__() self.input_shape = input_shape self.output_shape = output_shape self.fc1 = nn.Linear(input_shape, input_shape // 2) ...
SpatialDepthWiseConvolution
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class SpatialDepthWiseConvolution(Module): """ ## Spatial Depth Wise Convolution This is actually slower """ def __init__(self, d_k: 'int', kernel_si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import math from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd assert...
mcx/annotated_deep_learning_paper_implementations
SpatialDepthWiseConvolution
false
7,210
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import math import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Spatial Depth Wise Convolution This is actually slower """ def __init__(self, d_k: 'int', kernel_size: 'int'=3): ...
KLDivergenceLoss
# 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 import torch.nn.functional import torch.autograd class KLDivergenceLoss(Module): """ <a id="KLDivergenceLoss"></a> ## KL Divergence Regularization Loss This tries to shrink the total evidence to zero if the sample cannot be correctly c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module import torch.utils.data import torch.nn.functional ...
mcx/annotated_deep_learning_paper_implementations
KLDivergenceLoss
false
7,211
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ <a id="KLDivergenceLoss"></a> ## KL Divergence Regularization Loss This tries to shrink the total evidence to zero if the sample cannot be correctly classified. ...
SpatialDepthWisePerHeadConvolution
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class SpatialDepthWisePerHeadConvolution(Module): """ ## Spatial Depth Wise Per Head Convolution """ def __init__(self, heads: 'int', d_k: 'int', kernel_size: 'int'=3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import nn import torch.utils.data import ...
mcx/annotated_deep_learning_paper_implementations
SpatialDepthWisePerHeadConvolution
false
7,212
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Spatial Depth Wise Per Head Convolution """ def __init__(self, heads: 'int', d_k: 'int', kernel_size: 'int'=3): """ * `hea...
SpatialDepthWiseSharedConvolution
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class SpatialDepthWiseSharedConvolution(Module): """ ## Spatial Depth Wise Shared Convolution We share the same kernel across all channels. """ def __init__(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.nn import Module from torch import nn import torch.utils.data import ...
mcx/annotated_deep_learning_paper_implementations
SpatialDepthWiseSharedConvolution
false
7,213
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ ## Spatial Depth Wise Shared Convolution We share the same kernel across all channels. """ def __init__(self, kernel_size: 'int'=3): ...
SquaredErrorBayesRisk
# 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 import torch.nn.functional import torch.autograd class SquaredErrorBayesRisk(Module): """ <a id="SquaredErrorBayesRisk"></a> ## Bayes Risk with Squared Error Loss Here the cost function is squared error, $$\\sum_{k=1}^K (y_k - p_k)...
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.nn import Module import torch.utils.data import torch.nn.functional import torch.autograd assert_size_stride = torch._C._dynamo.g...
mcx/annotated_deep_learning_paper_implementations
SquaredErrorBayesRisk
false
7,214
[ "MIT" ]
1
f169f3a71dd2d36eb28ad31062d3475efa367b88
https://github.com/mcx/annotated_deep_learning_paper_implementations/tree/f169f3a71dd2d36eb28ad31062d3475efa367b88
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class Model(Module): """ <a id="SquaredErrorBayesRisk"></a> ## Bayes Risk with Squared Error Loss Here the cost function is squared error, $$\\sum_{k=1}^K (y_k - p_k)^2 = \\Vert \\ma...
MNIST_Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class MNIST_Discriminator(nn.Module): def __init__(self, latent_size): super(MNIST_Discriminator, self).__init__() self.latent_size = latent_size self.linear1 = nn.Linear(self.latent_size, self.latent_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
mdiephuis/adversarial-autoencoders
MNIST_Discriminator
false
7,215
[ "MIT" ]
1
a722239564362796774de21a64fd92e81dce4089
https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, latent_size): super().__init__() self.latent_size = latent_size self.linear1 = nn.Linear(self.latent_size, self.latent_size // 2) self.linear2 = nn.Linear(self.latent...
MNIST_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 from torch.nn import functional as F class MNIST_Encoder(nn.Module): def __init__(self, in_channels, latent_size): super(MNIST_Encoder, self).__init__() self.in_channels = in_channels self.latent_size = latent_size self.linear1 = nn.Linear(self.i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
mdiephuis/adversarial-autoencoders
MNIST_Encoder
false
7,216
[ "MIT" ]
1
a722239564362796774de21a64fd92e81dce4089
https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channels, latent_size): super().__init__() self.in_channels = in_channels self.latent_size = latent_size self.linear1 = nn.Linear(self.in_channels, self.latent_siz...
MNIST_Generator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class MNIST_Generator(nn.Module): def __init__(self, out_channels, latent_size): super(MNIST_Generator, self).__init__() self.out_channels = out_channels self.latent_size = latent_size 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
mdiephuis/adversarial-autoencoders
MNIST_Generator
false
7,217
[ "MIT" ]
1
a722239564362796774de21a64fd92e81dce4089
https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, out_channels, latent_size): super().__init__() self.out_channels = out_channels self.latent_size = latent_size self.linear1 = nn.Linear(self.latent_size, self.out_cha...
Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class Discriminator(nn.Module): def __init__(self, latent_size, d=128): super(Discriminator, self).__init__() self.latent_size = latent_size self.d = d self.linear1 = nn.Linear(self.latent_size, self.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
mdiephuis/adversarial-autoencoders
Discriminator
false
7,218
[ "MIT" ]
1
a722239564362796774de21a64fd92e81dce4089
https://github.com/mdiephuis/adversarial-autoencoders/tree/a722239564362796774de21a64fd92e81dce4089
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, latent_size, d=128): super().__init__() self.latent_size = latent_size self.d = d self.linear1 = nn.Linear(self.latent_size, self.d) self.linear2 = nn.Linear(...
MemoryEfficientPFLU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.autograd import Function import torch from torch import nn class PFLUFunction(Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) return x * (1 + x / torch.sqrt(1 + x * x)) / 2 @staticmethod def backward(ctx, grad_output): x, = ctx.saved_tensors ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.autograd import Function from torch import nn assert_size_stride = t...
mengzhu0308/PFLU-FPFLU
MemoryEfficientPFLU
false
7,219
[ "Apache-2.0" ]
1
628cd472db2913e555e902bdf35af834f84a284b
https://github.com/mengzhu0308/PFLU-FPFLU/tree/628cd472db2913e555e902bdf35af834f84a284b
from torch.autograd import Function import torch from torch import nn class PFLUFunction(Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) return x * (1 + x / torch.sqrt(1 + x * x)) / 2 @staticmethod def backward(ctx, grad_output): x, = ctx.saved_tensors ...
FPFLU
# 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 FPFLU(nn.Module): def forward(self, x): return torch.maximum(x, x / (1 + x * x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
mengzhu0308/PFLU-FPFLU
FPFLU
false
7,220
[ "Apache-2.0" ]
1
628cd472db2913e555e902bdf35af834f84a284b
https://github.com/mengzhu0308/PFLU-FPFLU/tree/628cd472db2913e555e902bdf35af834f84a284b
import torch from torch import nn class Model(nn.Module): def forward(self, x): return torch.maximum(x, x / (1 + x * x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
WQ
# 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 stats_quant(x, nbit, qmode='symm', dequantize=True): z_typical = {'4bit': [0.077, 1.013], '8bit': [0.027, 1.114]} z = z_typical[f'{int(nbit)}bit'] m = x.abs().mean() std = x.std() if qmode == 'symm': n_lv = 2 ** (nbit - 1) - 1 alpha_w = 1 / 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
mengjian0502/TorchInference_SRAM
WQ
false
7,221
[ "MIT" ]
1
fcc465c73b79f2ab670b6af03aa53f9bb47c64ca
https://github.com/mengjian0502/TorchInference_SRAM/tree/fcc465c73b79f2ab670b6af03aa53f9bb47c64ca
import torch import torch.nn as nn def stats_quant(x, nbit, qmode='symm', dequantize=True): z_typical = {'4bit': [0.077, 1.013], '8bit': [0.027, 1.114]} z = z_typical[f'{int(nbit)}bit'] m = x.abs().mean() std = x.std() if qmode == 'symm': n_lv = 2 ** (nbit - 1) - 1 alpha_w = 1 / z[...
Coxnnet
# 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 class Coxnnet(nn.Module): def __init__(self, nfeat): super(Coxnnet, self).__init__() self.fc1 = nn.Linear(nfeat, int(np.ceil(nfeat ** 0.5))) self.dropout = nn.Dropout(0.5) self.fc2 = nn.Linear(int(np.ceil(nfeat ** 0.5)), 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
menggerSherry/SAVAE-Cox
Coxnnet
false
7,222
[ "Apache-2.0" ]
1
c087ab4f267da28db7eb497c844bea59e65ed125
https://github.com/menggerSherry/SAVAE-Cox/tree/c087ab4f267da28db7eb497c844bea59e65ed125
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, nfeat): super().__init__() self.fc1 = nn.Linear(nfeat, int(np.ceil(nfeat ** 0.5))) self.dropout = nn.Dropout(0.5) self.fc2 = nn.Linear(int(np.ceil(nfeat ** 0.5)), 1) self.init_...
MVNormalNetwork
# 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 MVNormalNetwork(nn.Module): def __init__(self, latent_dim): super().__init__() self.mean = nn.Linear(latent_dim, latent_dim) self.sc = nn.Linear(latent_dim, latent_dim) def forward(self, x): mean = self.mean(x) sc = self.sc(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
mgb45/OC-notebooks
MVNormalNetwork
false
7,223
[ "MIT" ]
1
67b1899d1fb3455ab3caab58f94429b9f432164b
https://github.com/mgb45/OC-notebooks/tree/67b1899d1fb3455ab3caab58f94429b9f432164b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, latent_dim): super().__init__() self.mean = nn.Linear(latent_dim, latent_dim) self.sc = nn.Linear(latent_dim, latent_dim) def forward(self, x): mean = self.mean(x) sc = self.sc(x) re...
Conv1d_samePadding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class Conv1d_samePadding(nn.Conv1d): def __init__(self, *args, padding: int=0, **kwargs): assert padding == 0, "no additional padding on top of 'same' padding" kwargs['padding'] = 0 super().__init__(*args, **kwargs) de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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....
mgrachten/crepe-pytorch
Conv1d_samePadding
false
7,224
[ "MIT" ]
1
94305a78d2d82e414c251d50b63dc021af277c75
https://github.com/mgrachten/crepe-pytorch/tree/94305a78d2d82e414c251d50b63dc021af277c75
import torch from torch import nn import torch.nn.functional as F class Model(nn.Conv1d): def __init__(self, *args, padding: int=0, **kwargs): assert padding == 0, "no additional padding on top of 'same' padding" kwargs['padding'] = 0 super().__init__(*args, **kwargs) def same_paddin...
NALUCell
# 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 from torch.nn import init from torch.nn.parameter import Parameter class NeuralAccumulatorCell(nn.Module): """A Neural Accumulator (NAC) cell [1]. Attributes: in_dim: size of the input sample. out_dim: size of the ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
mikomel/machine-number-sense
NALUCell
false
7,225
[ "MIT" ]
1
173b67e4f25bd8249ba4a41904d4cd4af26bae05
https://github.com/mikomel/machine-number-sense/tree/173b67e4f25bd8249ba4a41904d4cd4af26bae05
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init from torch.nn.parameter import Parameter class NeuralAccumulatorCell(nn.Module): """A Neural Accumulator (NAC) cell [1]. Attributes: in_dim: size of the input sample. out_dim: size of the ...
MHAttention
# 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 MHAttention(nn.Module): def __init__(self, ninp, nhead, dropout): super(MHAttention, self).__init__() if ninp % nhead != 0: raise ValueError( 'The hidden size is not a multiple of the n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
microsoft/Protein-Folding
MHAttention
false
7,226
[ "MIT" ]
1
f534b2dd1e3f192fbcdadf234f25828c7f458a58
https://github.com/microsoft/Protein-Folding/tree/f534b2dd1e3f192fbcdadf234f25828c7f458a58
import math import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, ninp, nhead, dropout): super().__init__() if ninp % nhead != 0: raise ValueError( 'The hidden size is not a multiple of the number of attention head...
FeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class FeedForward(nn.Module): def __init__(self, ninp, dim_feedforward, dropout): super(FeedForward, self).__init__() self.linear1 = nn.Linear(ninp, dim_feedforward) self.dropout = nn.Dropout(dropout) self.linear2 = nn.Linear(dim_feedforward, ninp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
microsoft/Protein-Folding
FeedForward
false
7,227
[ "MIT" ]
1
f534b2dd1e3f192fbcdadf234f25828c7f458a58
https://github.com/microsoft/Protein-Folding/tree/f534b2dd1e3f192fbcdadf234f25828c7f458a58
import torch from torch import nn class Model(nn.Module): def __init__(self, ninp, dim_feedforward, dropout): super().__init__() self.linear1 = nn.Linear(ninp, dim_feedforward) self.dropout = nn.Dropout(dropout) self.linear2 = nn.Linear(dim_feedforward, ninp) self.norm1 = ...
NeuralAccumulatorCell
# 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 torch.nn import init from torch.nn.parameter import Parameter class NeuralAccumulatorCell(nn.Module): """A Neural Accumulator (NAC) cell [1]. Attributes: in_dim: size of the input sample. out_dim: size of the output sampl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
mikomel/machine-number-sense
NeuralAccumulatorCell
false
7,228
[ "MIT" ]
1
173b67e4f25bd8249ba4a41904d4cd4af26bae05
https://github.com/mikomel/machine-number-sense/tree/173b67e4f25bd8249ba4a41904d4cd4af26bae05
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init from torch.nn.parameter import Parameter class Model(nn.Module): """A Neural Accumulator (NAC) cell [1]. Attributes: in_dim: size of the input sample. out_dim: size of the output sample. Sources:...
Conv3x3
# 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 Conv3x3(nn.Module): """Layer to pad and convolve input """ def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
minjabenho/image2pcl
Conv3x3
false
7,229
[ "Apache-2.0" ]
1
7e696ee48edae30814d32f32e605ad6cf8bf702c
https://github.com/minjabenho/image2pcl/tree/7e696ee48edae30814d32f32e605ad6cf8bf702c
import torch import torch.nn as nn class Model(nn.Module): """Layer to pad and convolve input """ def __init__(self, in_channels, out_channels, use_refl=True): super().__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1)...
fadein_layer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.utils.data class fadein_layer(nn.Module): def __init__(self, config): super(fadein_layer, self).__init__() self.alpha = 0.0 def update_alpha(self, delta): self.alpha = self.alpha + delta ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
mingo-x/pggan-pytorch
fadein_layer
false
7,230
[ "MIT" ]
1
a1dde73cd4df52476fe7c948d81fa9caea8070a5
https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, config): super().__init__() self.alpha = 0.0 def update_alpha(self, delta): self.alpha = self.alpha + delta self.alpha = max(0, ...
pixelwise_norm_layer
# 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.data class pixelwise_norm_layer(nn.Module): def __init__(self): super(pixelwise_norm_layer, self).__init__() self.eps = 1e-08 def forward(self, x): return x / (torch.mean(x ** 2, dim=1, keepdim=True) + self.eps) ** 0.5 def get_i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dy...
mingo-x/pggan-pytorch
pixelwise_norm_layer
false
7,231
[ "MIT" ]
1
a1dde73cd4df52476fe7c948d81fa9caea8070a5
https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.eps = 1e-08 def forward(self, x): return x / (torch.mean(x ** 2, dim=1, keepdim=True) + self.eps) ** 0.5 def get_inputs(): return [torch.rand([4, 4, 4,...
equalized_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 from torch.nn.init import normal import torch.utils.data def _calculate_fan_in_and_fan_out(tensor): dimensions = tensor.ndimension() if dimensions < 2: raise ValueError( 'Fan in and fan out can not be computed for tensor with less than 2 dimensions' ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.init import normal import torch.utils.data a...
mingo-x/pggan-pytorch
equalized_conv2d
false
7,232
[ "MIT" ]
1
a1dde73cd4df52476fe7c948d81fa9caea8070a5
https://github.com/mingo-x/pggan-pytorch/tree/a1dde73cd4df52476fe7c948d81fa9caea8070a5
import torch import torch.nn as nn from torch.nn.init import normal import torch.utils.data def _calculate_fan_in_and_fan_out(tensor): dimensions = tensor.ndimension() if dimensions < 2: raise ValueError( 'Fan in and fan out can not be computed for tensor with less than 2 dimensions' ...