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
Accuracy
# 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 accuracy(logits, labels, ignore_index: 'int'=-100): with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_mask return correct.sum().float() / valid_mask.sum(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
StephanHeijl/tape
Accuracy
false
2,865
[ "BSD-3-Clause" ]
0
ec631ca53217686605477cf31af4fb8846ff660f
https://github.com/StephanHeijl/tape/tree/ec631ca53217686605477cf31af4fb8846ff660f
import torch import torch.nn as nn def accuracy(logits, labels, ignore_index: 'int'=-100): with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_mask return correct.sum().float() / valid_mask.sum(...
TemporalAttention
# 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 TemporalAttention(nn.Module): """ Temporal attention module from https://dl.acm.org/doi/abs/10.1145/3448083 """ def __init__(self, hidden_dim): super(TemporalAttention, self).__init__() self.fc = nn.Linear(hidden_dim, 1) self.sm = torch....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
STRCSussex-UbiCompSiegen/dl_har_model
TemporalAttention
false
2,866
[ "MIT" ]
0
caac0f87fc7dd08a5d6ad3e4455ee25b35f5e7b4
https://github.com/STRCSussex-UbiCompSiegen/dl_har_model/tree/caac0f87fc7dd08a5d6ad3e4455ee25b35f5e7b4
import torch from torch import nn class Model(nn.Module): """ Temporal attention module from https://dl.acm.org/doi/abs/10.1145/3448083 """ def __init__(self, hidden_dim): super().__init__() self.fc = nn.Linear(hidden_dim, 1) self.sm = torch.nn.Softmax(dim=0) def forward(...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import Parameter class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-08, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: ...
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 from torch.nn import Parameter assert_size_stride = torch...
Sheroa/Video_Colorization
LayerNorm
false
2,867
[ "MIT" ]
0
5c772ac0ec944814cd8be0a94b0746116b11ac01
https://github.com/Sheroa/Video_Colorization/tree/5c772ac0ec944814cd8be0a94b0746116b11ac01
import torch import torch.nn as nn from torch.nn import Parameter class Model(nn.Module): def __init__(self, num_features, eps=1e-08, affine=True): super().__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamm...
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 from math import * from copy import * class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from ma...
Sup3Legacy/TIPE
Net
false
2,868
[ "BSD-3-Clause" ]
0
7e01cef869183c4d609c45d5fcf0bb371a9579f5
https://github.com/Sup3Legacy/TIPE/tree/7e01cef869183c4d609c45d5fcf0bb371a9579f5
import torch import torch.nn as nn import torch.nn.functional as F from math import * from copy import * class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 ...
ReidModel
# 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 ReidModel(nn.Module): def __init__(self, num_features_in, num_anchors=1, num_classes=80, prior=0.01, feature_size=256): super(ReidModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors self.conv1 = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
SajjadPSavoji/CTracker
ReidModel
false
2,869
[ "MIT" ]
0
f345925cccca13d045dea5d435ba3d463df7729a
https://github.com/SajjadPSavoji/CTracker/tree/f345925cccca13d045dea5d435ba3d463df7729a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features_in, num_anchors=1, num_classes=80, prior=0.01, feature_size=256): super().__init__() self.num_classes = num_classes self.num_anchors = num_anchors self.conv1 = nn.Conv2d(num_features...
ConcatConv2d
# 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 ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() module = nn.ConvTranspose2d if transpose else nn.Conv2d self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Teemo341/BDNN
ConcatConv2d
false
2,870
[ "Apache-2.0" ]
0
d53d4634a7a43d038faa049d7dfd10b3578ae267
https://github.com/Teemo341/BDNN/tree/d53d4634a7a43d038faa049d7dfd10b3578ae267
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super().__init__() module = nn.ConvTranspose2d if transpose else nn.Conv2d self._layer = module(dim_in + ...
QNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): """ Actor Policy (Q Network) model """ def __init__(self, state_size, action_size, seed, fc1_units=512, fc2_units=256, fc3_units=64): """Initialize parameters and build model. Params ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Sushil-Thapa/ud-deep-reinforcement-learning
QNetwork
false
2,871
[ "MIT" ]
0
847873d771550aa7f502fa34e918d33ccc545608
https://github.com/Sushil-Thapa/ud-deep-reinforcement-learning/tree/847873d771550aa7f502fa34e918d33ccc545608
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ Actor Policy (Q Network) model """ def __init__(self, state_size, action_size, seed, fc1_units=512, fc2_units=256, fc3_units=64): """Initialize parameters and build model. Params ==...
OutlookAttention
# 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 import torch.nn.parallel class OutlookAttention(nn.Module): """ Implementation of outlook attention --dim: hidden dim --num_heads: number of heads --kernel_size: kernel size in each window for outlook attention 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 torch._inductor.runtime....
QLSong/cv-classify
OutlookAttention
false
2,872
[ "Apache-2.0" ]
0
02f53d03868f299a08b5c97a266b50a7fdcd3f2b
https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """ Implementation of outlook attention --dim: hidden dim --num_heads: number of heads --kernel_size: kernel size in each window for outlook attention return: token f...
MLPBlock
# 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 MLPBlock(nn.Module): def __init__(self, in_features, out_features, bias=True, layer_norm= True, dropout=0.3, activation=nn.ReLU): super().__init__() self.linear = nn.Linear(in_features, out_features, bias) self.activation = activation() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
THinnerichs/deepgozero
MLPBlock
false
2,873
[ "BSD-3-Clause" ]
0
5f1481c41f879f7ec1b5eea22dcccdb8bf8825e2
https://github.com/THinnerichs/deepgozero/tree/5f1481c41f879f7ec1b5eea22dcccdb8bf8825e2
import torch from torch import nn class Model(nn.Module): def __init__(self, in_features, out_features, bias=True, layer_norm= True, dropout=0.3, activation=nn.ReLU): super().__init__() self.linear = nn.Linear(in_features, out_features, bias) self.activation = activation() ...
CRF
# 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 CRF(nn.Module): """Implements Conditional Random Fields""" def __init__(self, num_tags): super(CRF, self).__init__() self.num_tags = num_tags self.transitions = nn.Parameter(torch.Tensor(num_tags, num_tags)) self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
Syhen/vtou-ner
CRF
false
2,874
[ "MIT" ]
0
708eb3d475fbce91949a7ca3b0bf2631c4feba62
https://github.com/Syhen/vtou-ner/tree/708eb3d475fbce91949a7ca3b0bf2631c4feba62
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """Implements Conditional Random Fields""" def __init__(self, num_tags): super().__init__() self.num_tags = num_tags self.transitions = nn.Parameter(torch.Tensor(num_tags, num_tags)) self.start_...
QuantConv1d
# 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 QuantConv1d(nn.Module): """Quantized 1D Conv""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', **kwargs): super().__init__() self.qconv1d = nn.Conv1d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
TeaPoly/wenet
QuantConv1d
false
2,875
[ "Apache-2.0" ]
0
5681887e338e4c8b2c75ffc283140e11a9d56a6d
https://github.com/TeaPoly/wenet/tree/5681887e338e4c8b2c75ffc283140e11a9d56a6d
import torch from torch import nn class Model(nn.Module): """Quantized 1D Conv""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', **kwargs): super().__init__() self.qconv1d = nn.Conv1d(in_ch...
GumbelSoftmaxLayer
# 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.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch.distributions def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0, training: 'bool'=True, straight_through: 'bool'=False): size = log...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch...
Shawn-Guo-CN/EGG
GumbelSoftmaxLayer
false
2,876
[ "MIT" ]
0
0a5b258108e2cd1c873d7f67e8c92551bb3d809c
https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c
import torch import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch.distributions def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0, training: 'bool'=True, straight_through: 'bool'=False): size = log...
RegressionModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=1, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReL...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
SajjadPSavoji/CTracker
RegressionModel
false
2,877
[ "MIT" ]
0
f345925cccca13d045dea5d435ba3d463df7729a
https://github.com/SajjadPSavoji/CTracker/tree/f345925cccca13d045dea5d435ba3d463df7729a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features_in, num_anchors=1, feature_size=256): super().__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReLU() self.conv2 = nn.Con...
SimpleAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class SimpleAttention(nn.Module): def __init__(self, n_features, n_hidden, key=False, copy=False, query= True, memory=False): super().__init__() self.key = key self.query = query self.memory = 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 import triton_helpers from torch._inductor.runtime....
TahaBinhuraib/lexical
SimpleAttention
false
2,878
[ "MIT" ]
0
0af02590829755f9ae2268fed76ea4b6d38e9b61
https://github.com/TahaBinhuraib/lexical/tree/0af02590829755f9ae2268fed76ea4b6d38e9b61
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, n_features, n_hidden, key=False, copy=False, query= True, memory=False): super().__init__() self.key = key self.query = query self.memory = memory self.n_fe...
ResBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ResBlock(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....
Teemo341/BDNN
ResBlock
false
2,880
[ "Apache-2.0" ]
0
d53d4634a7a43d038faa049d7dfd10b3578ae267
https://github.com/Teemo341/BDNN/tree/d53d4634a7a43d038faa049d7dfd10b3578ae267
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def norm(dim): return nn.GroupNorm(min(32, dim), dim) class Model(nn.Module): exp...
RadialBesselLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn class RadialBesselLayer(nn.Module): """Radial Bessel functions based on the work by DimeNet: https://github.com/klicperajo/dimenet Args: n_radials (int, optional): total number of radial functions, :math:`N_g`. cutoff (float, optional): cut...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.g...
THGLab/NewtonNet
RadialBesselLayer
false
2,881
[ "MIT" ]
0
fcf2af848a1c998bd08096dcefb58a5610eda03c
https://github.com/THGLab/NewtonNet/tree/fcf2af848a1c998bd08096dcefb58a5610eda03c
import torch import numpy as np from torch import nn class Model(nn.Module): """Radial Bessel functions based on the work by DimeNet: https://github.com/klicperajo/dimenet Args: n_radials (int, optional): total number of radial functions, :math:`N_g`. cutoff (float, optional): cutoff, :math:`...
InformedSender
# 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.parallel import torch.utils.data import torch.distributions class InformedSender(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super(InformedSender, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Shawn-Guo-CN/EGG
InformedSender
false
2,882
[ "MIT" ]
0
0a5b258108e2cd1c873d7f67e8c92551bb3d809c
https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class Model(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super().__init__() self.g...
GumbelSoftMax
# 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 from math import sqrt as sqrt from itertools import product as product class _GumbelSoftMax(torch.autograd.Function): """ implementing the MixedOp, but carried out in a different way as DARTS DARTS adds all operations together, then selec...
import torch from torch import device import triton import triton.language as tl from 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_ma...
TayaPenskaya/hair_classifier
GumbelSoftMax
false
2,883
[ "MIT" ]
0
669f42b705a4dd0bdde9d330db5214a3213db5a5
https://github.com/TayaPenskaya/hair_classifier/tree/669f42b705a4dd0bdde9d330db5214a3213db5a5
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt as sqrt from itertools import product as product class _GumbelSoftMax(torch.autograd.Function): """ implementing the MixedOp, but carried out in a different way as DARTS DARTS adds all operations together, then selec...
PositionWiseFFN
# 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 random import * from torch.nn.functional import relu class PositionWiseFFN(nn.Module): def __init__(self, model_dim, dropout=0.0): super().__init__() dff = model_dim * 4 self.l = nn.Linear(model_dim, dff) self.o = nn.Linear(dff, model_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Tensor-Hu/ExampleModel
PositionWiseFFN
false
2,884
[ "MIT" ]
0
fbbedc7e50b34972fe99560305790bea3341427b
https://github.com/Tensor-Hu/ExampleModel/tree/fbbedc7e50b34972fe99560305790bea3341427b
import torch import torch.nn as nn from random import * from torch.nn.functional import relu class Model(nn.Module): def __init__(self, model_dim, dropout=0.0): super().__init__() dff = model_dim * 4 self.l = nn.Linear(model_dim, dff) self.o = nn.Linear(dff, model_dim) sel...
ReinforcedReceiver
# 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.parallel import torch.utils.data from torch.distributions import Bernoulli import torch.distributions class ReinforcedReceiver(nn.Module): def __init__(self, n_bits, n_hidden): super(ReinforcedReceiver, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data import to...
Shawn-Guo-CN/EGG
ReinforcedReceiver
false
2,885
[ "MIT" ]
0
0a5b258108e2cd1c873d7f67e8c92551bb3d809c
https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data from torch.distributions import Bernoulli import torch.distributions class Model(nn.Module): def __init__(self, n_bits, n_hidden): super().__init__() self.emb_column = nn.Linear(n_b...
QuantPointwiseConv
# 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 QuantPointwiseConv(nn.Module): """Quantized Point-wise Conv""" def __init__(self, in_channels, out_channels, bias=True, **kwargs): super().__init__() self.qlinear = nn.Linear(in_channels, out_channels, bias=bias) self.quant = torch.quantization....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
TeaPoly/wenet
QuantPointwiseConv
false
2,886
[ "Apache-2.0" ]
0
5681887e338e4c8b2c75ffc283140e11a9d56a6d
https://github.com/TeaPoly/wenet/tree/5681887e338e4c8b2c75ffc283140e11a9d56a6d
import torch from torch import nn class Model(nn.Module): """Quantized Point-wise Conv""" def __init__(self, in_channels, out_channels, bias=True, **kwargs): super().__init__() self.qlinear = nn.Linear(in_channels, out_channels, bias=bias) self.quant = torch.quantization.QuantStub() ...
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 class Down2d(nn.Module): """docstring for Down2d.""" def __init__(self, in_channel, out_channel, kernel, stride, padding): super(Down2d, self).__init__() self.c1 = nn.Conv2d(in_channel, out_channel, kernel_size=kernel, stride=stride, padding=padd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Shimamura-Lab-SU/SGV
Discriminator
false
2,887
[ "MIT" ]
0
8df3c314532528b8597c5dbb28bdfb23155bee82
https://github.com/Shimamura-Lab-SU/SGV/tree/8df3c314532528b8597c5dbb28bdfb23155bee82
import torch import torch.nn as nn class Down2d(nn.Module): """docstring for Down2d.""" def __init__(self, in_channel, out_channel, kernel, stride, padding): super().__init__() self.c1 = nn.Conv2d(in_channel, out_channel, kernel_size=kernel, stride=stride, padding=padding) ...
Drift
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() 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....
Teemo341/BDNN
Drift
false
2,888
[ "Apache-2.0" ]
0
d53d4634a7a43d038faa049d7dfd10b3578ae267
https://github.com/Teemo341/BDNN/tree/d53d4634a7a43d038faa049d7dfd10b3578ae267
import torch import torch.nn as nn def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super().__init__() module = nn.ConvTranspose2d...
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 class Encoder(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super(Encoder, self).__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim,...
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...
TeoAndB/dtu_mlops
Encoder
false
2,889
[ "Apache-2.0" ]
0
671d8922298554659fd9697f0ebca7e8bfa0e8c2
https://github.com/TeoAndB/dtu_mlops/tree/671d8922298554659fd9697f0ebca7e8bfa0e8c2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super().__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim, latent_dim) ...
GCN_encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.init as init class GraphConv(nn.Module): def __init__(self, input_dim, output_dim): super(GraphConv, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.weight = nn.Parameter(torch.FloatTensor(input_dim, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Qin-Folks/graph-generation
GCN_encoder
false
2,890
[ "MIT" ]
0
afe1b697272b0e683b4551918de36f57f714e70b
https://github.com/Qin-Folks/graph-generation/tree/afe1b697272b0e683b4551918de36f57f714e70b
import torch import torch.nn as nn import torch.nn.init as init class GraphConv(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.input_dim = input_dim self.output_dim = output_dim self.weight = nn.Parameter(torch.FloatTensor(input_dim, output_dim)) ...
Network
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Network(nn.Module): def __init__(self, input_shape, output_shape, n_features, **kwargs): super(Network, self).__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h1 = nn.Linear(n_input, n_features) self._h2 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
TheCamusean/mushroom-rl
Network
false
2,891
[ "MIT" ]
0
48585f883e546ea57224b8d446ecb9b8ba90cf73
https://github.com/TheCamusean/mushroom-rl/tree/48585f883e546ea57224b8d446ecb9b8ba90cf73
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_shape, output_shape, n_features, **kwargs): super().__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h1 = nn.Linear(n_input, n_features) self._h2 = nn.Linear(n_features...
TransformerEncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerEncoderLayer(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.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....
Shawn-Guo-CN/EGG
TransformerEncoderLayer
false
2,892
[ "MIT" ]
0
0a5b258108e2cd1c873d7f67e8c92551bb3d809c
https://github.com/Shawn-Guo-CN/EGG/tree/0a5b258108e2cd1c873d7f67e8c92551bb3d809c
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class Model(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): super().__init_...
CriticNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class CriticNetwork(nn.Module): def __init__(self, input_shape, output_shape, **kwargs): super().__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h = nn.Linear(n_input, n_output) nn.ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
TheCamusean/mushroom-rl
CriticNetwork
false
2,893
[ "MIT" ]
0
48585f883e546ea57224b8d446ecb9b8ba90cf73
https://github.com/TheCamusean/mushroom-rl/tree/48585f883e546ea57224b8d446ecb9b8ba90cf73
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_shape, output_shape, **kwargs): super().__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h = nn.Linear(n_input, n_output) nn.init.xavier...
ActorNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class ActorNetwork(nn.Module): def __init__(self, input_shape, output_shape, **kwargs): super(ActorNetwork, self).__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h = nn.Linear(n_input, n_outpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
TheCamusean/mushroom-rl
ActorNetwork
false
2,895
[ "MIT" ]
0
48585f883e546ea57224b8d446ecb9b8ba90cf73
https://github.com/TheCamusean/mushroom-rl/tree/48585f883e546ea57224b8d446ecb9b8ba90cf73
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_shape, output_shape, **kwargs): super().__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h = nn.Linear(n_input, n_output) nn.init.xavier...
ConcatBlock
# 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 class ConcatBlock(nn.Module): def __init__(self, in_channels, out_channels): super(ConcatBlock, self).__init__() self.in_chns = in_channels self.out_chns = out_channels self.conv1 = nn.Conv2d(self.in_chns, self.in_chns,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional assert_size_stride = torch._C._...
TheSeaOfStars123/SSL4MIS
ConcatBlock
false
2,896
[ "MIT" ]
0
a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d
https://github.com/TheSeaOfStars123/SSL4MIS/tree/a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d
import torch import torch.nn as nn import torch.nn.functional class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.in_chns = in_channels self.out_chns = out_channels self.conv1 = nn.Conv2d(self.in_chns, self.in_chns, kernel_size=1, ...
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SharedDropout(nn.Module): """ SharedDropout differs from the vanilla dropout strategy in that the dropout mask is shared across one dimension. Args: p (float): The probability of an element to be zeroed. Default: 0.5. batch_first (bool)...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
TheSecret3003/crf_parser
MLP
false
2,897
[ "MIT" ]
0
34682ca8729d376b5582a3117e650b524fbcb355
https://github.com/TheSecret3003/crf_parser/tree/34682ca8729d376b5582a3117e650b524fbcb355
import torch import torch.nn as nn class SharedDropout(nn.Module): """ SharedDropout differs from the vanilla dropout strategy in that the dropout mask is shared across one dimension. Args: p (float): The probability of an element to be zeroed. Default: 0.5. batch_first (bool)...
OutPutBlock
# 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 class OutPutBlock(nn.Module): def __init__(self, in_channels, out_channels): super(OutPutBlock, self).__init__() self.in_chns = in_channels self.out_chns = out_channels self.conv1 = nn.Conv2d(self.in_chns, self.in_chns ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional assert_size_stride = torch._C._...
TheSeaOfStars123/SSL4MIS
OutPutBlock
false
2,898
[ "MIT" ]
0
a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d
https://github.com/TheSeaOfStars123/SSL4MIS/tree/a3fb6e8c996683eb79dc3f20e965064b7f5d2b3d
import torch import torch.nn as nn import torch.nn.functional class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.in_chns = in_channels self.out_chns = out_channels self.conv1 = nn.Conv2d(self.in_chns, self.in_chns // 2, kernel_size ...
random_resize
# 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 random import torch import torch.nn as nn import torch.nn.functional as F def resize_4d_tensor_by_factor(x, height_factor, width_factor): res = F.interpolate(x, scale_factor=(height_factor, width_factor), mode ='bilinear') return res class random_resize(nn.Module): def __init__(self, max...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
Tiamat-Tech/torch-dreams
random_resize
false
2,899
[ "MIT" ]
0
e1c1795f0a0007f54293c474de5d2b80ee829ab8
https://github.com/Tiamat-Tech/torch-dreams/tree/e1c1795f0a0007f54293c474de5d2b80ee829ab8
import random import torch import torch.nn as nn import torch.nn.functional as F def resize_4d_tensor_by_factor(x, height_factor, width_factor): res = F.interpolate(x, scale_factor=(height_factor, width_factor), mode ='bilinear') return res class Model(nn.Module): def __init__(self, max_size_fa...
ScalarMix
# 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 ScalarMix(nn.Module): """ Computes a parameterized scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)` where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters. Args: n_layers (...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
TheSecret3003/crf_parser
ScalarMix
false
2,900
[ "MIT" ]
0
34682ca8729d376b5582a3117e650b524fbcb355
https://github.com/TheSecret3003/crf_parser/tree/34682ca8729d376b5582a3117e650b524fbcb355
import torch import torch.nn as nn class Model(nn.Module): """ Computes a parameterized scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)` where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters. Args: n_layers (int)...
DotProdAttention
# 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 DotProdAttention(nn.Module): """Basic Dot-Production Attention""" def __init__(self): super().__init__() def forward(self, output, context): """Basic Dot-Production Method 1. compute e = q * k ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Tzu-An/ml_seq2seq_attn
DotProdAttention
false
2,901
[ "Apache-2.0" ]
0
1f29b1156c5e66e2bb5255c6d214c70162c91528
https://github.com/Tzu-An/ml_seq2seq_attn/tree/1f29b1156c5e66e2bb5255c6d214c70162c91528
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Basic Dot-Production Attention""" def __init__(self): super().__init__() def forward(self, output, context): """Basic Dot-Production Method 1. compute e = q * k 2. comput...
AlphaGoCnn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class AlphaGoCnn(nn.Module): def __init__(self): super(AlphaGoCnn, self).__init__() self.conv1 = nn.Conv2d(3, 32, 3, padding=1) self.conv2 = nn.Conv2d(32, 32, 3, padding=1) self.conv3 = nn.Conv2d(32, 32, 3, padding...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Theomat/go-enseirb-2020
AlphaGoCnn
false
2,902
[ "Apache-2.0" ]
0
ae842888dfd61a23d3556c5f63c4474bdbb1685f
https://github.com/Theomat/go-enseirb-2020/tree/ae842888dfd61a23d3556c5f63c4474bdbb1685f
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 32, 3, padding=1) self.conv2 = nn.Conv2d(32, 32, 3, padding=1) self.conv3 = nn.Conv2d(32, 32, 3, padding=1) self.fc1 ...
TimeEncoding
# 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 TimeEncoding(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=5000): super(TimeEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) def forward(self, x, mask, lengths): time = mask * 1 / (lengths[..., None] - 1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Tim-blo/ACTOR
TimeEncoding
false
2,903
[ "MIT" ]
0
f10d7534a34fa557ab6b1739217649ae4f654505
https://github.com/Tim-blo/ACTOR/tree/f10d7534a34fa557ab6b1739217649ae4f654505
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=5000): super().__init__() self.dropout = nn.Dropout(p=dropout) def forward(self, x, mask, lengths): time = mask * 1 / (lengths[..., None] - 1) time = time[:, None] * to...
MyUpsample2
# 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.parallel import torch.optim import torch.utils.data.distributed class MyUpsample2(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed assert_size_stride = torch._C._dynamo....
TransformersWsz/onestage_grounding
MyUpsample2
false
2,904
[ "MIT" ]
0
c939a7d5d7c7f9e1bfa8df2e6269397b8f840b5a
https://github.com/TransformersWsz/onestage_grounding/tree/c939a7d5d7c7f9e1bfa8df2e6269397b8f840b5a
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) def get...
NetRVlad
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def _moveaxis(tensor: 'torch.Tensor', source: 'int', destination: 'int' ) ->torch.Tensor: dim = tensor.dim() perm = list(range(dim)) if destination < 0: destination += dim perm.pop(source) perm.insert(destination, source) return tensor.permute(*pe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TheoMoutakanni/hcrn-videoqa
NetRVlad
false
2,905
[ "Apache-2.0" ]
0
03a0fb1f24d756e7cd61d519f92925b610a91a29
https://github.com/TheoMoutakanni/hcrn-videoqa/tree/03a0fb1f24d756e7cd61d519f92925b610a91a29
import torch import torch.nn as nn def _moveaxis(tensor: 'torch.Tensor', source: 'int', destination: 'int' ) ->torch.Tensor: dim = tensor.dim() perm = list(range(dim)) if destination < 0: destination += dim perm.pop(source) perm.insert(destination, source) return tensor.permute(*pe...
Swish
# 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.distributed class Swish(nn.Module): def __init__(self): super(Swish, self).__init__() self.beta = nn.Parameter(torch.tensor(1.0)) def forward(self, x): return x * torch.sigmoid(self.beta * x) def get_inputs(): return [torch.rand([...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
Ugness/PointFlow
Swish
false
2,906
[ "MIT" ]
0
238489c70b0332526cb2d506ab3e076fae20685d
https://github.com/Ugness/PointFlow/tree/238489c70b0332526cb2d506ab3e076fae20685d
import torch import torch.nn as nn import torch.distributed class Model(nn.Module): def __init__(self): super().__init__() self.beta = nn.Parameter(torch.tensor(1.0)) def forward(self, x): return x * torch.sigmoid(self.beta * x) def get_inputs(): return [torch.rand([4, 4, 4, 4]...
MultiHeadedAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import Tensor import torch.nn as nn class MultiHeadedAttention(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py """ def __init__(self, num_heads: 'in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Tim-blo/ACTOR
MultiHeadedAttention
false
2,907
[ "MIT" ]
0
f10d7534a34fa557ab6b1739217649ae4f654505
https://github.com/Tim-blo/ACTOR/tree/f10d7534a34fa557ab6b1739217649ae4f654505
import math import torch from torch import Tensor import torch.nn as nn class Model(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py """ def __init__(self, num_heads: 'int', size: 'int'...
EntityLayer
# 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 EntityLayer(nn.Module): def __init__(self, initial_size, layer_size, device='cpu'): super(EntityLayer, self).__init__() self.weights_ent = nn.Linear(initial_size, layer_size, bias=False) self.init_params() self def init_params(self): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
TraianVidrascu/DGAT
EntityLayer
false
2,908
[ "Apache-2.0" ]
0
8855634d6262dec867512880442429918a9ee4b4
https://github.com/TraianVidrascu/DGAT/tree/8855634d6262dec867512880442429918a9ee4b4
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, initial_size, layer_size, device='cpu'): super().__init__() self.weights_ent = nn.Linear(initial_size, layer_size, bias=False) self.init_params() self def init_params(self): nn.init.xavier_n...
MyNetwork
# 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 random import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torch.utils.data import TensorDataset class MyNetwork(Module): def __init__(self, size_input, size_hidden, size_output): """Create simple network""" ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Thijsvanede/torch-train
MyNetwork
false
2,909
[ "MIT" ]
0
e10c64b1d61f9cdfb84b2645a196be4379851a1a
https://github.com/Thijsvanede/torch-train/tree/e10c64b1d61f9cdfb84b2645a196be4379851a1a
from torch.nn import Module import random import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torch.utils.data import TensorDataset class Model(Module): def __init__(self, size_input, size_hidden, size_output): """Create simple network""" su...
MergeLayer
# 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 MergeLayer(nn.Module): def __init__(self, h_size, device='cpu'): super(MergeLayer, self).__init__() self.weight_inbound = nn.Linear(h_size, h_size, bias=True) self.weight_outbound = nn.Linear(h_size, h_size, bias=True) self.lambda_layer = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
TraianVidrascu/DGAT
MergeLayer
false
2,910
[ "Apache-2.0" ]
0
8855634d6262dec867512880442429918a9ee4b4
https://github.com/TraianVidrascu/DGAT/tree/8855634d6262dec867512880442429918a9ee4b4
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, h_size, device='cpu'): super().__init__() self.weight_inbound = nn.Linear(h_size, h_size, bias=True) self.weight_outbound = nn.Linear(h_size, h_size, bias=True) self.lambda_layer = nn.Linear(h_size * 2, ...
LayerNormAVG
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda import torch.distributed class LayerNormAVG(nn.Module): """ Layer Normalization class inspired by Transformer normalization, but here we normalize to given average to preserve magnitue of USE """ def __init__(self, features, desired_avg...
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.cuda import torch.distributed assert_size_st...
USE-sum/usesum
LayerNormAVG
false
2,911
[ "MIT" ]
0
eaf6dae0c451459551f728c0a8866777c20ed707
https://github.com/USE-sum/usesum/tree/eaf6dae0c451459551f728c0a8866777c20ed707
import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): """ Layer Normalization class inspired by Transformer normalization, but here we normalize to given average to preserve magnitue of USE """ def __init__(self, features, desired_avg, eps=1...
PreProcess
# 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 PreProcess(nn.Module): def __init__(self): """ Blocco di pre-processing delle immagini. Prende il tensore in ingresso nella forma (batch, width, height, channel), lo permuta e lo normalizza tra 0 e 1. """ super(PreProcess, self).__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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
UnibsMatt/NN
PreProcess
false
2,912
[ "MIT" ]
0
25eaddc079cd08227a52fdebd95453473fcd3b29
https://github.com/UnibsMatt/NN/tree/25eaddc079cd08227a52fdebd95453473fcd3b29
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): """ Blocco di pre-processing delle immagini. Prende il tensore in ingresso nella forma (batch, width, height, channel), lo permuta e lo normalizza tra 0 e 1. """ super().__init__() def forw...
CrossEntropyLossWithSoftLabel
# 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.nn import * from torch.optim import * from torch.optim.lr_scheduler import * class CrossEntropyLossWithSoftLabel(torch.nn.Module): def __init__(self, reduction='mean'): super().__init__() self.reduction = reduction self.logsoftmax = torch.nn.LogSoftmax(dim=1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import *...
UNIST-LIM-Lab/NeuBoots
CrossEntropyLossWithSoftLabel
false
2,913
[ "MIT" ]
0
196adf9e1ece2abc145f69966504bac2676e5b5e
https://github.com/UNIST-LIM-Lab/NeuBoots/tree/196adf9e1ece2abc145f69966504bac2676e5b5e
import torch from torch.nn import * from torch.optim import * from torch.optim.lr_scheduler import * class Model(torch.nn.Module): def __init__(self, reduction='mean'): super().__init__() self.reduction = reduction self.logsoftmax = torch.nn.LogSoftmax(dim=1) def forward(self, input,...
Accuracy
# 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.nn import * from torch.optim import * from torch.optim.lr_scheduler import * class Accuracy(torch.nn.Module): def __init__(self, reduction='mean', nlabels=5): super().__init__() self.reduction = reduction self.nlabels = nlabels def forward(self, input, target)...
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 * from torch.optim import * from torch.optim.lr_scheduler import * a...
UNIST-LIM-Lab/NeuBoots
Accuracy
false
2,914
[ "MIT" ]
0
196adf9e1ece2abc145f69966504bac2676e5b5e
https://github.com/UNIST-LIM-Lab/NeuBoots/tree/196adf9e1ece2abc145f69966504bac2676e5b5e
import torch from torch.nn import * from torch.optim import * from torch.optim.lr_scheduler import * class Model(torch.nn.Module): def __init__(self, reduction='mean', nlabels=5): super().__init__() self.reduction = reduction self.nlabels = nlabels def forward(self, input, target): ...
NextSentencePrediction
# 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.cuda import torch.distributed class NextSentencePrediction(nn.Module): """ 2-class classification model : is_next, is_random_next Args: hidden_size (int): BERT model output size """ def __init__(self, hidden_size): super(NextSen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SivilTaram/dialogue-utterance-rewriter-pytorch
NextSentencePrediction
false
2,915
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): """ 2-class classification model : is_next, is_random_next Args: hidden_size (int): BERT model output size """ def __init__(self, hidden_size): super().__init__() sel...
IoULoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data.distributed class IoULoss(nn.Module): """ Creates a criterion that computes the Intersection over Union (IoU) between a segmentation mask and its ground truth. Rahman...
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.parallel import torch.optim import torch.utils.data...
TransformersWsz/onestage_grounding
IoULoss
false
2,916
[ "MIT" ]
0
c939a7d5d7c7f9e1bfa8df2e6269397b8f840b5a
https://github.com/TransformersWsz/onestage_grounding/tree/c939a7d5d7c7f9e1bfa8df2e6269397b8f840b5a
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): """ Creates a criterion that computes the Intersection over Union (IoU) between a segmentation mask and its ground truth. Rahman, ...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn import torch.cuda import torch.distributed class GELU(nn.Module): """ Implementation of the gelu activation function :cite:`DBLP:journals/corr/HendrycksG16` For information: OpenAI GPT's gelu is slightly different (and gives slightly differen...
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.cuda import torch.distributed assert_size_st...
SivilTaram/dialogue-utterance-rewriter-pytorch
GELU
false
2,917
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import math import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): """ Implementation of the gelu activation function :cite:`DBLP:journals/corr/HendrycksG16` For information: OpenAI GPT's gelu is slightly different (and gives slightly differe...
BertPredictionTransform
# 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.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SivilTaram/dialogue-utterance-rewriter-pytorch
BertPredictionTransform
false
2,918
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import math import torch import torch.nn as nn import torch.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
CrossEntropyLossSoft
# 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.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.utils class CrossEntropyLossSoft(torch.nn.modules.loss._Loss): """ inplace distillation for image classification """ def forward(self, output, target): output_log_prob = t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Ren-Research/maestro
CrossEntropyLossSoft
false
2,919
[ "MIT" ]
0
b89e171d51ec910b165b9b01dd8373848a6207f7
https://github.com/Ren-Research/maestro/tree/b89e171d51ec910b165b9b01dd8373848a6207f7
import torch import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.utils class Model(torch.nn.modules.loss._Loss): """ inplace distillation for image classification """ def forward(self, output, target): output_log_prob = torch.nn.functio...
ActionApproximation
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class ActionApproximation(torch.nn.Module): def __init__(self, state_observations_count, action_count, hidden_count=512 ): super(ActionApproximation, self).__init__() self.ReLU = torch.nn.ReLU() self.dense0 = torch.nn.Linear(state_observations_count, hidden_count) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Unn20/achtung_die_kurve
ActionApproximation
false
2,920
[ "MIT" ]
0
e2dbb1752c070cfc398e415d5a427384c0230f3c
https://github.com/Unn20/achtung_die_kurve/tree/e2dbb1752c070cfc398e415d5a427384c0230f3c
import torch class Model(torch.nn.Module): def __init__(self, state_observations_count, action_count, hidden_count=512 ): super().__init__() self.ReLU = torch.nn.ReLU() self.dense0 = torch.nn.Linear(state_observations_count, hidden_count) self.dense1 = torch.nn.Linear(hidd...
AsymmetricLoss
# 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 torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class AsymmetricLoss(nn.Module): def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torchv...
MinliangLin/ASL
AsymmetricLoss
false
2,921
[ "MIT" ]
0
beda0989a8e30ac51a7ce9f9e247a12bbe84ec96
https://github.com/MinliangLin/ASL/tree/beda0989a8e30ac51a7ce9f9e247a12bbe84ec96
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=True): super()._...
AverageAttention
# 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.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.cuda import torch.distributed ass...
SivilTaram/dialogue-utterance-rewriter-pytorch
AverageAttention
false
2,922
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import math import torch import torch.nn as nn import torch.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
MaskedLanguageModel
# 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.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SivilTaram/dialogue-utterance-rewriter-pytorch
MaskedLanguageModel
false
2,923
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import math import torch import torch.nn as nn import torch.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
CNN_decoder_attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.init as init class CNN_decoder_attention(nn.Module): def __init__(self, input_size, output_size, stride=2): super(CNN_decoder_attention, self).__init__() self.input_size = input_size self.output_size = output_size self.relu = nn.R...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Qin-Folks/graph-generation
CNN_decoder_attention
false
2,924
[ "MIT" ]
0
afe1b697272b0e683b4551918de36f57f714e70b
https://github.com/Qin-Folks/graph-generation/tree/afe1b697272b0e683b4551918de36f57f714e70b
import torch import torch.nn as nn import torch.nn.init as init class Model(nn.Module): def __init__(self, input_size, output_size, stride=2): super().__init__() self.input_size = input_size self.output_size = output_size self.relu = nn.ReLU() self.deconv = nn.ConvTranspos...
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 import torch.hub import torch.nn.functional as F class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv1 = nn.Conv2d(1, 20, 5) self.conv2 = nn.Conv2d(20, 20, 5) def forward(self, x): x = F.relu(self.conv1(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 import ...
UoA-CARES/BuilT-NLP
Model
false
2,925
[ "MIT" ]
0
761798cbce51d91ec24171e9159413e51c0e0e62
https://github.com/UoA-CARES/BuilT-NLP/tree/761798cbce51d91ec24171e9159413e51c0e0e62
import torch import torch.nn as nn import torch.hub import torch.nn.functional as F class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv1 = nn.Conv2d(1, 20, 5) self.conv2 = nn.Conv2d(20, 20, 5) def forward(self, x): x = F.relu(self.conv1(x)) ...
Decoder
# 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 Decoder(nn.Module): def __init__(self, h_dim, n_chan, out_dim): super(Decoder, self).__init__() self.h_dim = h_dim self.n_chan = n_chan self.decoding = nn.Linear(h_dim, out_dim) def forward(self, x): x = torch.stack([self.decod...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
VDelv/Spatio-Temporal-EEG-Analysis
Decoder
false
2,926
[ "BSD-3-Clause" ]
0
7207e642da013e19dfd4316a22b597a93ce59581
https://github.com/VDelv/Spatio-Temporal-EEG-Analysis/tree/7207e642da013e19dfd4316a22b597a93ce59581
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, h_dim, n_chan, out_dim): super().__init__() self.h_dim = h_dim self.n_chan = n_chan self.decoding = nn.Linear(h_dim, out_dim) def forward(self, x): x = torch.stack([self.decoding(x[i]) for i...
PositionwiseFeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SivilTaram/dialogue-utterance-rewriter-pytorch
PositionwiseFeedForward
false
2,927
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import math import torch import torch.nn as nn import torch.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
ContrastiveLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class ContrastiveLoss(torch.nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin=2.0): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
VictorCallejas/FB-Similarity-Challenge
ContrastiveLoss
false
2,928
[ "MIT" ]
0
0092071f29d5d8fab055d27a1e542e2e64e9cdab
https://github.com/VictorCallejas/FB-Similarity-Challenge/tree/0092071f29d5d8fab055d27a1e542e2e64e9cdab
import torch class Model(torch.nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin=2.0): super().__init__() self.margin = margin def forward(self, dist, label): loss = tor...
CaricatureLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F def resize_4d_tensor_by_size(x, height, width): res = F.interpolate(x, size=(height, width), mode='bilinear') return res class CaricatureLoss(nn.Module): def __init__(self, power=1.0): super().__init__() self.power = pow...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Tiamat-Tech/torch-dreams
CaricatureLoss
false
2,929
[ "MIT" ]
0
e1c1795f0a0007f54293c474de5d2b80ee829ab8
https://github.com/Tiamat-Tech/torch-dreams/tree/e1c1795f0a0007f54293c474de5d2b80ee829ab8
import torch import torch.nn as nn import torch.nn.functional as F def resize_4d_tensor_by_size(x, height, width): res = F.interpolate(x, size=(height, width), mode='bilinear') return res class Model(nn.Module): def __init__(self, power=1.0): super().__init__() self.power = power d...
BertPreTrainingHeads
# 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.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SivilTaram/dialogue-utterance-rewriter-pytorch
BertPreTrainingHeads
false
2,930
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import math import torch import torch.nn as nn import torch.cuda import torch.distributed def get_activation_fn(activation): """Return an activation function Module according to its name.""" if activation == 'gelu': fn = GELU() elif activation == 'relu': fn = nn.ReLU() elif activation ...
TripletLoss
# 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 TripletLoss(torch.nn.Module): """ Triplet loss function. """ def __init__(self, margin=2.0): super(TripletLoss, self).__init__() self.margin = margin def forward(self, anchor, positive, negative): squarred_distance_1 = (anchor - po...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
VictorCallejas/FB-Similarity-Challenge
TripletLoss
false
2,931
[ "MIT" ]
0
0092071f29d5d8fab055d27a1e542e2e64e9cdab
https://github.com/VictorCallejas/FB-Similarity-Challenge/tree/0092071f29d5d8fab055d27a1e542e2e64e9cdab
import torch import torch.nn as nn class Model(torch.nn.Module): """ Triplet loss function. """ def __init__(self, margin=2.0): super().__init__() self.margin = margin def forward(self, anchor, positive, negative): squarred_distance_1 = (anchor - positive).pow(2).sum(1) ...
QuadrupletLoss
# 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 QuadrupletLoss(torch.nn.Module): """ Quadruplet loss function. Builds on the Triplet Loss and takes 4 data input: one anchor, one positive and two negative examples. The negative examples needs not to be matching the anchor, the positive and each other. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
VictorCallejas/FB-Similarity-Challenge
QuadrupletLoss
false
2,932
[ "MIT" ]
0
0092071f29d5d8fab055d27a1e542e2e64e9cdab
https://github.com/VictorCallejas/FB-Similarity-Challenge/tree/0092071f29d5d8fab055d27a1e542e2e64e9cdab
import torch import torch.nn as nn class Model(torch.nn.Module): """ Quadruplet loss function. Builds on the Triplet Loss and takes 4 data input: one anchor, one positive and two negative examples. The negative examples needs not to be matching the anchor, the positive and each other. """ def __i...
CatDotProdAttention
# 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 CatDotProdAttention(nn.Module): """Dot-Production Attention concatenated with query values Attribute: linear (nn.Linear): linear layer to compress output """ def __init__(self, dim): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Tzu-An/ml_seq2seq_attn
CatDotProdAttention
false
2,933
[ "Apache-2.0" ]
0
1f29b1156c5e66e2bb5255c6d214c70162c91528
https://github.com/Tzu-An/ml_seq2seq_attn/tree/1f29b1156c5e66e2bb5255c6d214c70162c91528
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Dot-Production Attention concatenated with query values Attribute: linear (nn.Linear): linear layer to compress output """ def __init__(self, dim): super().__init__() self.lin...
TorchFlattenNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class TorchFlattenNet(torch.nn.Module): def __init__(self): super(TorchFlattenNet, self).__init__() self.conv1 = torch.nn.Conv2d(1, 32, 3, 1) def forward(self, x): x = self.conv1(x) return torch.flatten(x, 1) def get_inputs(): return [torch.rand([4, 1, 64, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride reinterpret_tens...
TomokiHirose/convert_diff_fw_params
TorchFlattenNet
false
2,934
[ "MIT" ]
0
ba574ea52ae5574c9fbaabd340b8ccd0bf9ab5c5
https://github.com/TomokiHirose/convert_diff_fw_params/tree/ba574ea52ae5574c9fbaabd340b8ccd0bf9ab5c5
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() self.conv1 = torch.nn.Conv2d(1, 32, 3, 1) def forward(self, x): x = self.conv1(x) return torch.flatten(x, 1) def get_inputs(): return [torch.rand([4, 1, 64, 64])] def get_init_inputs(): ...
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 import torch.nn as nn class BahdanauAttention(nn.Module): """ Bahdanau Attention. Reference: https://blog.floydhub.com/attention-mechanism/#bahdanau-att-step1 --> Attention Mechanism https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning --> PyTorch Image Captioning ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ventu012/P2_Image_Captioning
BahdanauAttention
false
2,935
[ "MIT" ]
0
320e620145205efbc9222ad0f840469c0ec8d091
https://github.com/Ventu012/P2_Image_Captioning/tree/320e620145205efbc9222ad0f840469c0ec8d091
import torch import torch.nn as nn class Model(nn.Module): """ Bahdanau Attention. Reference: https://blog.floydhub.com/attention-mechanism/#bahdanau-att-step1 --> Attention Mechanism https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning --> PyTorch Image Captioning """ def _...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim, 400) self.l2 = nn.Linear(400, 300) self.l3 = nn.Linear(300, action_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
VasaKiDD/TD3-deep-rl-research
Actor
false
2,936
[ "Apache-2.0" ]
0
f75b2f86f3b7969a82fc4b7f9ea2b62de3616217
https://github.com/VasaKiDD/TD3-deep-rl-research/tree/f75b2f86f3b7969a82fc4b7f9ea2b62de3616217
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim, action_dim, max_action): super().__init__() self.l1 = nn.Linear(state_dim, 400) self.l2 = nn.Linear(400, 300) self.l3 = nn.Linear(300, action_dim) self....
PositionalEncoding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class PositionalEncoding(nn.Module): def __init__(self, module_dim=512, dropout=0.1, max_len=5000): super(PositionalEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) pe = torch.zeros(max_len, module_dim) position ...
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 numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
TheoMoutakanni/hcrn-videoqa
PositionalEncoding
false
2,937
[ "Apache-2.0" ]
0
03a0fb1f24d756e7cd61d519f92925b610a91a29
https://github.com/TheoMoutakanni/hcrn-videoqa/tree/03a0fb1f24d756e7cd61d519f92925b610a91a29
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, module_dim=512, dropout=0.1, max_len=5000): super().__init__() self.dropout = nn.Dropout(p=dropout) pe = torch.zeros(max_len, module_dim) position = torch.arange(0, max_len, dtype=torc...
SolutionModel
# 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 SolutionModel(nn.Module): def __init__(self, input_size, output_size): super(SolutionModel, self).__init__() self.input_size = input_size self.hidden_size = 32 self.linear1 = nn.Linear(input_size, self.hidden...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VVKot/mlinseconds-vote-prediction
SolutionModel
false
2,938
[ "MIT" ]
0
c869ae428fb8d5e83f0a47468722da968aed28c6
https://github.com/VVKot/mlinseconds-vote-prediction/tree/c869ae428fb8d5e83f0a47468722da968aed28c6
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, output_size): super().__init__() self.input_size = input_size self.hidden_size = 32 self.linear1 = nn.Linear(input_size, self.hidden_size) self.linear2...
Curiosity
# 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 Curiosity(nn.Module): def __init__(self, state_dim): super(Curiosity, self).__init__() self.l1 = nn.Linear(state_dim, 400) self.l2 = nn.Linear(400, 300) self.l3 = nn.Linear(300, 1) self.sigmoid = nn.S...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VasaKiDD/TD3-deep-rl-research
Curiosity
false
2,939
[ "Apache-2.0" ]
0
f75b2f86f3b7969a82fc4b7f9ea2b62de3616217
https://github.com/VasaKiDD/TD3-deep-rl-research/tree/f75b2f86f3b7969a82fc4b7f9ea2b62de3616217
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim): super().__init__() self.l1 = nn.Linear(state_dim, 400) self.l2 = nn.Linear(400, 300) self.l3 = nn.Linear(300, 1) self.sigmoid = nn.Sigmoid() def f...
LinearModel
# 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 LinearModel(nn.Module): def __init__(self, input_size, output_size, hidden_size): super(LinearModel, self).__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self.linear3 = nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
VVKot/mlinseconds-vote-prediction
LinearModel
false
2,940
[ "MIT" ]
0
c869ae428fb8d5e83f0a47468722da968aed28c6
https://github.com/VVKot/mlinseconds-vote-prediction/tree/c869ae428fb8d5e83f0a47468722da968aed28c6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, output_size, hidden_size): super().__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self.linear3 = nn.Linear(hidden_size, output...
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 from torch import save as save from torch import load as load class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.l1 = nn.Linear(784, 520) self.l2 = nn.Linear(520, 320) self.l3 = nn.Linear(32...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
UoA-sjer215/2021-python-41
Net
false
2,941
[ "Apache-2.0" ]
0
b27094f5915395636fa85ad6a4a9751c7224c345
https://github.com/UoA-sjer215/2021-python-41/tree/b27094f5915395636fa85ad6a4a9751c7224c345
import torch import torch.nn as nn import torch.nn.functional as F from torch import save as save from torch import load as load class Model(nn.Module): def __init__(self): super().__init__() self.l1 = nn.Linear(784, 520) self.l2 = nn.Linear(520, 320) self.l3 = nn.Linear(320, 240)...
down_right_shifted_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.utils import weight_norm as wn def right_shift(x, pad=None): xs = [int(y) for y in x.size()] x = x[:, :, :, :xs[3] - 1] pad = nn.ZeroPad2d((1, 0, 0, 0)) if pad is None else pad return pad(x) class down_right_shifted_conv2d(nn.Module): def __init_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
VahidZee/PixelCnnPP
down_right_shifted_conv2d
false
2,942
[ "MIT" ]
0
b0d7bffb3cc18263e55d7851f60f5682ba09e5c2
https://github.com/VahidZee/PixelCnnPP/tree/b0d7bffb3cc18263e55d7851f60f5682ba09e5c2
import torch import torch.nn as nn from torch.nn.utils import weight_norm as wn def right_shift(x, pad=None): xs = [int(y) for y in x.size()] x = x[:, :, :, :xs[3] - 1] pad = nn.ZeroPad2d((1, 0, 0, 0)) if pad is None else pad return pad(x) class Model(nn.Module): def __init__(self, num_filters_...
ConvolModel
# 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 ConvolModel(nn.Module): def __init__(self): super(ConvolModel, self).__init__() self.conv1 = nn.Conv2d(1, 5, 2) self.conv2 = nn.Conv2d(5, 10, 2) self.conv3 = nn.Conv2d(10, 10, 2) 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 from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VVKot/mlinseconds-vote-prediction
ConvolModel
false
2,943
[ "MIT" ]
0
c869ae428fb8d5e83f0a47468722da968aed28c6
https://github.com/VVKot/mlinseconds-vote-prediction/tree/c869ae428fb8d5e83f0a47468722da968aed28c6
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(1, 5, 2) self.conv2 = nn.Conv2d(5, 10, 2) self.conv3 = nn.Conv2d(10, 10, 2) def forward(self, x): x = F.relu(F.max_...
nin
# 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.utils import weight_norm as wn class nin(nn.Module): def __init__(self, dim_in, dim_out): super(nin, self).__init__() self.lin_a = wn(nn.Linear(dim_in, dim_out)) self.dim_out = dim_out def forward(self, x): """ a network in net...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
VahidZee/PixelCnnPP
nin
false
2,944
[ "MIT" ]
0
b0d7bffb3cc18263e55d7851f60f5682ba09e5c2
https://github.com/VahidZee/PixelCnnPP/tree/b0d7bffb3cc18263e55d7851f60f5682ba09e5c2
import torch import torch.nn as nn from torch.nn.utils import weight_norm as wn class Model(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.lin_a = wn(nn.Linear(dim_in, dim_out)) self.dim_out = dim_out def forward(self, x): """ a network in network la...
SELayer
# 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.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision.transforms.functional as F import torch.nn.functional as F from collections import OrderedDict import torch.utils def make_divisible(v, divisor=8, min_value=1):...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Ren-Research/maestro
SELayer
false
2,945
[ "MIT" ]
0
b89e171d51ec910b165b9b01dd8373848a6207f7
https://github.com/Ren-Research/maestro/tree/b89e171d51ec910b165b9b01dd8373848a6207f7
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision.transforms.functional as F import torch.nn.functional as F from collections import OrderedDict import torch.utils def make_divisible(v, divisor=8, min_value=1):...
KnowledgeDistillationLoss
# 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 KnowledgeDistillationLoss(nn.Module): def __init__(self, reduction='mean', alpha=1.0): super().__init__() self.reduction = reduction self.alpha = alpha def forward(self, inputs, targets, mask=None): inputs = inputs.narrow(1, 0, targets...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
VitoPalmisano/MiB_BiSeNet_SEAM_test
KnowledgeDistillationLoss
false
2,946
[ "MIT" ]
0
7b74beb69f135c0bb843ee24c90c3097ce448eec
https://github.com/VitoPalmisano/MiB_BiSeNet_SEAM_test/tree/7b74beb69f135c0bb843ee24c90c3097ce448eec
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, reduction='mean', alpha=1.0): super().__init__() self.reduction = reduction self.alpha = alpha def forward(self, inputs, targets, mask=None): inputs = inputs.narrow(1, 0, targets.shape[1]) o...
down_shifted_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.utils import weight_norm as wn def down_shift(x, pad=None): xs = [int(y) for y in x.size()] x = x[:, :, :xs[2] - 1, :] pad = nn.ZeroPad2d((0, 0, 1, 0)) if pad is None else pad return pad(x) class down_shifted_conv2d(nn.Module): 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._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
VahidZee/PixelCnnPP
down_shifted_conv2d
false
2,947
[ "MIT" ]
0
b0d7bffb3cc18263e55d7851f60f5682ba09e5c2
https://github.com/VahidZee/PixelCnnPP/tree/b0d7bffb3cc18263e55d7851f60f5682ba09e5c2
import torch import torch.nn as nn from torch.nn.utils import weight_norm as wn def down_shift(x, pad=None): xs = [int(y) for y in x.size()] x = x[:, :, :xs[2] - 1, :] pad = nn.ZeroPad2d((0, 0, 1, 0)) if pad is None else pad return pad(x) class Model(nn.Module): def __init__(self, num_filters_i...
MyConv1dPadSame
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from itertools import product as product from math import sqrt as sqrt class MyConv1dPadSame(nn.Module): """ extend nn.Conv1d to support SAME padding """ def __init__(self, in_channels, out_channels, kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data from itertools import product as p...
WFDetector/WFDetection
MyConv1dPadSame
false
2,949
[ "Apache-2.0" ]
0
b16d35b3a3a5de62de9e0bac83eccd21b6358b53
https://github.com/WFDetector/WFDetection/tree/b16d35b3a3a5de62de9e0bac83eccd21b6358b53
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from itertools import product as product from math import sqrt as sqrt class Model(nn.Module): """ extend nn.Conv1d to support SAME padding """ def __init__(self, in_channels, out_channels, kernel_size, stride)...
ClassificationCircleLoss
# 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 typing import Tuple import torch.utils.data from torch.nn.functional import cross_entropy from itertools import product as product from math import sqrt as sqrt class ClassificationCircleLoss(nn.Module): """Circle loss for class-level labels as described in the paper `"...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
WFDetector/WFDetection
ClassificationCircleLoss
false
2,950
[ "Apache-2.0" ]
0
b16d35b3a3a5de62de9e0bac83eccd21b6358b53
https://github.com/WFDetector/WFDetection/tree/b16d35b3a3a5de62de9e0bac83eccd21b6358b53
import torch import torch.nn as nn from typing import Tuple import torch.utils.data from torch.nn.functional import cross_entropy from itertools import product as product from math import sqrt as sqrt class Model(nn.Module): """Circle loss for class-level labels as described in the paper `"Circle Loss: A Unif...
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 import torch.nn.functional as F import torch.nn as nn import torch.utils.data from collections import OrderedDict def make_divisible(v, divisor, min_val=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.functional as...
WOODchen7/XNAS
SEModule
false
2,951
[ "MIT" ]
0
cc3d5cadfb4f755b4b4004dc368a102cdc68e6f6
https://github.com/WOODchen7/XNAS/tree/cc3d5cadfb4f755b4b4004dc368a102cdc68e6f6
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data from collections import OrderedDict def make_divisible(v, divisor, min_val=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It ...
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, kb_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....
TripuraPriyanka/ekmimn
SoftmaxAttention
false
2,952
[ "Apache-2.0" ]
0
389c2249369e5b0f09498d79034634ac1db4ff68
https://github.com/TripuraPriyanka/ekmimn/tree/389c2249369e5b0f09498d79034634ac1db4ff68
import torch import torch.nn as nn def masked_softmax(tensor, mask, kb_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 ...
AdaIN2d
# 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 AdaIN2d(nn.Module): def __init__(self, in_channels, in_features): super(AdaIN2d, self).__init__() self.norm = nn.InstanceNorm2d(in_channels, affine=False, track_running_stats=False) self.net = nn.Linear(in_features, 2 * 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.triton_helpers import libdevice import torch.nn as ...
TRUMANCFY/wolf
AdaIN2d
false
2,953
[ "Apache-2.0" ]
0
1a21479256e4f51885e2d2fdd449b1faa61277a6
https://github.com/TRUMANCFY/wolf/tree/1a21479256e4f51885e2d2fdd449b1faa61277a6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, in_features): super().__init__() self.norm = nn.InstanceNorm2d(in_channels, affine=False, track_running_stats=False) self.net = nn.Linear(in_features, 2 * in_channels) self.reset...
SingleHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data from itertools import product as product from math import sqrt as sqrt class SingleHead(nn.Module): """ Single head used in CenterNet Head. """ def __init__(self, in_channel, out_channel, bias_fill=False, bias_value=0): super(SingleHe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
WFDetector/WFDetection
SingleHead
false
2,954
[ "Apache-2.0" ]
0
b16d35b3a3a5de62de9e0bac83eccd21b6358b53
https://github.com/WFDetector/WFDetection/tree/b16d35b3a3a5de62de9e0bac83eccd21b6358b53
import torch import torch.nn as nn import torch.utils.data from itertools import product as product from math import sqrt as sqrt class Model(nn.Module): """ Single head used in CenterNet Head. """ def __init__(self, in_channel, out_channel, bias_fill=False, bias_value=0): super().__init__() ...
PositionalEmbedding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn class PositionalEmbedding(nn.Module): def __init__(self, embed_dim, max_seq_len): super(PositionalEmbedding, self).__init__() position_encodings = np.array([[(pos / np.power(10000, 2.0 * (i // 2) / embed_dim)) for i in range(embed_...
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 numpy as np from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
WangDaYeeeeee/BERT-With-KnowledgeBase
PositionalEmbedding
false
2,955
[ "Apache-2.0" ]
0
5f205295ce9b69ab0f813ef34409fdf2de3a14ca
https://github.com/WangDaYeeeeee/BERT-With-KnowledgeBase/tree/5f205295ce9b69ab0f813ef34409fdf2de3a14ca
import torch import numpy as np from torch import nn class Model(nn.Module): def __init__(self, embed_dim, max_seq_len): super().__init__() position_encodings = np.array([[(pos / np.power(10000, 2.0 * (i // 2) / embed_dim)) for i in range(embed_dim)] for pos in range( max...
MatrixTree
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda import torch.distributed class MatrixTree(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :ci...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda import torch.distributed assert_s...
SivilTaram/dialogue-utterance-rewriter-pytorch
MatrixTree
false
2,956
[ "MIT" ]
0
92c2254958b7a1ee9199836f7f2236575270983f
https://github.com/SivilTaram/dialogue-utterance-rewriter-pytorch/tree/92c2254958b7a1ee9199836f7f2236575270983f
import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :cite:`D...
SeparableConvBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn.functional as F import torch.utils.data from itertools import product as product from math import sqrt as sqrt class Conv2dSamePadding(torch.nn.Conv2d): """ A wrapper around :class:`torch.nn.Conv2d` to support "SAME" padding mode and more features. """ def __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 import math import torch.nn.functional as F import torch.utils.data from itertoo...
WFDetector/WFDetection
SeparableConvBlock
false
2,957
[ "Apache-2.0" ]
0
b16d35b3a3a5de62de9e0bac83eccd21b6358b53
https://github.com/WFDetector/WFDetection/tree/b16d35b3a3a5de62de9e0bac83eccd21b6358b53
import math import torch import torch.nn.functional as F import torch.utils.data from itertools import product as product from math import sqrt as sqrt class Conv2dSamePadding(torch.nn.Conv2d): """ A wrapper around :class:`torch.nn.Conv2d` to support "SAME" padding mode and more features. """ def __i...
complex_relu_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 class complex_relu_layer(nn.Module): """The complex ReLU layer from the `MagNet: A Neural Network for Directed Graphs. <https://arxiv.org/pdf/2102.11391.pdf>`_ paper. """ def __init__(self): super(complex_relu_layer, self).__init__() def complex_relu(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
XitongZhang1994/pytorch_geometric_signed_directed
complex_relu_layer
false
2,958
[ "MIT" ]
0
2507c2c8496c4d48ddbc960781b21ea69bb1cfdd
https://github.com/XitongZhang1994/pytorch_geometric_signed_directed/tree/2507c2c8496c4d48ddbc960781b21ea69bb1cfdd
import torch import torch.nn as nn class Model(nn.Module): """The complex ReLU layer from the `MagNet: A Neural Network for Directed Graphs. <https://arxiv.org/pdf/2102.11391.pdf>`_ paper. """ def __init__(self): super().__init__() def complex_relu(self, real: 'torch.FloatTensor', img: 'torc...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn import torch.nn.functional as F class Attention(nn.Module): """ score_i = f(Q, K_i), i = 1, 2, ..., t dot: f(Q, K_i) = Q.transpose · K_i scaled_dot: f(Q, K_i) = Q.transpose · K_i / √(key_dim) general: f(Q, K_i) = Q.transpose · W ·...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
WangDaYeeeeee/BERT-With-KnowledgeBase
Attention
false
2,959
[ "Apache-2.0" ]
0
5f205295ce9b69ab0f813ef34409fdf2de3a14ca
https://github.com/WangDaYeeeeee/BERT-With-KnowledgeBase/tree/5f205295ce9b69ab0f813ef34409fdf2de3a14ca
import math import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ score_i = f(Q, K_i), i = 1, 2, ..., t dot: f(Q, K_i) = Q.transpose · K_i scaled_dot: f(Q, K_i) = Q.transpose · K_i / √(key_dim) general: f(Q, K_i) = Q.transpose · W · K_i...
SummaryNet
# 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 SummaryNet(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv1d(in_channels=1, out_channels=6, kernel_size=5, padding=2) self.pool = nn.MaxPool1d(kernel_size=10, stride=10) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Wrede/BNN-LFI
SummaryNet
false
2,960
[ "MIT" ]
0
8c5094f01c1eef286bdd84613c7259d534d2eb7e
https://github.com/Wrede/BNN-LFI/tree/8c5094f01c1eef286bdd84613c7259d534d2eb7e
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.Conv1d(in_channels=1, out_channels=6, kernel_size=5, padding=2) self.pool = nn.MaxPool1d(kernel_size=10, stride=10) self.fc...
DeResNetBlockGroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def deconv3x3(in_planes, out_planes, stride=1, output_padding=0): """3x3 deconvolution with padding""" return nn.ConvTranspose2d(in_planes, out_planes, kernel_size=3, stride= stride, padding=1, output_padding=output_padding, bias=False) class DeResNetBlockGroupNorm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TRUMANCFY/wolf
DeResNetBlockGroupNorm
false
2,961
[ "Apache-2.0" ]
0
1a21479256e4f51885e2d2fdd449b1faa61277a6
https://github.com/TRUMANCFY/wolf/tree/1a21479256e4f51885e2d2fdd449b1faa61277a6
import torch import torch.nn as nn def deconv3x3(in_planes, out_planes, stride=1, output_padding=0): """3x3 deconvolution with padding""" return nn.ConvTranspose2d(in_planes, out_planes, kernel_size=3, stride= stride, padding=1, output_padding=output_padding, bias=False) class Model(nn.Module): ...
LeNet5
# 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 LeNet5(nn.Module): def __init__(self): super(LeNet5, self).__init__() self.conv1 = nn.Conv2d(1, 6, (5, 5), padding=0) self.conv2 = nn.Conv2d(6, 16, (5, 5)) self.fc1 = nn.Linear(16 * 5 * 5, 120) 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_...
SuhangGeongyu/2019_SNUST_DEEPLEARNING_HW
LeNet5
false
2,962
[ "MIT" ]
0
e6eb119483ab905f558f63341922a56ebee9b5c6
https://github.com/SuhangGeongyu/2019_SNUST_DEEPLEARNING_HW/tree/e6eb119483ab905f558f63341922a56ebee9b5c6
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(1, 6, (5, 5), padding=0) self.conv2 = nn.Conv2d(6, 16, (5, 5)) self.fc1 = nn.Linear(16 * 5 * 5, 120) self.fc2 = nn.Linea...
MyMaxPool1dPadSame
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from itertools import product as product from math import sqrt as sqrt class MyMaxPool1dPadSame(nn.Module): """ extend nn.MaxPool1d to support SAME padding """ def __init__(self, kernel_size, stride_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 from itertools import product as product fr...
WFDetector/WFDetection
MyMaxPool1dPadSame
false
2,963
[ "Apache-2.0" ]
0
b16d35b3a3a5de62de9e0bac83eccd21b6358b53
https://github.com/WFDetector/WFDetection/tree/b16d35b3a3a5de62de9e0bac83eccd21b6358b53
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from itertools import product as product from math import sqrt as sqrt class Model(nn.Module): """ extend nn.MaxPool1d to support SAME padding """ def __init__(self, kernel_size, stride_size): super()._...
PrimaryCaps
# 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 def squash(x, dim=-1): squared_norm = (x ** 2).sum(dim=dim, keepdim=True) scale = squared_norm / (1 + squared_norm) return scale * x / (squared_norm.sqrt() + 1e-08) class PrimaryCaps(nn.Module): """Primary capsule layer.""" def __init__(self, num_conv_units, in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
Xiangs18/CapsNet
PrimaryCaps
false
2,964
[ "MIT" ]
0
79cd0ed1e726750968cd8658370f78aa86a62170
https://github.com/Xiangs18/CapsNet/tree/79cd0ed1e726750968cd8658370f78aa86a62170
import torch from torch import nn def squash(x, dim=-1): squared_norm = (x ** 2).sum(dim=dim, keepdim=True) scale = squared_norm / (1 + squared_norm) return scale * x / (squared_norm.sqrt() + 1e-08) class Model(nn.Module): """Primary capsule layer.""" def __init__(self, num_conv_units, in_chann...
ResNetBlockGroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class ResNetBlockGroupNorm(nn.Module): def __init__(self, inplanes, planes, num_groups...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TRUMANCFY/wolf
ResNetBlockGroupNorm
false
2,965
[ "Apache-2.0" ]
0
1a21479256e4f51885e2d2fdd449b1faa61277a6
https://github.com/TRUMANCFY/wolf/tree/1a21479256e4f51885e2d2fdd449b1faa61277a6
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class Model(nn.Module): def __init__(self, inplanes, planes, num_groups, stride=1, act...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class ResidualBlock(nn.Module): def __init__(self, channels, reduction): super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1) self.prelu = nn.PReLU(num_parameters=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 import nn import torch.utils.data assert_size_stride = torch._C._dyna...
Wulfsta/SuperResolution
ResidualBlock
false
2,966
[ "MIT" ]
0
ced152e57da001074856b0c085d499c2825358d6
https://github.com/Wulfsta/SuperResolution/tree/ced152e57da001074856b0c085d499c2825358d6
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, channels, reduction): super().__init__() self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1) self.prelu = nn.PReLU(num_parameters=channels) self.conv2 = nn.Conv2d(...
CapsuleLoss
# 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 CapsuleLoss(nn.Module): """Combine margin loss & reconstruction loss of capsule network.""" def __init__(self, upper_bound=0.9, lower_bound=0.1, lmda=0.5): super(CapsuleLoss, self).__init__() self.upper = upper_bound self.lower = lower_bound ...
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...
Xiangs18/CapsNet
CapsuleLoss
false
2,967
[ "MIT" ]
0
79cd0ed1e726750968cd8658370f78aa86a62170
https://github.com/Xiangs18/CapsNet/tree/79cd0ed1e726750968cd8658370f78aa86a62170
import torch from torch import nn class Model(nn.Module): """Combine margin loss & reconstruction loss of capsule network.""" def __init__(self, upper_bound=0.9, lower_bound=0.1, lmda=0.5): super().__init__() self.upper = upper_bound self.lower = lower_bound self.lmda = lmda ...