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
SigM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True, h_max=1): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) self.h_max = h_max def forward(self, x): return self.relu(x + 3) * self.h_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guard...
anonymous2022ijcai/RGSL
SigM
false
1,450
[ "MIT" ]
0
11c38ee50d50127c0f7c2a137bdb21ca5f7f3644
https://github.com/anonymous2022ijcai/RGSL/tree/11c38ee50d50127c0f7c2a137bdb21ca5f7f3644
import torch import torch.utils.data import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True, h_max=1): super().__init__() self.relu = nn.ReLU6(inplace=inplace) self.h_max = h_max def forward(self, x): return self.relu(x + 3) * self.h_max / 6 class...
StyleLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): n_batches, n_channels, height, width = input.size() flattened = input.view(n_batches, n_channels, height * width) return torch.bmm(flattened, flattened.transpose(1, 2)).div_(height * widt...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
andreweskeclarke/style-transfer
StyleLoss
false
1,451
[ "MIT" ]
0
e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca
https://github.com/andreweskeclarke/style-transfer/tree/e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): n_batches, n_channels, height, width = input.size() flattened = input.view(n_batches, n_channels, height * width) return torch.bmm(flattened, flattened.transpose(1, 2)).div_(height * widt...
Brain
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.distributions import Categorical class Replay: def __init__(self): self.hidden0 = None self.states = [] self.actions = [] self.rewards = [] self.is_terminal = False self.iter = 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....
anhddo/ai-arena
Brain
false
1,452
[ "MIT" ]
0
bc881e83073be4f9130b1a50fa56a51c11d21f9f
https://github.com/anhddo/ai-arena/tree/bc881e83073be4f9130b1a50fa56a51c11d21f9f
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical class Replay: def __init__(self): self.hidden0 = None self.states = [] self.actions = [] self.rewards = [] self.is_terminal = False self.iter = 0 ...
RelativeThreshold_RegLoss
# 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.init class RelativeThreshold_RegLoss(nn.Module): def __init__(self, threshold, size_average=True): super(RelativeThreshold_RegLoss, self).__init__() self.size_average = size_average self.eps = 1e-07 self.threshold = threshold ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.nn.init assert_size_stride = torch._C....
andry900/NN-Project
RelativeThreshold_RegLoss
false
1,453
[ "MIT" ]
0
e04a83029f5990d9b65216ab0648a8826a8ebca7
https://github.com/andry900/NN-Project/tree/e04a83029f5990d9b65216ab0648a8826a8ebca7
import torch import torch.nn as nn import torch.nn.init class Model(nn.Module): def __init__(self, threshold, size_average=True): super().__init__() self.size_average = size_average self.eps = 1e-07 self.threshold = threshold def forward(self, preds, targets): """ ...
DilatedResidualLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 DilatedResidualLayer(nn.Module): def __init__(self, dilation, in_channels, out_channels): super(DilatedResidualLayer, self).__init__() self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding =dilation...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
anonymous-rubick/ms-tcn-bilinear
DilatedResidualLayer
false
1,454
[ "MIT" ]
0
b95d3ca834dc4811af563d38185acef975970e82
https://github.com/anonymous-rubick/ms-tcn-bilinear/tree/b95d3ca834dc4811af563d38185acef975970e82
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dilation, in_channels, out_channels): super().__init__() self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding =dilation, dilation=dilation) self.conv_1x...
AttentionUnit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn.functional as F class AttentionUnit(nn.Module): def __init__(self, sDim, xDim, attDim): super(AttentionUnit, self).__init__() self.sDim = sDim self.xDim = xDim self.attDim = attDim self.sEmbed ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ankur6ue/aster-ocr
AttentionUnit
false
1,455
[ "MIT" ]
0
c4503bb19c843d519a36f0e5b8bebd6809800e04
https://github.com/ankur6ue/aster-ocr/tree/c4503bb19c843d519a36f0e5b8bebd6809800e04
import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F class Model(nn.Module): def __init__(self, sDim, xDim, attDim): super().__init__() self.sDim = sDim self.xDim = xDim self.attDim = attDim self.sEmbed = nn.Linear(sDim, attDim) ...
CNNQNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CNNQNetwork(nn.Module): """CNN Q Function, which outputs array of action values""" def __init__(self, state_size, action_size, seed, conv1_filters=16, conv2_filters=16, conv3_filters=16, fc1_units=200, fc2_units=200): ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
anindex/deepRL-projects
CNNQNetwork
false
1,456
[ "MIT" ]
0
bed03d1f985c8340fc75f715028b632bdce40641
https://github.com/anindex/deepRL-projects/tree/bed03d1f985c8340fc75f715028b632bdce40641
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """CNN Q Function, which outputs array of action values""" def __init__(self, state_size, action_size, seed, conv1_filters=16, conv2_filters=16, conv3_filters=16, fc1_units=200, fc2_units=200): """Initi...
GlobalAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(args) def 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....
andy-yangz/birnn-decoder-NMT
GlobalAttention
false
1,457
[ "MIT" ]
0
112293f463d93ef0e08cdcb363b908ed9ad5198e
https://github.com/andy-yangz/birnn-decoder-NMT/tree/112293f463d93ef0e08cdcb363b908ed9ad5198e
import torch import torch.nn as nn import torch.cuda def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(args) def se...
BerhuLoss
# 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 import torch.hub class BerhuLoss(nn.Module): def __init__(self): super(BerhuLoss, self).__init__() self.name = 'Berhu' def forward(self, input, target, mask=None): assert input.shap...
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 ...
appliedinnovation/fast-depth
BerhuLoss
false
1,458
[ "MIT" ]
0
4606b4d340ae416de94afed45bc767fe6f64bd67
https://github.com/appliedinnovation/fast-depth/tree/4606b4d340ae416de94afed45bc767fe6f64bd67
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.hub class Model(nn.Module): def __init__(self): super().__init__() self.name = 'Berhu' def forward(self, input, target, mask=None): assert input.shape == target.shape ...
SILogLoss
# 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 import torch.hub class SILogLoss(nn.Module): def __init__(self): super(SILogLoss, self).__init__() self.name = 'SILog' def forward(self, input, target, mask=None, interpolate=False): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
appliedinnovation/fast-depth
SILogLoss
false
1,459
[ "MIT" ]
0
4606b4d340ae416de94afed45bc767fe6f64bd67
https://github.com/appliedinnovation/fast-depth/tree/4606b4d340ae416de94afed45bc767fe6f64bd67
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.hub class Model(nn.Module): def __init__(self): super().__init__() self.name = 'SILog' def forward(self, input, target, mask=None, interpolate=False): assert input.shap...
Self_Attn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn class Self_Attn(nn.Module): """ Self attention Layer""" def __init__(self, in_dim): super(Self_Attn, self).__init__() self.chanel_in = in_dim self.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim // 2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
anonymous2022ijcai/RGSL
Self_Attn
false
1,460
[ "MIT" ]
0
11c38ee50d50127c0f7c2a137bdb21ca5f7f3644
https://github.com/anonymous2022ijcai/RGSL/tree/11c38ee50d50127c0f7c2a137bdb21ca5f7f3644
import torch import torch.utils.data import torch.nn as nn class Model(nn.Module): """ Self attention Layer""" def __init__(self, in_dim): super().__init__() self.chanel_in = in_dim self.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim // 2, kernel_size=1) ...
PreActBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 PreActBlock(nn.Module): """Pre-activation version of the BasicBlock.""" expansion = 1 def __init__(self, in_planes, planes, stride=1): super(PreActBlock, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, ker...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
appa-ayephyu/RobGAN
PreActBlock
false
1,461
[ "MIT" ]
0
1d4577edb5b858e9d0c1e76a4c323de18201190c
https://github.com/appa-ayephyu/RobGAN/tree/1d4577edb5b858e9d0c1e76a4c323de18201190c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Pre-activation version of the BasicBlock.""" expansion = 1 def __init__(self, in_planes, planes, stride=1): super().__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, stride= ...
GramMatrix
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): n_batches, n_channels, height, width = input.size() flattened = input.view(n_batches, n_channels, height * width) return torch.bmm(flattened, flattened.transpose(1, 2)).div_(height * widt...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
andreweskeclarke/style-transfer
GramMatrix
false
1,462
[ "MIT" ]
0
e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca
https://github.com/andreweskeclarke/style-transfer/tree/e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): n_batches, n_channels, height, width = input.size() flattened = input.view(n_batches, n_channels, height * width) return torch.bmm(flattened, flattened.transpose(1, 2)).div_(height * width) ...
OptimizedBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 def _downsample(x): return F.avg_pool2d(x, 2) class OptimizedBlock(nn.Module): def __init__(self, in_channels, out_channels, ksize=3, pad=1, activation=F.relu, bn=False): super(OptimizedBlock, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
appa-ayephyu/RobGAN
OptimizedBlock
false
1,463
[ "MIT" ]
0
1d4577edb5b858e9d0c1e76a4c323de18201190c
https://github.com/appa-ayephyu/RobGAN/tree/1d4577edb5b858e9d0c1e76a4c323de18201190c
import math import torch import torch.nn as nn import torch.nn.functional as F def _downsample(x): return F.avg_pool2d(x, 2) class Model(nn.Module): def __init__(self, in_channels, out_channels, ksize=3, pad=1, activation=F.relu, bn=False): super().__init__() self.activation = activ...
Dice_Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class Dice_Loss(torch.nn.Module): """This is a custom Dice Similarity Coefficient loss function that we use to the accuracy of the segmentation. it is defined as ; DSC = 2 * (pred /intersect label) / (pred /union label) for the losss we use 1- DSC so gradient descent leads to better outpu...
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...
arjunsbalaji/oct
Dice_Loss
false
1,464
[ "Apache-2.0" ]
0
f21e11f6dda952cd914444512ddadb4141757951
https://github.com/arjunsbalaji/oct/tree/f21e11f6dda952cd914444512ddadb4141757951
import torch class Model(torch.nn.Module): """This is a custom Dice Similarity Coefficient loss function that we use to the accuracy of the segmentation. it is defined as ; DSC = 2 * (pred /intersect label) / (pred /union label) for the losss we use 1- DSC so gradient descent leads to better outputs."...
CoordConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 AddCoords(nn.Module): def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Args: input_tensor: shape(batch, channel, x_dim, y_dim) """ batch_size, _,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
apyrros/HCC-comorbidities
CoordConv
false
1,465
[ "MIT" ]
0
fd74fb2f1438bc741cfe6728c5cb64737bc99d68
https://github.com/apyrros/HCC-comorbidities/tree/fd74fb2f1438bc741cfe6728c5cb64737bc99d68
import torch import torch.nn as nn class AddCoords(nn.Module): def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Args: input_tensor: shape(batch, channel, x_dim, y_dim) """ batch_size, _,...
Perceptron
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 class Perceptron(nn.Module): """ A perceptron is one linear Layer""" def __init__(self, input_dim: 'int'): """ :param input_dim (int): size of inputs features """ super(Perceptron, self).__init__() self.fc1 = 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 import torch.cuda assert_size_stride = torch._C._dynamo.gu...
arhouati/NLP_with_Pytorch
Perceptron
false
1,466
[ "MIT" ]
0
8063cdb4b1245c59db2cd57f23b2cbde577c2c0f
https://github.com/arhouati/NLP_with_Pytorch/tree/8063cdb4b1245c59db2cd57f23b2cbde577c2c0f
import torch import torch.nn as nn import torch.cuda class Model(nn.Module): """ A perceptron is one linear Layer""" def __init__(self, input_dim: 'int'): """ :param input_dim (int): size of inputs features """ super().__init__() self.fc1 = nn.Linear(input_dim, 1) ...
SeqKD
# 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 SeqKD(nn.Module): """ NLL loss with label smoothing. """ def __init__(self, T=1): super(SeqKD, self).__init__() self.kdloss = nn.KLDivLoss(reduction='batchmean') self.T = T def forward(self, predicti...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ardasatata/SLR
SeqKD
false
1,467
[ "Apache-2.0" ]
0
a001a19775646cf7bab92f59e0d40019efb909c6
https://github.com/ardasatata/SLR/tree/a001a19775646cf7bab92f59e0d40019efb909c6
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ NLL loss with label smoothing. """ def __init__(self, T=1): super().__init__() self.kdloss = nn.KLDivLoss(reduction='batchmean') self.T = T def forward(self, prediction_logits, ...
DynamicConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 class DynamicConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, sr_in_list=(1.0,), sr_out_list=None): self.sr_idx, self.sr_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 import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guar...
arielclj/singa-easy
DynamicConv2d
false
1,468
[ "Apache-2.0" ]
0
fd4bc601a5501062936f874df14711a3cefa1346
https://github.com/arielclj/singa-easy/tree/fd4bc601a5501062936f874df14711a3cefa1346
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class Model(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, sr_in_list=(1.0,), sr_out_list=None): self.sr_idx, self.sr_in_list = ...
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.utils.data def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import torch.nn as nn import torch.utils.data assert_size_stride = ...
ashutoshbaghel/tgifqa-lxmert
GeLU
false
1,469
[ "MIT" ]
0
7969f478d20fbfbba1c0eaaf0b96891654bfcc26
https://github.com/ashutoshbaghel/tgifqa-lxmert/tree/7969f478d20fbfbba1c0eaaf0b96891654bfcc26
import math import torch import torch.nn as nn import torch.utils.data def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *...
ChanLayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ChanLayerNorm(nn.Module): """Channelwise LayerNorm""" def __init__(self, d: 'int', **kwargs): super().__init__() self.ln = nn.LayerNorm(d, **kwargs) def forward(self, x): x = self.ln(x.permute(0, 2, 3, 1)) return x.permute(0, 3, 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
arampacha/generative_models
ChanLayerNorm
false
1,470
[ "Apache-2.0" ]
0
34f5a2fc760bbd7f9f9a956d8d8670c9746e5152
https://github.com/arampacha/generative_models/tree/34f5a2fc760bbd7f9f9a956d8d8670c9746e5152
import torch import torch.nn as nn class Model(nn.Module): """Channelwise LayerNorm""" def __init__(self, d: 'int', **kwargs): super().__init__() self.ln = nn.LayerNorm(d, **kwargs) def forward(self, x): x = self.ln(x.permute(0, 2, 3, 1)) return x.permute(0, 3, 1, 2).cont...
CNNPolicy
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CNNPolicy(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, conv1_filters=32, conv2_filters=32, conv3_filters=32, fc1_units=200, fc2_units=200): """Initialize parameters and build ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
anindex/deepRL-projects
CNNPolicy
false
1,471
[ "MIT" ]
0
bed03d1f985c8340fc75f715028b632bdce40641
https://github.com/anindex/deepRL-projects/tree/bed03d1f985c8340fc75f715028b632bdce40641
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, conv1_filters=32, conv2_filters=32, conv3_filters=32, fc1_units=200, fc2_units=200): """Initialize parameters and build mode...
P_net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class P_net(nn.Module): def __init__(self, X_dim, N, z_dim): super(P_net, self).__init__() self.lin1 = nn.Linear(z_dim, int(N / 2)) self.lin2 = nn.Linear(int(N / 2), N) self.lin4 = nn.Linear(N, X_dim) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
arnaghosh/VoxNet
P_net
false
1,472
[ "MIT" ]
0
45fe8e9ff28b02f21b8991486317ff61cfa5d553
https://github.com/arnaghosh/VoxNet/tree/45fe8e9ff28b02f21b8991486317ff61cfa5d553
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, X_dim, N, z_dim): super().__init__() self.lin1 = nn.Linear(z_dim, int(N / 2)) self.lin2 = nn.Linear(int(N / 2), N) self.lin4 = nn.Linear(N, X_dim) def forward(self, x...
BatchNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 BatchNorm(nn.Module): def __init__(self, num_channels): super().__init__() theta_mu = torch.zeros(num_channels) theta_sigma = torch.ones(num_channels) self.theta_mu = nn.Parameter(theta_mu) self.theta_sigma = nn.Parameter(theta_sigm...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
anish-pratheepkumar/GitDeepLearningStudy
BatchNorm
false
1,473
[ "MIT" ]
0
3d1873e2ac70b9ee6cca309e96759e1714bc73f1
https://github.com/anish-pratheepkumar/GitDeepLearningStudy/tree/3d1873e2ac70b9ee6cca309e96759e1714bc73f1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_channels): super().__init__() theta_mu = torch.zeros(num_channels) theta_sigma = torch.ones(num_channels) self.theta_mu = nn.Parameter(theta_mu) self.theta_sigma = nn.Parameter(theta_sigma) ...
VectorQuantizer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class VQPseudoGrad(Function): @staticmethod def forward(ctx, z, q): return q @staticmethod def backward(ctx, grad_output): return grad_output, None class VectorQuantizer(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.autograd import Fu...
arampacha/generative_models
VectorQuantizer
false
1,474
[ "Apache-2.0" ]
0
34f5a2fc760bbd7f9f9a956d8d8670c9746e5152
https://github.com/arampacha/generative_models/tree/34f5a2fc760bbd7f9f9a956d8d8670c9746e5152
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class VQPseudoGrad(Function): @staticmethod def forward(ctx, z, q): return q @staticmethod def backward(ctx, grad_output): return grad_output, None class Model(nn.Module): de...
ResidualConvUnit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ResidualConvUnit(nn.Module): """Residual convolution module. """ def __init__(self, features): """Init. Args: features (int): number of features """ super().__init__() self.conv1 = nn.Conv2d(features, features, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
anlok/depthmap-loktev
ResidualConvUnit
false
1,475
[ "MIT" ]
0
c5af9156985524063c5e49c52bc28aab3290da71
https://github.com/anlok/depthmap-loktev/tree/c5af9156985524063c5e49c52bc28aab3290da71
import torch import torch.nn as nn class Model(nn.Module): """Residual convolution module. """ def __init__(self, features): """Init. Args: features (int): number of features """ super().__init__() self.conv1 = nn.Conv2d(features, features, kernel_size...
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 class Net(nn.Module): def __init__(self, n_inputs, n_units=[50, 50, 50]): super(Net, self).__init__() self.fc1 = nn.Linear(n_inputs, n_units[0]) self.fc2 = nn.Linear(n_units[0], n_units[1]) self.fc3 = nn.Linear(n_units[1], n_units[2]) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
apaleyes/pybnn
Net
false
1,476
[ "BSD-3-Clause" ]
0
1362546662ebdf5d7f507add16a386fa665c51a1
https://github.com/apaleyes/pybnn/tree/1362546662ebdf5d7f507add16a386fa665c51a1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_inputs, n_units=[50, 50, 50]): super().__init__() self.fc1 = nn.Linear(n_inputs, n_units[0]) self.fc2 = nn.Linear(n_units[0], n_units[1]) self.fc3 = nn.Linear(n_units[1], n_units[2]) self.out =...
GramMatrix
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
asapypy/mokumokuTorch
GramMatrix
false
1,477
[ "MIT" ]
0
ec59877b407a3f0ac1a9627ea5609698f2979278
https://github.com/asapypy/mokumokuTorch/tree/ec59877b407a3f0ac1a9627ea5609698f2979278
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_i...
Reconstruction_Layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Reconstruction_Layer(torch.nn.Module): """TThis is the reconstruction layer for the network to learn how to remake the original input image""" def __init__(self, batch_size, capsin_n_maps, capsin_n_dims, reconstruct_channels): super(Reconstruction_Layer, self).__init__(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
arjunsbalaji/oct
Reconstruction_Layer
false
1,478
[ "Apache-2.0" ]
0
f21e11f6dda952cd914444512ddadb4141757951
https://github.com/arjunsbalaji/oct/tree/f21e11f6dda952cd914444512ddadb4141757951
import torch class Model(torch.nn.Module): """TThis is the reconstruction layer for the network to learn how to remake the original input image""" def __init__(self, batch_size, capsin_n_maps, capsin_n_dims, reconstruct_channels): super().__init__() self.batch_size = batch_size ...
Q_net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Q_net(nn.Module): def __init__(self, X_dim, N, z_dim): super(Q_net, self).__init__() self.xdim = X_dim self.lin1 = nn.Linear(X_dim, N) self.lin3 = nn.Linear(N, int(N / 2)) self.lin3gauss = nn.Linear(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
arnaghosh/VoxNet
Q_net
false
1,479
[ "MIT" ]
0
45fe8e9ff28b02f21b8991486317ff61cfa5d553
https://github.com/arnaghosh/VoxNet/tree/45fe8e9ff28b02f21b8991486317ff61cfa5d553
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, X_dim, N, z_dim): super().__init__() self.xdim = X_dim self.lin1 = nn.Linear(X_dim, N) self.lin3 = nn.Linear(N, int(N / 2)) self.lin3gauss = nn.Linear(int(N / 2), ...
Agreement_Routing_Down
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch def squash(s, axis=-1, epsilon=1e-07): squared_norm = torch.sum(s * s, dim=axis) safe_norm = torch.sqrt(squared_norm + epsilon) squash_factor = squared_norm / (1.0 + squared_norm) unit_vector = torch.div(s, safe_norm.unsqueeze(-1)) return torch.mul(squash_factor.unsqueeze(-1), unit_ve...
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 assert_size...
arjunsbalaji/oct
Agreement_Routing_Down
false
1,480
[ "Apache-2.0" ]
0
f21e11f6dda952cd914444512ddadb4141757951
https://github.com/arjunsbalaji/oct/tree/f21e11f6dda952cd914444512ddadb4141757951
import torch def squash(s, axis=-1, epsilon=1e-07): squared_norm = torch.sum(s * s, dim=axis) safe_norm = torch.sqrt(squared_norm + epsilon) squash_factor = squared_norm / (1.0 + squared_norm) unit_vector = torch.div(s, safe_norm.unsqueeze(-1)) return torch.mul(squash_factor.unsqueeze(-1), unit_ve...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 32, (3, 3)) self.pool1 = nn.MaxPool2d((2, 2)) self.conv2 = nn.Conv2d(32, 32, (3, 3)) self.pool2 = nn.MaxPool2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
arcada-uas/intro-to-dl
Net
false
1,481
[ "MIT" ]
0
675741ad123e88158ecab88f887ea31113c99e7a
https://github.com/arcada-uas/intro-to-dl/tree/675741ad123e88158ecab88f887ea31113c99e7a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 32, (3, 3)) self.pool1 = nn.MaxPool2d((2, 2)) self.conv2 = nn.Conv2d(32, 32, (3, 3)) self.pool2 = nn.MaxPool2d((2, 2)...
D_net_gauss
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 D_net_gauss(nn.Module): def __init__(self, N, z_dim): super(D_net_gauss, self).__init__() self.lin1 = nn.Linear(z_dim, N) self.lin3 = nn.Linear(N, int(N / 2)) self.lin4 = nn.Linear(int(N / 2), 10) def fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
arnaghosh/VoxNet
D_net_gauss
false
1,482
[ "MIT" ]
0
45fe8e9ff28b02f21b8991486317ff61cfa5d553
https://github.com/arnaghosh/VoxNet/tree/45fe8e9ff28b02f21b8991486317ff61cfa5d553
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, N, z_dim): super().__init__() self.lin1 = nn.Linear(z_dim, N) self.lin3 = nn.Linear(N, int(N / 2)) self.lin4 = nn.Linear(int(N / 2), 10) def forward(self, x): ...
CombineSlices
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class CombineSlices(nn.Module): def __init__(self, slice_dim=2): super().__init__() self.slice_dim = slice_dim def forward(self, x): return torch.index_select(x, dim=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 import nn import torch.utils.data import torch.utils.data.distributed import torch.optim assert_size_stride = torch._C._dynamo.gu...
aslakey/fastMRI
CombineSlices
false
1,483
[ "MIT" ]
0
e94028aeccfdc70472b453c2ef2f072b40a287c7
https://github.com/aslakey/fastMRI/tree/e94028aeccfdc70472b453c2ef2f072b40a287c7
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Model(nn.Module): def __init__(self, slice_dim=2): super().__init__() self.slice_dim = slice_dim def forward(self, x): return torch.index_select(x, dim=self.slice_di...
Cartesian
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Cartesian(nn.Module): def forward(self, x): r, phi = x[..., 0], x[..., 1] return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1) def get_inputs(): return [tor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data import torch.utils.data.dist...
aslakey/fastMRI
Cartesian
false
1,484
[ "MIT" ]
0
e94028aeccfdc70472b453c2ef2f072b40a287c7
https://github.com/aslakey/fastMRI/tree/e94028aeccfdc70472b453c2ef2f072b40a287c7
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Model(nn.Module): def forward(self, x): r, phi = x[..., 0], x[..., 1] return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1) def get_inputs(): return [torch.r...
Downsample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Downsample(nn.Module): def __init__(self, in_channels, with_conv): super().__init__() self.with_conv = with_conv if self.wit...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.nn.parallel import torch....
ashwinipokle/deq
Downsample
false
1,485
[ "MIT" ]
0
955560601ac7b9dd3088e918850efd9ba14b7610
https://github.com/ashwinipokle/deq/tree/955560601ac7b9dd3088e918850efd9ba14b7610
import torch import torch.nn as nn import torch._utils import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Model(nn.Module): def __init__(self, in_channels, with_conv): super().__init__() self.with_conv = with_conv if self.with_con...
Blind_UNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class crop(nn.Module): def __init__(self): super().__init__() def forward(self, x): N, C, H, W = x.shape x = x[0:N, 0:C, 0:H - 1, 0:W] return x class shift(nn.Module): def __init__(self): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
amonod/udvd
Blind_UNet
false
1,486
[ "MIT" ]
0
a1ccb777d205255ac68c40efb93dd3996f562c45
https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45
import torch import torch.nn as nn import torch.nn.functional as F class crop(nn.Module): def __init__(self): super().__init__() def forward(self, x): N, C, H, W = x.shape x = x[0:N, 0:C, 0:H - 1, 0:W] return x class shift(nn.Module): def __init__(self): super(...
self_attn_mini
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 self_attn_mini(nn.Module): def __init__(self, input_size): super(self_attn_mini, self).__init__() self.input_size = input_size self.key = nn.Linear(input_size, input_size, bias=False) self.query = nn.Linear(input_size, input_size, bias=Fals...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
aryanbdps9/aml_music_generation
self_attn_mini
false
1,487
[ "MIT" ]
0
42c8895128327a2884dbfeb8413e0060fef6e22f
https://github.com/aryanbdps9/aml_music_generation/tree/42c8895128327a2884dbfeb8413e0060fef6e22f
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size): super().__init__() self.input_size = input_size self.key = nn.Linear(input_size, input_size, bias=False) self.query = nn.Linear(input_size, input_size, bias=False) self.value = nn.Li...
CustomBatchNormAutograd
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CustomBatchNormAutograd(nn.Module): """ This nn.module implements a custom version of the batch norm operation for MLPs. The operations called in self.forward track the history if the input tensors have the flag requires_grad set to True. The backward pass does not n...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
askliar/deep_learning
CustomBatchNormAutograd
false
1,488
[ "MIT" ]
0
e61b2391a3258d18719bf12d9ed1404620ce6c02
https://github.com/askliar/deep_learning/tree/e61b2391a3258d18719bf12d9ed1404620ce6c02
import torch import torch.nn as nn class Model(nn.Module): """ This nn.module implements a custom version of the batch norm operation for MLPs. The operations called in self.forward track the history if the input tensors have the flag requires_grad set to True. The backward pass does not need to be implemen...
CustomBatchNormManualModule
# 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 CustomBatchNormManualFunction(torch.autograd.Function): """ This torch.autograd.Function implements a functional custom version of the batch norm operation for MLPs. Using torch.autograd.Function allows you to write a custom backward function. The function will be ca...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
askliar/deep_learning
CustomBatchNormManualModule
false
1,489
[ "MIT" ]
0
e61b2391a3258d18719bf12d9ed1404620ce6c02
https://github.com/askliar/deep_learning/tree/e61b2391a3258d18719bf12d9ed1404620ce6c02
import torch import torch.nn as nn class CustomBatchNormManualFunction(torch.autograd.Function): """ This torch.autograd.Function implements a functional custom version of the batch norm operation for MLPs. Using torch.autograd.Function allows you to write a custom backward function. The function will be ca...
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...
attardi/parser
ScalarMix
false
1,490
[ "MIT" ]
0
1978ba94ba649ad0a723d71bb2ca225c7e705702
https://github.com/attardi/parser/tree/1978ba94ba649ad0a723d71bb2ca225c7e705702
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)...
TorchGloVeLoss
# 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 TorchGloVeLoss(nn.Module): def __init__(self): super().__init__() self.reduction = 'sum' def forward(self, diffs, weights): return torch.sum(0.5 * torch.mul(weights, diffs ** 2)) def get_inputs(): return [torch.ra...
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...
atticusg/cs224u
TorchGloVeLoss
false
1,491
[ "Apache-2.0" ]
0
66e0f2714e246dcb8836f706ae9ff5613c51ed34
https://github.com/atticusg/cs224u/tree/66e0f2714e246dcb8836f706ae9ff5613c51ed34
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.reduction = 'sum' def forward(self, diffs, weights): return torch.sum(0.5 * torch.mul(weights, diffs ** 2)) def get_inputs(): return [torch.rand([4, 4,...
TorchGloVeModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 torch.nn.init import xavier_uniform_ class TorchGloVeModel(nn.Module): def __init__(self, n_words, embed_dim): super().__init__() self.n_words = n_words self.embed_dim = embed_dim self.W = self._init_weights(self.n_wo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data from torch.nn.init import xavier_u...
atticusg/cs224u
TorchGloVeModel
false
1,492
[ "Apache-2.0" ]
0
66e0f2714e246dcb8836f706ae9ff5613c51ed34
https://github.com/atticusg/cs224u/tree/66e0f2714e246dcb8836f706ae9ff5613c51ed34
import torch import torch.nn as nn import torch.utils.data from torch.nn.init import xavier_uniform_ class Model(nn.Module): def __init__(self, n_words, embed_dim): super().__init__() self.n_words = n_words self.embed_dim = embed_dim self.W = self._init_weights(self.n_words, self....
CrossEntropyLossIIT
# 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 CrossEntropyLossIIT(nn.Module): def __init__(self): super().__init__() self.loss = nn.CrossEntropyLoss(reduction='mean') def forward(self, preds, labels): return self.loss(preds[0], labels[:, 0]) + self.loss(preds[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 import torch.nn as nn ...
atticusg/cs224u
CrossEntropyLossIIT
false
1,493
[ "Apache-2.0" ]
0
66e0f2714e246dcb8836f706ae9ff5613c51ed34
https://github.com/atticusg/cs224u/tree/66e0f2714e246dcb8836f706ae9ff5613c51ed34
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.loss = nn.CrossEntropyLoss(reduction='mean') def forward(self, preds, labels): return self.loss(preds[0], labels[:, 0]) + self.loss(preds[1], lab...
ClassicModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch from torch import nn class ClassicModel(nn.Module): def __init__(self, config, inpt_shp): super(ClassicModel, self).__init__() self.depth = config.depth self.nodes = config.n_qubits self.config = config self.pre_ne...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
austinbeauch/QML
ClassicModel
false
1,494
[ "Apache-2.0" ]
0
4a2f5b1b0346a1a8bb0a0e6e638cf2225c4c213c
https://github.com/austinbeauch/QML/tree/4a2f5b1b0346a1a8bb0a0e6e638cf2225c4c213c
from _paritybench_helpers import _mock_config import torch from torch import nn class Model(nn.Module): def __init__(self, config, inpt_shp): super().__init__() self.depth = config.depth self.nodes = config.n_qubits self.config = config self.pre_net = nn.Linear(inpt_shp, s...
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 import torch.nn.functional as F class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.eps = eps self.affine = affine 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 assert_size_stride = torch._C._dynamo.guards.assert_size_...
audreyeternal/cyclegan
LayerNorm
false
1,495
[ "MIT" ]
0
8eb3ddb7fd0d9838862334766f1f7aaa5584c2da
https://github.com/audreyeternal/cyclegan/tree/8eb3ddb7fd0d9838862334766f1f7aaa5584c2da
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.eps = eps self.affine = affine if self.affine: self.gam...
BinaryLoss
# 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 BinaryLoss(nn.Module): """ Computes contrastive loss[1, 2] twice, one time for the distance between query and positive example, and another for the distance between query and negative example. Both use l2-distance. [1] http:/...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
atypon/specter
BinaryLoss
false
1,496
[ "Apache-2.0" ]
0
bc1ee723167cf1dbf599603e09539c1823f26c17
https://github.com/atypon/specter/tree/bc1ee723167cf1dbf599603e09539c1823f26c17
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Computes contrastive loss[1, 2] twice, one time for the distance between query and positive example, and another for the distance between query and negative example. Both use l2-distance. [1] http://yann...
BertSelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.utils.data class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: raise...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashutoshbaghel/tgifqa-lxmert
BertSelfAttention
false
1,497
[ "MIT" ]
0
7969f478d20fbfbba1c0eaaf0b96891654bfcc26
https://github.com/ashutoshbaghel/tgifqa-lxmert/tree/7969f478d20fbfbba1c0eaaf0b96891654bfcc26
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The h...
WCE_loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class WCE_loss(nn.Module): def __init__(self): super(WCE_loss, self).__init__() def sum_ij(self, x): return torch.sum(torch.sum(x, dim=3), dim=2) def forward(self, pred, gt): N_fg = self.sum_ij(gt) N_bg = self.sum_ij(1 - gt) L_f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
atch841/pytorch-one-shot-texture-segmentation
WCE_loss
false
1,498
[ "MIT" ]
0
8b781b861d17eb1e1e7014f54f8fd39dc10dd2b8
https://github.com/atch841/pytorch-one-shot-texture-segmentation/tree/8b781b861d17eb1e1e7014f54f8fd39dc10dd2b8
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def sum_ij(self, x): return torch.sum(torch.sum(x, dim=3), dim=2) def forward(self, pred, gt): N_fg = self.sum_ij(gt) N_bg = self.sum_ij(1 - gt) L_fg = -1 * self.sum...
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...
attardi/parser
MLP
false
1,499
[ "MIT" ]
0
1978ba94ba649ad0a723d71bb2ca225c7e705702
https://github.com/attardi/parser/tree/1978ba94ba649ad0a723d71bb2ca225c7e705702
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)...
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 torch import torch.nn as nn class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, x): return torch.sigmoid(1.702 * x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
awgansekoele/outlier-exposure
GELU
false
1,500
[ "Apache-2.0" ]
0
9557c7915fa466fc54951357519cfba27f7659ad
https://github.com/awgansekoele/outlier-exposure/tree/9557c7915fa466fc54951357519cfba27f7659ad
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.sigmoid(1.702 * x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
folder
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class folder(nn.Module): def __init__(self): super().__init__() def forward(self, feature_map): N, _, H, W = feature_map.size() feature_map = F.unfold(feature_map, kernel_size=3, padding=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 import nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
avinash-asink/AdelaiDet
folder
false
1,501
[ "BSD-2-Clause" ]
0
a8722579c8a724b02a36ef0f33a176ba282623fa
https://github.com/avinash-asink/AdelaiDet/tree/a8722579c8a724b02a36ef0f33a176ba282623fa
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): def __init__(self): super().__init__() def forward(self, feature_map): N, _, H, W = feature_map.size() feature_map = F.unfold(feature_map, kernel_size=3, padding=1) ...
Arc2
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import numpy as np class Arc2(Module): def __init__(self, num_bends): super(Arc2, self).__init__() self.num_bends = num_bends self.register_buffer('range', torch.arange(0, float(num_bends))) def a(self, t): return torch.cos(np.pi * t /...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module import numpy as np assert_size_stride = torch...
avecplezir/dnn-mode-connectivity
Arc2
false
1,502
[ "BSD-2-Clause" ]
0
9a92ca370571f542b33060f637239172a0d08bba
https://github.com/avecplezir/dnn-mode-connectivity/tree/9a92ca370571f542b33060f637239172a0d08bba
from torch.nn import Module import torch import numpy as np class Model(Module): def __init__(self, num_bends): super().__init__() self.num_bends = num_bends self.register_buffer('range', torch.arange(0, float(num_bends))) def a(self, t): return torch.cos(np.pi * t / 2) ...
Normalize
# 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 Normalize(nn.Module): """Normalize nn.Module. As at pytorch, simplified""" def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225 ], inplace=False, dtype=torch.float32): super().__init__() mean = torch.as_tensor(mean, dtype=dty...
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...
ayasyrev/pt_utils
Normalize
false
1,503
[ "Apache-2.0" ]
0
cb29b8fb4a3981248e1055979cc773f719dccdc7
https://github.com/ayasyrev/pt_utils/tree/cb29b8fb4a3981248e1055979cc773f719dccdc7
import torch import torch.nn as nn class Model(nn.Module): """Normalize nn.Module. As at pytorch, simplified""" def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225 ], inplace=False, dtype=torch.float32): super().__init__() mean = torch.as_tensor(mean, dtype=dtype) ...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.modules.loss._WeightedLoss): def __init__(self, weight=None, gamma=2, reduction='mean'): super(FocalLoss, self).__init__(weight, reduction=reduction) self.gamma = gamma self.weight = weight def forw...
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 ...
aydindemircioglu/knee.lat
FocalLoss
false
1,504
[ "MIT" ]
0
555725222f860d4ad8fea7452685803d9e323d43
https://github.com/aydindemircioglu/knee.lat/tree/555725222f860d4ad8fea7452685803d9e323d43
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.modules.loss._WeightedLoss): def __init__(self, weight=None, gamma=2, reduction='mean'): super().__init__(weight, reduction=reduction) self.gamma = gamma self.weight = weight def forward(self, input, ta...
DQNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class DQNet(nn.Module): """ Definition: DQNet(obs_size,act_size,hid_size=256) Regular Deep Q Network with three Linear layers """ def __init__(self, obs_size, act_size, hid_size=256): super().__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 import triton_helpers import torch.nn as nn assert_...
ayjabri/DeepRL
DQNet
false
1,505
[ "MIT" ]
0
0be095e3a3d04f60b4cdc97ed330dffc17b3024a
https://github.com/ayjabri/DeepRL/tree/0be095e3a3d04f60b4cdc97ed330dffc17b3024a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """ Definition: DQNet(obs_size,act_size,hid_size=256) Regular Deep Q Network with three Linear layers """ def __init__(self, obs_size, act_size, hid_size=256): super().__init__() self....
Arc
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import numpy as np class Arc(Module): def __init__(self, num_bends): super(Arc, self).__init__() self.num_bends = num_bends self.register_buffer('range', torch.arange(0, float(num_bends))) def a(self, t): return torch.cos(np.pi * t / 2...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module import numpy as np assert_size_stride = torch...
avecplezir/dnn-mode-connectivity
Arc
false
1,506
[ "BSD-2-Clause" ]
0
9a92ca370571f542b33060f637239172a0d08bba
https://github.com/avecplezir/dnn-mode-connectivity/tree/9a92ca370571f542b33060f637239172a0d08bba
from torch.nn import Module import torch import numpy as np class Model(Module): def __init__(self, num_bends): super().__init__() self.num_bends = num_bends self.register_buffer('range', torch.arange(0, float(num_bends))) def a(self, t): return torch.cos(np.pi * t / 2) ...
DuelDQNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class DuelDQNet(nn.Module): """ Definition: DuelDQNet(obs_size, act_size, hid_size=256) """ def __init__(self, obs_size, act_size, hid_size=256): super().__init__() self.base = nn.Linear(obs_size, hid_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ayjabri/DeepRL
DuelDQNet
false
1,507
[ "MIT" ]
0
0be095e3a3d04f60b4cdc97ed330dffc17b3024a
https://github.com/ayjabri/DeepRL/tree/0be095e3a3d04f60b4cdc97ed330dffc17b3024a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """ Definition: DuelDQNet(obs_size, act_size, hid_size=256) """ def __init__(self, obs_size, act_size, hid_size=256): super().__init__() self.base = nn.Linear(obs_size, hid_size) se...
TripletLossDoubleMargin
# 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 TripletLossDoubleMargin(nn.Module): """ Triplet Loss with positive and negative margins, following the work of [1] References ---------- [1] Ho, K., Keuper, J., Pfreundt, F. J., & Keuper, M. (2021, January). Learning embeddings for image clusterin...
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...
ax-le/MusicAE
TripletLossDoubleMargin
false
1,508
[ "BSD-3-Clause" ]
0
9fdc268f6403226b990d9ae5c9f182ed0af82f98
https://github.com/ax-le/MusicAE/tree/9fdc268f6403226b990d9ae5c9f182ed0af82f98
import torch import torch.nn as nn class Model(nn.Module): """ Triplet Loss with positive and negative margins, following the work of [1] References ---------- [1] Ho, K., Keuper, J., Pfreundt, F. J., & Keuper, M. (2021, January). Learning embeddings for image clustering: An empirical st...
A2CNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class A2CNet(nn.Module): """Double heads actor + critic network.""" def __init__(self, obs_size, act_size, hid_size=128): super().__init__() self.fc1 = nn.Linear(obs_size, hid_size) self.policy = nn.Linear(hid_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 from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ayjabri/DeepRL
A2CNet
false
1,509
[ "MIT" ]
0
0be095e3a3d04f60b4cdc97ed330dffc17b3024a
https://github.com/ayjabri/DeepRL/tree/0be095e3a3d04f60b4cdc97ed330dffc17b3024a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """Double heads actor + critic network.""" def __init__(self, obs_size, act_size, hid_size=128): super().__init__() self.fc1 = nn.Linear(obs_size, hid_size) self.policy = nn.Linear(hid_size...
BertOutAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.utils.data class BertOutAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueErro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashutoshbaghel/tgifqa-lxmert
BertOutAttention
false
1,510
[ "MIT" ]
0
7969f478d20fbfbba1c0eaaf0b96891654bfcc26
https://github.com/ashutoshbaghel/tgifqa-lxmert/tree/7969f478d20fbfbba1c0eaaf0b96891654bfcc26
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( ...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class BinaryDiceLoss(nn.Module): """Dice loss of binary class Args: smooth: A float number to smooth loss, and avoid NaN error, default: 1 p: Denominator value: \\sum{x^p} + \\sum{y^p}, default: 2 predict: A tensor of s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
aureliedj/OilseedRapeSegmentation
DiceLoss
false
1,511
[ "MIT" ]
0
89056c3295b24354c32b6059854a3a60214c26cb
https://github.com/aureliedj/OilseedRapeSegmentation/tree/89056c3295b24354c32b6059854a3a60214c26cb
import torch import torch.nn as nn import torch.nn.functional as F class BinaryDiceLoss(nn.Module): """Dice loss of binary class Args: smooth: A float number to smooth loss, and avoid NaN error, default: 1 p: Denominator value: \\sum{x^p} + \\sum{y^p}, default: 2 predict: A tensor of s...
GRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class GRUCell(nn.Module): """Plain vanilla policy gradient network.""" def __init__(self, obs_size, act_size, hid_size=128): super().__init__() self.fc1 = nn.GRUCell(obs_size, hid_size) self.output = nn.Linear(hid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ayjabri/DeepRL
GRUCell
false
1,512
[ "MIT" ]
0
0be095e3a3d04f60b4cdc97ed330dffc17b3024a
https://github.com/ayjabri/DeepRL/tree/0be095e3a3d04f60b4cdc97ed330dffc17b3024a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """Plain vanilla policy gradient network.""" def __init__(self, obs_size, act_size, hid_size=128): super().__init__() self.fc1 = nn.GRUCell(obs_size, hid_size) self.output = nn.Linear(hid_s...
ELU_1
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class ELU_1(nn.ELU): def __init__(self, *args, **kwargs): super(ELU_1, self).__init__(*args, **kwargs) def forward(self, input): return F.elu(input, self.alpha, self.inplace) def get_inputs(): return [torch.rand([4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
bantiitnab/kaggle-TGS-salt-identification
ELU_1
false
1,513
[ "MIT" ]
0
8b3350278b2ee8f01ba2a0734af9514d369f3228
https://github.com/bantiitnab/kaggle-TGS-salt-identification/tree/8b3350278b2ee8f01ba2a0734af9514d369f3228
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.ELU): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input): return F.elu(input, self.alpha, self.inplace) def get_inputs(): return [torch.rand([4, 4, 4, 4])] d...
TPSELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data from torch import nn class TPSELoss(nn.Module): def __init__(self): super(TPSELoss, self).__init__() self.loss = nn.L1Loss() def forward(self, model_output): gst_embed, tpse_embed = model_output[4], model_output[5] gst_embed = gst_embed.de...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.data from torch import nn assert_size_stride = torch._...
azahed98/mellotron
TPSELoss
false
1,514
[ "BSD-3-Clause" ]
0
02998743de820e379e0c7ff44506088d6e65c693
https://github.com/azahed98/mellotron/tree/02998743de820e379e0c7ff44506088d6e65c693
import torch import torch.utils.data from torch import nn class Model(nn.Module): def __init__(self): super().__init__() self.loss = nn.L1Loss() def forward(self, model_output): gst_embed, tpse_embed = model_output[4], model_output[5] gst_embed = gst_embed.detach() lo...
ActorNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class ActorNet(nn.Module): def __init__(self, obs_size, act_size, high_action=1): super().__init__() self.high_action = high_action self.base = nn.Linear(obs_size, 400) self.fc1 = nn.Linear(400, 300) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ayjabri/DeepRL
ActorNet
false
1,515
[ "MIT" ]
0
0be095e3a3d04f60b4cdc97ed330dffc17b3024a
https://github.com/ayjabri/DeepRL/tree/0be095e3a3d04f60b4cdc97ed330dffc17b3024a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, obs_size, act_size, high_action=1): super().__init__() self.high_action = high_action self.base = nn.Linear(obs_size, 400) self.fc1 = nn.Linear(400, 300) self...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
bantiitnab/kaggle-TGS-salt-identification
DiceLoss
false
1,516
[ "MIT" ]
0
8b3350278b2ee8f01ba2a0734af9514d369f3228
https://github.com/bantiitnab/kaggle-TGS-salt-identification/tree/8b3350278b2ee8f01ba2a0734af9514d369f3228
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class Model(nn.Module): def __init__(self, smooth=1): ...
BCE_Dice
# 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 IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=1): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
bantiitnab/kaggle-TGS-salt-identification
BCE_Dice
false
1,517
[ "MIT" ]
0
8b3350278b2ee8f01ba2a0734af9514d369f3228
https://github.com/bantiitnab/kaggle-TGS-salt-identification/tree/8b3350278b2ee8f01ba2a0734af9514d369f3228
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=1): ...
VanillaRNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 VanillaRNN(nn.Module): def __init__(self, seq_length, input_dim, num_hidden, num_classes, batch_size, device='cpu'): super(VanillaRNN, self).__init__() self.seq_length = seq_length self.h_init = nn.Parameter(torch.zeros(num_hidden, 1), ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
askliar/deep_learning
VanillaRNN
false
1,518
[ "MIT" ]
0
e61b2391a3258d18719bf12d9ed1404620ce6c02
https://github.com/askliar/deep_learning/tree/e61b2391a3258d18719bf12d9ed1404620ce6c02
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, seq_length, input_dim, num_hidden, num_classes, batch_size, device='cpu'): super().__init__() self.seq_length = seq_length self.h_init = nn.Parameter(torch.zeros(num_hidden, 1), requires_grad...
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 MLP(nn.Module): """ Multi-Layer Perceptron network """ def __init__(self, obs_dim, dim_latent): """ Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
baihuaxie/drl-lib
MLP
false
1,519
[ "MIT" ]
0
3ad344901c3bb59e0bc16bb70202d2cfd538fd77
https://github.com/baihuaxie/drl-lib/tree/3ad344901c3bb59e0bc16bb70202d2cfd538fd77
import torch import torch.nn as nn class Model(nn.Module): """ Multi-Layer Perceptron network """ def __init__(self, obs_dim, dim_latent): """ Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent ...
ChannelGate2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ChannelGate2d(nn.Module): def __init__(self, channels, reduction=2): super(ChannelGate2d, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, padding=0) 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_...
bantiitnab/kaggle-TGS-salt-identification
ChannelGate2d
false
1,520
[ "MIT" ]
0
8b3350278b2ee8f01ba2a0734af9514d369f3228
https://github.com/bantiitnab/kaggle-TGS-salt-identification/tree/8b3350278b2ee8f01ba2a0734af9514d369f3228
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, channels, reduction=2): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, padding=0) self.relu = nn.ReLU(inplace=...
SpatialGate2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SpatialGate2d(nn.Module): def __init__(self, in_channels): super(SpatialGate2d, self).__init__() self.conv1 = nn.Conv2d(in_channels, 1, kernel_size=1, stride=1) self.sigmoid = nn.Sigmoid() def forward(self, x): cal = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bantiitnab/kaggle-TGS-salt-identification
SpatialGate2d
false
1,521
[ "MIT" ]
0
8b3350278b2ee8f01ba2a0734af9514d369f3228
https://github.com/bantiitnab/kaggle-TGS-salt-identification/tree/8b3350278b2ee8f01ba2a0734af9514d369f3228
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels): super().__init__() self.conv1 = nn.Conv2d(in_channels, 1, kernel_size=1, stride=1) self.sigmoid = nn.Sigmoid() def forward(self, x): cal = self.conv1(x) cal = self.sigmoid(cal)...
HingeLoss
# 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 HingeLoss(torch.nn.Module): def __init__(self): super(HingeLoss, self).__init__() def forward(self, x, y, margin=2): output = (margin - x + y).clamp(min=0) return output.mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] de...
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...
bashish101/ir
HingeLoss
false
1,522
[ "MIT" ]
0
cc90e86827c19035f38d0d85154f073a86aa9796
https://github.com/bashish101/ir/tree/cc90e86827c19035f38d0d85154f073a86aa9796
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y, margin=2): output = (margin - x + y).clamp(min=0) return output.mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs()...
Critic
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_size, action_size, action_parameter_size, hidden_layers=None, action_input_layer=0, init_type='normal', activation='leaky_relu', init_std=0.01): super(Critic, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bcahlit/MP-DQN
Critic
false
1,523
[ "MIT" ]
0
d80d34680e20192134f39e5b7c43abbc6bff3ba1
https://github.com/bcahlit/MP-DQN/tree/d80d34680e20192134f39e5b7c43abbc6bff3ba1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_size, action_size, action_parameter_size, hidden_layers=None, action_input_layer=0, init_type='normal', activation='leaky_relu', init_std=0.01): super().__init__() s...
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 numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ compute the bounds [-lim, lim] for subsequent uniform sampling with lim = 1/sqrt(nb_output) """ fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
bar0net/Udacity_DeepReinforcementLearning
Actor
false
1,524
[ "MIT" ]
0
3b5f98b7c2c1911b351be541fda3aa190bf48456
https://github.com/bar0net/Udacity_DeepReinforcementLearning/tree/3b5f98b7c2c1911b351be541fda3aa190bf48456
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ compute the bounds [-lim, lim] for subsequent uniform sampling with lim = 1/sqrt(nb_output) """ fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, li...
BertOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn import torch.nn as nn class BertOutput(nn.Module): """BERT output layer. Based on: BERT (pytorch-transformer) https://github.com/huggingface/transformers """ def __init__(self, config) ->None: 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.triton_helpers import libdevice import torch.nn imp...
bamf-health/MONAI
BertOutput
false
1,525
[ "Apache-2.0" ]
0
6a2086d21baf4b60c2ab3d400ed5c97cf24a0da9
https://github.com/bamf-health/MONAI/tree/6a2086d21baf4b60c2ab3d400ed5c97cf24a0da9
from _paritybench_helpers import _mock_config import torch import torch.nn import torch.nn as nn class Model(nn.Module): """BERT output layer. Based on: BERT (pytorch-transformer) https://github.com/huggingface/transformers """ def __init__(self, config) ->None: super().__init__() ...
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_size, action_size, action_parameter_size, hidden_layers=None, init_std=0.01, init_type='normal', activation= 'leaky_relu', squashing_function=False): super(Actor, self).__in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bcahlit/MP-DQN
Actor
false
1,526
[ "MIT" ]
0
d80d34680e20192134f39e5b7c43abbc6bff3ba1
https://github.com/bcahlit/MP-DQN/tree/d80d34680e20192134f39e5b7c43abbc6bff3ba1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_size, action_size, action_parameter_size, hidden_layers=None, init_std=0.01, init_type='normal', activation= 'leaky_relu', squashing_function=False): super().__init__() ...
BigRamDuel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class BigRamDuel(nn.Module): """ Definition: DuelDQNet(obs_size, act_size) """ def __init__(self, obs_size, act_size): super().__init__() self.base = nn.Linear(obs_size, 256) self.fc1 = nn.Linear(256, 256)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ayjabri/DeepRL
BigRamDuel
false
1,527
[ "MIT" ]
0
0be095e3a3d04f60b4cdc97ed330dffc17b3024a
https://github.com/ayjabri/DeepRL/tree/0be095e3a3d04f60b4cdc97ed330dffc17b3024a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """ Definition: DuelDQNet(obs_size, act_size) """ def __init__(self, obs_size, act_size): super().__init__() self.base = nn.Linear(obs_size, 256) self.fc1 = nn.Linear(256, 256) ...
duelingDQNnetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 duelingDQNnetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_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_...
beibeiJ/deep-reinforcement-learning
duelingDQNnetwork
false
1,528
[ "MIT" ]
0
ab1b0f4ada8da69af2e38d3e2e82e3ae55837c60
https://github.com/beibeiJ/deep-reinforcement-learning/tree/ab1b0f4ada8da69af2e38d3e2e82e3ae55837c60
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Params ====== state_size ...
LocAndConf
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 math import sqrt as sqrt from itertools import product as product class LocAndConf(nn.Module): def __init__(self, c_in, c_out, num_classes): super(LocAndConf, self).__init__() self.c_in = c_in self.c_out = c_out self.num_classes = num_classe...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 math import sqrt as sqrt from itertools import produc...
beichen2012/ssd.pytorch
LocAndConf
false
1,529
[ "MIT" ]
0
90b68a6903d2bef4c358e295d88b25e6fc6daf54
https://github.com/beichen2012/ssd.pytorch/tree/90b68a6903d2bef4c358e295d88b25e6fc6daf54
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class Model(nn.Module): def __init__(self, c_in, c_out, num_classes): super().__init__() self.c_in = c_in self.c_out = c_out self.num_classes = num_classes self.conv_l...
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, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, 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....
baturaysaglam/DISCOVER
Actor
false
1,530
[ "MIT" ]
0
423158c84a5935ca5755ccad06ea5fe20fb57d76
https://github.com/baturaysaglam/DISCOVER/tree/423158c84a5935ca5755ccad06ea5fe20fb57d76
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, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, action_dim) self....
PositionEncoder
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch import numpy as np import torch.nn as nn class PositionEncoder(nn.Module): """ Encodes the information into vectors There are 2 pieces of information that goes into the encoded information: 1. Word Embedding 2. Position Embedding Thi...
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...
benedictleedm/sgnlp
PositionEncoder
false
1,531
[ "MIT" ]
0
03f0fda8c517d9ca4baf737ce4c46b2495bbd3ba
https://github.com/benedictleedm/sgnlp/tree/03f0fda8c517d9ca4baf737ce4c46b2495bbd3ba
from _paritybench_helpers import _mock_config import torch import numpy as np import torch.nn as nn class Model(nn.Module): """ Encodes the information into vectors There are 2 pieces of information that goes into the encoded information: 1. Word Embedding 2. Position Embedding This set of c...
GeM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter from torch.nn.parameter import Parameter def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class GeM(nn.Module): def __init__(self, p=3.0,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
beesk135/ReID-Survey
GeM
false
1,532
[ "MIT" ]
0
d1467c0ce5d3ca78640196360a05df9ff9f9f42a
https://github.com/beesk135/ReID-Survey/tree/d1467c0ce5d3ca78640196360a05df9ff9f9f42a
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter from torch.nn.parameter import Parameter def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class Model(nn.Module): def __init__(self, p=3....
CoreNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CoreNetwork(nn.Module): """The core network. An RNN that maintains an internal state by integrating information extracted from the history of past observations. It encodes the agent's knowledge of the environment through a 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_...
bennzo/DT-RAM-PyTorch
CoreNetwork
false
1,533
[ "MIT" ]
0
b364662ab7650ffd26cf129673752521e004b13a
https://github.com/bennzo/DT-RAM-PyTorch/tree/b364662ab7650ffd26cf129673752521e004b13a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """The core network. An RNN that maintains an internal state by integrating information extracted from the history of past observations. It encodes the agent's knowledge of the environment through a state v...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_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....
azahed98/mellotron
MultiHeadAttention
false
1,534
[ "BSD-3-Clause" ]
0
02998743de820e379e0c7ff44506088d6e65c693
https://github.com/azahed98/mellotron/tree/02998743de820e379e0c7ff44506088d6e65c693
import torch import torch.utils.data from torch import nn import torch.nn.functional as F class Model(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_dim, num_units, nu...
StoppingNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.distributions import Bernoulli class StoppingNetwork(nn.Module): """The stopping network. Uses the internal state `h_t` of the core network to determine whether the network integrated enough information to make a confident ...
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 impo...
bennzo/DT-RAM-PyTorch
StoppingNetwork
false
1,535
[ "MIT" ]
0
b364662ab7650ffd26cf129673752521e004b13a
https://github.com/bennzo/DT-RAM-PyTorch/tree/b364662ab7650ffd26cf129673752521e004b13a
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Bernoulli class Model(nn.Module): """The stopping network. Uses the internal state `h_t` of the core network to determine whether the network integrated enough information to make a confident classifica...
SACActorNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SACActorNetwork(nn.Module): def __init__(self, input_shape, output_shape, n_features, **kwargs): super(SACActorNetwork, self).__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h1 = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
benvoe/mushroom-rl-benchmark
SACActorNetwork
false
1,536
[ "MIT" ]
0
217d8c077bf6f3febaed92821a2cf183c83f703b
https://github.com/benvoe/mushroom-rl-benchmark/tree/217d8c077bf6f3febaed92821a2cf183c83f703b
import torch import torch.nn.functional as F 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) ...
FeedForwardNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class FeedForwardNetwork(nn.Module): """ Based on the paper, each layer has 2 subayers: A multi-headed attention mechanism & a position-wise fully connected feed-forward network Each layer employs a 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....
benedictleedm/sgnlp
FeedForwardNetwork
false
1,537
[ "MIT" ]
0
03f0fda8c517d9ca4baf737ce4c46b2495bbd3ba
https://github.com/benedictleedm/sgnlp/tree/03f0fda8c517d9ca4baf737ce4c46b2495bbd3ba
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Model(nn.Module): """ Based on the paper, each layer has 2 subayers: A multi-headed attention mechanism & a position-wise fully connected feed-forward network Each layer employs a residual conne...
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 class MLP(torch.nn.Module): def __init__(self, insize, outsize=128, nonlinear=torch.nn.ReLU, activation=torch.nn.ReLU, hidden_layer_size=1, node_size=256): super(MLP, self).__init__() self.net = torch.nn.Sequential() self.net.add_module('fc_1', torch.nn.Linear(insize,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
bengisug/multiagent-particle-envs
MLP
false
1,538
[ "MIT" ]
0
c87280f18fbaf885932fe6da4d600ab474fd83fe
https://github.com/bengisug/multiagent-particle-envs/tree/c87280f18fbaf885932fe6da4d600ab474fd83fe
import torch class Model(torch.nn.Module): def __init__(self, insize, outsize=128, nonlinear=torch.nn.ReLU, activation=torch.nn.ReLU, hidden_layer_size=1, node_size=256): super().__init__() self.net = torch.nn.Sequential() self.net.add_module('fc_1', torch.nn.Linear(insize, node_s...
Classification
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Classification(torch.nn.Module): def __init__(self, num_class, hidden_dim): super(Classification, self).__init__() self.num_class = num_class self.label = nn.Linear(hidden_dim, num_class) def forward(self, input...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bentherien/measevalcompetition
Classification
false
1,539
[ "MIT" ]
0
1d285991eb26403682a633a728629a9900923d80
https://github.com/bentherien/measevalcompetition/tree/1d285991eb26403682a633a728629a9900923d80
import torch import torch.nn as nn import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self, num_class, hidden_dim): super().__init__() self.num_class = num_class self.label = nn.Linear(hidden_dim, num_class) def forward(self, input): outp = self.label(...
LocationNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.distributions import Normal class LocationNetwork(nn.Module): """The location network. Uses the internal state `h_t` of the core network to produce the location coordinates `l_t` for the next time step. Concretely, fee...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bennzo/DT-RAM-PyTorch
LocationNetwork
false
1,540
[ "MIT" ]
0
b364662ab7650ffd26cf129673752521e004b13a
https://github.com/bennzo/DT-RAM-PyTorch/tree/b364662ab7650ffd26cf129673752521e004b13a
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal class Model(nn.Module): """The location network. Uses the internal state `h_t` of the core network to produce the location coordinates `l_t` for the next time step. Concretely, feeds the hid...
A2CNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 A2CNetwork(nn.Module): def __init__(self, input_shape, output_shape, n_features, **kwargs): super(A2CNetwork, self).__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h1 = nn.Linear(n_input, n_features) self._h2 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
benvoe/mushroom-rl-benchmark
A2CNetwork
false
1,541
[ "MIT" ]
0
217d8c077bf6f3febaed92821a2cf183c83f703b
https://github.com/benvoe/mushroom-rl-benchmark/tree/217d8c077bf6f3febaed92821a2cf183c83f703b
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...
BertMixedLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch import torch.nn import torch.nn as nn class BertAttention(nn.Module): """BERT attention layer. Based on: BERT (pytorch-transformer) https://github.com/huggingface/transformers """ def __init__(self, config) ->None: sup...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bamf-health/MONAI
BertMixedLayer
false
1,542
[ "Apache-2.0" ]
0
6a2086d21baf4b60c2ab3d400ed5c97cf24a0da9
https://github.com/bamf-health/MONAI/tree/6a2086d21baf4b60c2ab3d400ed5c97cf24a0da9
from _paritybench_helpers import _mock_config import math import torch import torch.nn import torch.nn as nn class BertAttention(nn.Module): """BERT attention layer. Based on: BERT (pytorch-transformer) https://github.com/huggingface/transformers """ def __init__(self, config) ->None: sup...
SACCriticNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SACCriticNetwork(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_featur...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
benvoe/mushroom-rl-benchmark
SACCriticNetwork
false
1,543
[ "MIT" ]
0
217d8c077bf6f3febaed92821a2cf183c83f703b
https://github.com/benvoe/mushroom-rl-benchmark/tree/217d8c077bf6f3febaed92821a2cf183c83f703b
import torch import torch.nn.functional as F 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) ...
Time2Vec
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Time2Vec(nn.Module): def __init__(self, input_dim=4, embed_dim=248, act_function=torch.sin): assert embed_dim % input_dim == 0 super(Time2Vec, self).__init__() self.enabled = embed_dim > 0 if self.enabled: self.embed_dim = embed_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
bernhein/spacetimeformer
Time2Vec
false
1,544
[ "MIT" ]
0
de252b68085943d979606fe69e177ac2a14586e7
https://github.com/bernhein/spacetimeformer/tree/de252b68085943d979606fe69e177ac2a14586e7
import torch from torch import nn class Model(nn.Module): def __init__(self, input_dim=4, embed_dim=248, act_function=torch.sin): assert embed_dim % input_dim == 0 super().__init__() self.enabled = embed_dim > 0 if self.enabled: self.embed_dim = embed_dim // input_dim ...
HardSwish
# 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 HardSwish(nn.Module): def __init__(self): super().__init__() self.relu6 = nn.ReLU6() def forward(self, x): return self.relu6(x + 3.0) / 6.0 * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
binyao2020/ElegantRL
HardSwish
false
1,545
[ "Apache-2.0" ]
0
bf79f0d071d00cd93be03f1ca005020c3ab8dfe0
https://github.com/binyao2020/ElegantRL/tree/bf79f0d071d00cd93be03f1ca005020c3ab8dfe0
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.relu6 = nn.ReLU6() def forward(self, x): return self.relu6(x + 3.0) / 6.0 * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RMSELoss
# 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 as th import torch.nn as nn class RMSELoss(nn.Module): def __init__(self, reduction='mean', eps=1e-06): super().__init__() self.mse = nn.MSELoss(reduction=reduction) self.eps = eps def forward(self, yhat, y): loss = th.sqrt(self.mse(yhat, y) + self.e...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
bio-ontology-research-group/OntoML
RMSELoss
false
1,546
[ "BSD-3-Clause" ]
0
4cdc17dc7ee26464db96c67838c3e77dba5318f9
https://github.com/bio-ontology-research-group/OntoML/tree/4cdc17dc7ee26464db96c67838c3e77dba5318f9
import torch import torch as th import torch.nn as nn class Model(nn.Module): def __init__(self, reduction='mean', eps=1e-06): super().__init__() self.mse = nn.MSELoss(reduction=reduction) self.eps = eps def forward(self, yhat, y): loss = th.sqrt(self.mse(yhat, y) + self.eps)...
GumbelQuantize
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch import einsum import torch.nn.functional as F class GumbelQuantize(nn.Module): """ Gumbel Softmax trick quantizer Categorical Reparameterization with Gumbel-Softmax, Jang et al. 2016 https://arxiv.org/abs/1611.01144 """ def __init__(self, num_hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
baudm/deep-vector-quantization
GumbelQuantize
false
1,547
[ "MIT" ]
0
211bda99a6c750c1e65aff082aa865fed8677b8a
https://github.com/baudm/deep-vector-quantization/tree/211bda99a6c750c1e65aff082aa865fed8677b8a
import torch from torch import nn from torch import einsum import torch.nn.functional as F class Model(nn.Module): """ Gumbel Softmax trick quantizer Categorical Reparameterization with Gumbel-Softmax, Jang et al. 2016 https://arxiv.org/abs/1611.01144 """ def __init__(self, num_hiddens, n_emb...
TwoMLPHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn from torchvision.transforms import functional as F import torch.nn.functional as F class TwoMLPHead(nn.Module): """ Heads for FPN for classification """ def __init__(self, in_channels, representation_size): super(TwoMLPHead, self).__in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
billchenxi/vision
TwoMLPHead
false
1,548
[ "BSD-3-Clause" ]
0
5608b06a6fbc9c84284dad9f07a16df61da10f85
https://github.com/billchenxi/vision/tree/5608b06a6fbc9c84284dad9f07a16df61da10f85
import torch import torch.utils.data from torch import nn from torchvision.transforms import functional as F import torch.nn.functional as F class Model(nn.Module): """ Heads for FPN for classification """ def __init__(self, in_channels, representation_size): super().__init__() self.f...
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) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bhattsachin/deep-reinforcement-learning
QNetwork
false
1,549
[ "MIT" ]
0
4d75b012495009bf156273e170d75caf400fa7aa
https://github.com/bhattsachin/deep-reinforcement-learning/tree/4d75b012495009bf156273e170d75caf400fa7aa
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state ...