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
ResBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def set_activate_layer(types): if types == 'relu': activation = nn.ReLU() elif types == 'lrelu': activation = nn.LeakyReLU(0.2) elif types == 'tanh': activation = nn.Tanh() elif types == 'sig': activation = nn.Sigmoid() elif types ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
innerverz/CodeTemplate
ResBlock
false
3,681
[ "MIT" ]
0
a20f5d24b0b79871aa39b5cde33e3bb4d2507d13
https://github.com/innerverz/CodeTemplate/tree/a20f5d24b0b79871aa39b5cde33e3bb4d2507d13
import torch import torch.nn as nn def set_activate_layer(types): if types == 'relu': activation = nn.ReLU() elif types == 'lrelu': activation = nn.LeakyReLU(0.2) elif types == 'tanh': activation = nn.Tanh() elif types == 'sig': activation = nn.Sigmoid() elif types ...
MSE
# 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 MSE(nn.Module): def __init__(self): super().__init__() def forward(self, pred, gt): loss = torch.mean(torch.pow(pred - gt, 2)) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_input...
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...
j1a0m0e4sNTU/MachineLearning2019
MSE
false
3,682
[ "MIT" ]
0
44a7a3387837e53134bcf5eb8fcf95daf4dff48d
https://github.com/j1a0m0e4sNTU/MachineLearning2019/tree/44a7a3387837e53134bcf5eb8fcf95daf4dff48d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, pred, gt): loss = torch.mean(torch.pow(pred - gt, 2)) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inp...
ComplexConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class ComplexConv(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(ComplexConv, self).__init__() self.device = torch.device('cuda' if torch.cuda.is_a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ishine/multiASR
ComplexConv
false
3,683
[ "Apache-2.0" ]
0
991ea2b12ea8ea4a4beeeba42c156e632c389062
https://github.com/ishine/multiASR/tree/991ea2b12ea8ea4a4beeeba42c156e632c389062
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super().__init__() self.device = torch.device('cuda' if torch.cuda.is_available() else ...
CausalSelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class CausalSelfAttention(nn.Module): """ A vanilla multi-head masked self-attention layer with a projection at the end. It is possible to use torch.nn.MultiheadAttention here but I am including an explicit implementation h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
itsdaniele/graphtrans
CausalSelfAttention
false
3,684
[ "Apache-2.0" ]
0
9cdf68af725b258deced4424dbcd5942a481ff8d
https://github.com/itsdaniele/graphtrans/tree/9cdf68af725b258deced4424dbcd5942a481ff8d
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ A vanilla multi-head masked self-attention layer with a projection at the end. It is possible to use torch.nn.MultiheadAttention here but I am including an explicit implementation here to show th...
TransformerEncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Linear from torch.nn import Dropout from torch.nn import LayerNorm from torch.nn import Identity def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """ Obtained from: github.com: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....
iliasprc/Compact-Transformers
TransformerEncoderLayer
false
3,685
[ "Apache-2.0" ]
0
31975a0b4469854dfb0e0cbcedd8f0698cf84a7e
https://github.com/iliasprc/Compact-Transformers/tree/31975a0b4469854dfb0e0cbcedd8f0698cf84a7e
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Linear from torch.nn import Dropout from torch.nn import LayerNorm from torch.nn import Identity def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """ Obtained from: github.com:r...
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 FcCat(nn.Module): def __init__(self, nIn, nOut): super(FcCat, self).__init__() self.fc = nn.Linear(nIn, nOut, bias=False) def forward(self, x): out = torch.cat((x, self.fc(x)), 1) return out class Net(nn.Module): def __init__(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
huangzsdy/pytorch_basic_learning
Net
false
3,686
[ "Apache-2.0" ]
0
7880bc3fcee1d38623d93fa2a36482ccde0e335a
https://github.com/huangzsdy/pytorch_basic_learning/tree/7880bc3fcee1d38623d93fa2a36482ccde0e335a
import torch import torch.nn as nn class FcCat(nn.Module): def __init__(self, nIn, nOut): super().__init__() self.fc = nn.Linear(nIn, nOut, bias=False) def forward(self, x): out = torch.cat((x, self.fc(x)), 1) return out class Model(nn.Module): def __init__(self, nFeat...
CriticArchitecture
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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): """ Initializer function for weights in Pytorch :param layer: number of hidden layers to implement :return: None """ fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_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 numpy as np import tor...
ivallesp/RL_Tennis
CriticArchitecture
false
3,687
[ "MIT" ]
0
a83933af9c4481d50f735983b4fc3b1f053f71d1
https://github.com/ivallesp/RL_Tennis/tree/a83933af9c4481d50f735983b4fc3b1f053f71d1
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ Initializer function for weights in Pytorch :param layer: number of hidden layers to implement :return: None """ fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in...
MaskedTransformerEncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Linear from torch.nn import Dropout from torch.nn import LayerNorm from torch.nn import Identity def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """ Obtained from: github.com: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....
iliasprc/Compact-Transformers
MaskedTransformerEncoderLayer
false
3,688
[ "Apache-2.0" ]
0
31975a0b4469854dfb0e0cbcedd8f0698cf84a7e
https://github.com/iliasprc/Compact-Transformers/tree/31975a0b4469854dfb0e0cbcedd8f0698cf84a7e
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Linear from torch.nn import Dropout from torch.nn import LayerNorm from torch.nn import Identity def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """ Obtained from: github.com:r...
BCELoss2d
# 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.backends.cudnn import torch.utils.data class BCELoss2d(nn.Module): """ Binary Cross Entropy loss function """ def __init__(self): super(BCELoss2d, self).__init__() self.bce_loss = nn.BCEWithLogitsLoss() def forward(self, logits, lab...
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...
jayden-chua/image-mask
BCELoss2d
false
3,689
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data class Model(nn.Module): """ Binary Cross Entropy loss function """ def __init__(self): super().__init__() self.bce_loss = nn.BCEWithLogitsLoss() def forward(self, logits, labels): logit...
BinaryCrossEntropyLoss2d
# 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 import torch.backends.cudnn import torch.utils.data class BinaryCrossEntropyLoss2d(nn.Module): def __init__(self, weight=None, size_average=True): """ Binary cross entropy loss 2D Args: weight: size...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
jayden-chua/image-mask
BinaryCrossEntropyLoss2d
false
3,690
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class Model(nn.Module): def __init__(self, weight=None, size_average=True): """ Binary cross entropy loss 2D Args: weight: size_average: "...
DiceScore
# 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 import torch.backends.cudnn import torch.utils.data class DiceScore(nn.Module): def __init__(self, threshold=0.5): super(DiceScore, self).__init__() self.threshold = threshold def forward(self, logits, labels): probs ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.backends.cudnn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
jayden-chua/image-mask
DiceScore
false
3,691
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class Model(nn.Module): def __init__(self, threshold=0.5): super().__init__() self.threshold = threshold def forward(self, logits, labels): probs = F.sigmoid(logits)...
DisConvModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.utils import spectral_norm as spectral_norm_fn from torch.nn.utils import weight_norm as weight_norm_fn def dis_conv(input_dim, output_dim, kernel_size=5, stride=2, padding=0, rate=1, activation='lrelu', weight_norm='none'): return Conv2dBlock(input_dim, output...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.utils import spectral_norm as spectral_norm_...
jacobwjs/generative-inpainting-pytorch
DisConvModule
false
3,692
[ "MIT" ]
0
5cd5e818aa7394444b6c21df448d8b395492e4d7
https://github.com/jacobwjs/generative-inpainting-pytorch/tree/5cd5e818aa7394444b6c21df448d8b395492e4d7
import torch import torch.nn as nn from torch.nn.utils import spectral_norm as spectral_norm_fn from torch.nn.utils import weight_norm as weight_norm_fn def dis_conv(input_dim, output_dim, kernel_size=5, stride=2, padding=0, rate=1, activation='lrelu', weight_norm='none'): return Conv2dBlock(input_dim, output...
RelativeMultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn.functional as F import torch.nn as nn class RelativeMultiHeadAttention(nn.Module): def __init__(self, channels, num_heads, dropout): super(RelativeMultiHeadAttention, self).__init__() assert channels % num_heads == 0, 'd_model % num_heads should be zero.' ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math i...
ishine/tfm-tts
RelativeMultiHeadAttention
false
3,693
[ "MIT" ]
0
a964736467851ddec8f8e8933b9550cbe7d7d7eb
https://github.com/ishine/tfm-tts/tree/a964736467851ddec8f8e8933b9550cbe7d7d7eb
import math import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, channels, num_heads, dropout): super().__init__() assert channels % num_heads == 0, 'd_model % num_heads should be zero.' self.channels = channels self.inner_c...
WeightedSoftDiceLoss
# 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 import torch.backends.cudnn import torch.utils.data class WeightedSoftDiceLoss(nn.Module): def __init__(self): super(WeightedSoftDiceLoss, self).__init__() def forward(self, logits, labels, weights): probs = F.sigmoid(logits)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.backends.cudnn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
jayden-chua/image-mask
WeightedSoftDiceLoss
false
3,694
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, logits, labels, weights): probs = F.sigmoid(logits) num = labels.size(0) w =...
QuaternionLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import numpy as np from numpy.random import RandomState from torch.nn.parameter import Parameter def quaternion_init(in_features, out_features, rng, kernel_size=None, criterion='glorot'): if kernel_size is not None: receptive_field = np.prod(kernel_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import numpy as np from numpy.random import RandomSt...
ispamm/DualQSELD-TCN
QuaternionLinear
false
3,695
[ "MIT" ]
0
fc5dc8840b4fdd8cb09f8f92e628561417df268a
https://github.com/ispamm/DualQSELD-TCN/tree/fc5dc8840b4fdd8cb09f8f92e628561417df268a
from torch.nn import Module import torch import numpy as np from numpy.random import RandomState from torch.nn.parameter import Parameter def quaternion_init(in_features, out_features, rng, kernel_size=None, criterion='glorot'): if kernel_size is not None: receptive_field = np.prod(kernel_size) ...
SoftDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class SoftDiceLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): 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 import torch.nn as nn import torch.backends.cudnn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
jayden-chua/image-mask
SoftDiceLoss
false
3,696
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class Model(nn.Module): def __init__(self, weight=None, size_average=True): super().__init__() def forward(self, logits, targets): smooth = 1 num = targets.size(0) ...
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.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data def dice_loss(preds, trues, weight=None, is_average=True): num = preds.size(0) preds = preds.view(num, -1) trues = trues.view(num, -1) if weight is not None: w = torch.autogra...
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.backends.cudnn import torch.utils.data assert_size_str...
jayden-chua/image-mask
DiceLoss
false
3,697
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data def dice_loss(preds, trues, weight=None, is_average=True): num = preds.size(0) preds = preds.view(num, -1) trues = trues.view(num, -1) if weight is not None: w = torch.autogra...
Conv3BN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.backends.cudnn import torch.utils.data def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Conv3BN(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) 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 ...
jayden-chua/image-mask
Conv3BN
false
3,698
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Model(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) self....
WeightedBCELoss2d
# 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.backends.cudnn import torch.utils.data class WeightedBCELoss2d(nn.Module): def __init__(self): super(WeightedBCELoss2d, self).__init__() def forward(self, logits, labels, weights): w = weights.view(-1) logits = logits.view(-1) g...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
jayden-chua/image-mask
WeightedBCELoss2d
false
3,699
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, logits, labels, weights): w = weights.view(-1) logits = logits.view(-1) gt = labels.view(-1) loss = ...
BCEDiceLoss
# 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 import torch.backends.cudnn import torch.utils.data def dice_loss(preds, trues, weight=None, is_average=True): num = preds.size(0) preds = preds.view(num, -1) trues = trues.view(num, -1) if weight is not None: w = torch.autogra...
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...
jayden-chua/image-mask
BCEDiceLoss
false
3,700
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data def dice_loss(preds, trues, weight=None, is_average=True): num = preds.size(0) preds = preds.view(num, -1) trues = trues.view(num, -1) if weight is not None: w = torch.autogra...
DenseCrossEntropy
# 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.functional as F import torch.nn.functional as F class DenseCrossEntropy(nn.Module): def __init__(self): super(DenseCrossEntropy, self).__init__() def forward(self, logits, labels): logits = logits.float() labels = labels.float() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
grok-phantom/pytorch_tempest
DenseCrossEntropy
false
3,701
[ "MIT" ]
0
37921b5824f9fcb853da3f54d929c4855672416e
https://github.com/grok-phantom/pytorch_tempest/tree/37921b5824f9fcb853da3f54d929c4855672416e
import torch from torch import nn import torch.functional as F import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, logits, labels): logits = logits.float() labels = labels.float() logprobs = F.log_softmax(logits, di...
LightHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 RMSNorm(nn.Module): """An implementation of RMS Normalization. # https://catalyst-team.github.io/catalyst/_modules/catalyst/contrib/nn/modules/rms_norm.html#RMSNorm """ def __init__(self, dimension: 'int', epsilon: 'float'=1e-08, is_bias: 'bool'=False)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
grok-phantom/pytorch_tempest
LightHead
false
3,702
[ "MIT" ]
0
37921b5824f9fcb853da3f54d929c4855672416e
https://github.com/grok-phantom/pytorch_tempest/tree/37921b5824f9fcb853da3f54d929c4855672416e
import torch from torch import nn class RMSNorm(nn.Module): """An implementation of RMS Normalization. # https://catalyst-team.github.io/catalyst/_modules/catalyst/contrib/nn/modules/rms_norm.html#RMSNorm """ def __init__(self, dimension: 'int', epsilon: 'float'=1e-08, is_bias: 'bool'=False)...
RelativeSelfAttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn.functional as F import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, channels, eps=1e-05): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) self.beta = nn.Par...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ishine/tfm-tts
RelativeSelfAttentionLayer
false
3,703
[ "MIT" ]
0
a964736467851ddec8f8e8933b9550cbe7d7d7eb
https://github.com/ishine/tfm-tts/tree/a964736467851ddec8f8e8933b9550cbe7d7d7eb
import math import torch import torch.nn.functional as F import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, channels, eps=1e-05): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) self.beta = nn.Par...
CosineActivation
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn def t2v(tau, f, out_features, w, b, w0, b0, arg=None): if arg: v1 = f(torch.matmul(tau, w) + b, arg) else: v1 = f(torch.matmul(tau, w) + b) v2 = torch.matmul(tau, w0) + b0 return torch.cat([v1, v2], 1) class CosineActivation(nn.Module): def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
jaredfeng-ca/Time2Vec-PyTorch
CosineActivation
false
3,704
[ "MIT" ]
0
b42205f6721f5a6faf16134e604af28476490d0a
https://github.com/jaredfeng-ca/Time2Vec-PyTorch/tree/b42205f6721f5a6faf16134e604af28476490d0a
import torch from torch import nn def t2v(tau, f, out_features, w, b, w0, b0, arg=None): if arg: v1 = f(torch.matmul(tau, w) + b, arg) else: v1 = f(torch.matmul(tau, w) + b) v2 = torch.matmul(tau, w0) + b0 return torch.cat([v1, v2], 1) class Model(nn.Module): def __init__(self, ...
UNetModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.backends.cudnn import torch.utils.data def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Conv3BN(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) 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 ...
jayden-chua/image-mask
UNetModule
false
3,705
[ "MIT" ]
0
ce2c6a32bf13df582e7b57e506d58518258be292
https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Conv3BN(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) sel...
SineActivation
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn def t2v(tau, f, out_features, w, b, w0, b0, arg=None): if arg: v1 = f(torch.matmul(tau, w) + b, arg) else: v1 = f(torch.matmul(tau, w) + b) v2 = torch.matmul(tau, w0) + b0 return torch.cat([v1, v2], 1) class SineActivation(nn.Module): def __init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
jaredfeng-ca/Time2Vec-PyTorch
SineActivation
false
3,706
[ "MIT" ]
0
b42205f6721f5a6faf16134e604af28476490d0a
https://github.com/jaredfeng-ca/Time2Vec-PyTorch/tree/b42205f6721f5a6faf16134e604af28476490d0a
import torch from torch import nn def t2v(tau, f, out_features, w, b, w0, b0, arg=None): if arg: v1 = f(torch.matmul(tau, w) + b, arg) else: v1 = f(torch.matmul(tau, w) + b) v2 = torch.matmul(tau, w0) + b0 return torch.cat([v1, v2], 1) class Model(nn.Module): def __init__(self, ...
PairwiseDistance
# 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 PairwiseDistance(nn.Module): """class for calculating distance Arguments: nn {[type]} -- [description] """ def __init__(self, smooth=0.0001): """Initializer Arguments: smooth {int} -- [description] """ supe...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
jce2090/palmprint-recognition
PairwiseDistance
false
3,707
[ "MIT" ]
0
d2d93c6817afe1b67650dae6516a3d180aaeca38
https://github.com/jce2090/palmprint-recognition/tree/d2d93c6817afe1b67650dae6516a3d180aaeca38
import torch import torch.nn as nn class Model(nn.Module): """class for calculating distance Arguments: nn {[type]} -- [description] """ def __init__(self, smooth=0.0001): """Initializer Arguments: smooth {int} -- [description] """ super().__init_...
DAImgHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F import torch.cuda.amp class DAImgHead(nn.Module): """ Add a simple Image-level Domain Classifier head """ def __init__(self, in_channels): """ Arguments: in_cha...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
enpko47/DA-CenterNet
DAImgHead
false
3,708
[ "MIT" ]
0
ef0a99b8ba741fa1dbd66fa58ccae9bf8759ae86
https://github.com/enpko47/DA-CenterNet/tree/ef0a99b8ba741fa1dbd66fa58ccae9bf8759ae86
import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F import torch.cuda.amp class Model(nn.Module): """ Add a simple Image-level Domain Classifier head """ def __init__(self, in_channels): """ Arguments: in_channel...
ShiftSoftplus
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch.nn import Softplus class ShiftSoftplus(Softplus): """ Shiftsoft plus activation function: 1/beta * (log(1 + exp**(beta * x)) - log(shift)) """ def __init__(self, beta=1, shift=2, threshold=20): super().__init__(beta, threshold) self.s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch.nn import Softplus assert_size_stride = torch._C._d...
jeah-z/BDE-FGCN-DFT
ShiftSoftplus
false
3,709
[ "MIT" ]
0
5542544079642a371f08c8c1f356fa235d895194
https://github.com/jeah-z/BDE-FGCN-DFT/tree/5542544079642a371f08c8c1f356fa235d895194
import torch import numpy as np from torch.nn import Softplus class Model(Softplus): """ Shiftsoft plus activation function: 1/beta * (log(1 + exp**(beta * x)) - log(shift)) """ def __init__(self, beta=1, shift=2, threshold=20): super().__init__(beta, threshold) self.shift = s...
PyTorchMlp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PyTorchMlp(nn.Module): def __init__(self, n_inputs=4, n_actions=2): nn.Module.__init__(self) self.fc1 = nn.Linear(n_inputs, 512) self.fc2 = nn.Linear(512, 256) self.fc3 = nn.Linear(256, n_actions) self.activ_fn = nn.ReLU() 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....
jasonjabbour/motion_imitation
PyTorchMlp
false
3,710
[ "Apache-2.0" ]
0
a28e7cd9dca2fbdd6823f19db4f66b496dd29144
https://github.com/jasonjabbour/motion_imitation/tree/a28e7cd9dca2fbdd6823f19db4f66b496dd29144
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_inputs=4, n_actions=2): nn.Module.__init__(self) self.fc1 = nn.Linear(n_inputs, 512) self.fc2 = nn.Linear(512, 256) self.fc3 = nn.Linear(256, n_actions) self.activ_fn = nn.ReLU() self.o...
DNHloss
# 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 DNHloss(nn.Module): """DNH loss function Arguments: nn {[type]} -- [description] """ def __init__(self, lamda): """Initializer class Arguments: lamda {[type]} -- [description] """ super(DNHloss, self).__ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jce2090/palmprint-recognition
DNHloss
false
3,711
[ "MIT" ]
0
d2d93c6817afe1b67650dae6516a3d180aaeca38
https://github.com/jce2090/palmprint-recognition/tree/d2d93c6817afe1b67650dae6516a3d180aaeca38
import torch import torch.nn as nn class Model(nn.Module): """DNH loss function Arguments: nn {[type]} -- [description] """ def __init__(self, lamda): """Initializer class Arguments: lamda {[type]} -- [description] """ super().__init__() s...
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....
hav4ik/AdelaiDet
folder
false
3,712
[ "BSD-2-Clause" ]
0
6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2
https://github.com/hav4ik/AdelaiDet/tree/6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2
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) ...
TripletMarginLoss
# 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 PairwiseDistance(nn.Module): """class for calculating distance Arguments: nn {[type]} -- [description] """ def __init__(self, smooth=0.0001): """Initializer Arguments: smooth {int} -- [description] """ supe...
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...
jce2090/palmprint-recognition
TripletMarginLoss
false
3,713
[ "MIT" ]
0
d2d93c6817afe1b67650dae6516a3d180aaeca38
https://github.com/jce2090/palmprint-recognition/tree/d2d93c6817afe1b67650dae6516a3d180aaeca38
import torch import torch.nn as nn class PairwiseDistance(nn.Module): """class for calculating distance Arguments: nn {[type]} -- [description] """ def __init__(self, smooth=0.0001): """Initializer Arguments: smooth {int} -- [description] """ supe...
NeuralNerwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 NeuralNerwork(nn.Module): def __init__(self, n_features, n_targets): super(NeuralNerwork, self).__init__() self.fc1 = nn.Linear(n_features, 15) self.fc2 = nn.Linear(15, 10) self.fc3 = nn.Linear(10, n_targets)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
jf20541/NeuralNetworks
NeuralNerwork
false
3,714
[ "MIT" ]
0
ee36b734880f30d9e8691205dadcd074795bdff3
https://github.com/jf20541/NeuralNetworks/tree/ee36b734880f30d9e8691205dadcd074795bdff3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_features, n_targets): super().__init__() self.fc1 = nn.Linear(n_features, 15) self.fc2 = nn.Linear(15, 10) self.fc3 = nn.Linear(10, n_targets) self.dropout = nn....
ScModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch as t import torch.nn as nn from torch.nn.parameter import Parameter class ScModel(nn.Module): """ Model for single cell data """ def __init__(self, n_genes: 'int', n_celltypes: 'int', device: 't.device' ) ->None: super().__init__() self.K = n_celltypes ...
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...
jfnavarro/stereoscope
ScModel
false
3,715
[ "MIT" ]
0
0a64db45291c3a9b72abdf13183614a10f3dac40
https://github.com/jfnavarro/stereoscope/tree/0a64db45291c3a9b72abdf13183614a10f3dac40
import torch import torch as t import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): """ Model for single cell data """ def __init__(self, n_genes: 'int', n_celltypes: 'int', device: 't.device' ) ->None: super().__init__() self.K = n_celltypes ...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super(Conv2D, self).__init__() assert type(kernel_size) in [int,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.nn.functional as F import torch.nn.parallel as...
hav4ik/AdelaiDet
GCN
false
3,716
[ "BSD-2-Clause" ]
0
6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2
https://github.com/hav4ik/AdelaiDet/tree/6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super().__init__() assert type(kernel_size) in [int, tuple ...
maxout
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class maxout(nn.Module): def __init__(self, in_feature, out_feature, pool_size): super(maxout, self).__init__() self.in_feature = in_feature self.out_feature = out_feature self.pool_size = pool_size self.linear = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
jiahuanluo/Global-Encoding
maxout
false
3,717
[ "MIT" ]
0
2adb01def9525588b3a75e6f2a5181a3a11464ed
https://github.com/jiahuanluo/Global-Encoding/tree/2adb01def9525588b3a75e6f2a5181a3a11464ed
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, in_feature, out_feature, pool_size): super().__init__() self.in_feature = in_feature self.out_feature = out_feature self.pool_size = pool_size self.linear = nn.Linear(in_f...
Gather
# 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 Gather(torch.nn.Module): """ gather """ @staticmethod def modify_commandline_options(parser, is_train): return parser def __init__(self, F, K, use_mask=False): super().__init__() self.K = K self.F = F self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jhp038/fashion_project
Gather
false
3,718
[ "MIT" ]
0
719533dc60155801f567e6a9183d7a5036ee1166
https://github.com/jhp038/fashion_project/tree/719533dc60155801f567e6a9183d7a5036ee1166
import torch import torch.nn as nn class Model(torch.nn.Module): """ gather """ @staticmethod def modify_commandline_options(parser, is_train): return parser def __init__(self, F, K, use_mask=False): super().__init__() self.K = K self.F = F self.s...
NaiveGroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel class NaiveGroupNorm(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to export GN by ONNX before the...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module from torch.nn import Parameter from torch.nn import...
hav4ik/AdelaiDet
NaiveGroupNorm
false
3,719
[ "BSD-2-Clause" ]
0
6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2
https://github.com/hav4ik/AdelaiDet/tree/6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2
from torch.nn import Module import torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel class Model(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to export GN by ONNX before the official...
UpsampleLayer
# 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 UpsampleLayer(nn.Module): """ """ def __init__(self, scale_factor, mode='bilinear'): """ :param scale_factor: :param mode: """ super().__init__() self.scale_factor = scale_factor self.mode = mode def f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
jianantian/yolo3-pytorch
UpsampleLayer
false
3,720
[ "BSD-3-Clause" ]
0
8966f04c5b514a4f60fcb63b1fc753d0b13ebdcc
https://github.com/jianantian/yolo3-pytorch/tree/8966f04c5b514a4f60fcb63b1fc753d0b13ebdcc
import torch import torch.nn as nn class Model(nn.Module): """ """ def __init__(self, scale_factor, mode='bilinear'): """ :param scale_factor: :param mode: """ super().__init__() self.scale_factor = scale_factor self.mode = mode def forward(s...
KLDLoss
# 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 from torch import nn class KLDLoss(nn.Module): def __init__(self, opt): super().__init__() def forward(self, mu, logvar): kld_loss = torch.mean(-0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp(), dim=1), dim=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.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
DSciLab/VAE-Lab
KLDLoss
false
3,721
[ "MIT" ]
0
ab37cc1399e3ece28ce426d8bd31149b8f492f82
https://github.com/DSciLab/VAE-Lab/tree/ab37cc1399e3ece28ce426d8bd31149b8f492f82
from _paritybench_helpers import _mock_config import torch from torch import nn class Model(nn.Module): def __init__(self, opt): super().__init__() def forward(self, mu, logvar): kld_loss = torch.mean(-0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp(), dim=1), dim=0) ...
MovingAvg
# 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.fft class MovingAvg(nn.Module): """Moving average block to highlight the trend of time series.""" def __init__(self, kernel_size, stride): super(MovingAvg, self).__init__() self.kernel_size = kernel_size self.avg = nn.AvgPool1d(kernel_si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
jianzhnie/TsFormer
MovingAvg
false
3,722
[ "Apache-2.0" ]
0
47e362f02445ba00d5ab8db206667767e72faca7
https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7
import torch import torch.nn as nn import torch.fft class Model(nn.Module): """Moving average block to highlight the trend of time series.""" def __init__(self, kernel_size, stride): super().__init__() self.kernel_size = kernel_size self.avg = nn.AvgPool1d(kernel_size=kernel_size, str...
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...
from torch.nn import Module import torch from torch.nn import Linear from torch.nn import Sigmoid from torch.nn.init import xavier_uniform_ class MLP(Module): """ Defines the NN model - in this case, there are 3 hidden layers, 13 inputs (defined by data) in the 1st, 10 inputs in the second, and 8 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.nn import Module from torch.nn import Linear from torch.nn import Sig...
jfmalloy1/UltraMarathon_Prediction
MLP
false
3,724
[ "MIT" ]
0
8eef7bd2860ce255994d32a0150c09b3b655cee7
https://github.com/jfmalloy1/UltraMarathon_Prediction/tree/8eef7bd2860ce255994d32a0150c09b3b655cee7
from torch.nn import Module import torch from torch.nn import Linear from torch.nn import Sigmoid from torch.nn.init import xavier_uniform_ class Model(Module): """ Defines the NN model - in this case, there are 3 hidden layers, 13 inputs (defined by data) in the 1st, 10 inputs in the second, and 8 ...
CoarseGenerator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm as spectral_norm_fn from torch.nn.utils import weight_norm as weight_norm_fn def gen_conv(input_dim, output_dim, kernel_size=3, stride=1, padding=0, rate=1, activation='elu', gated=False): """ Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jacobwjs/generative-inpainting-pytorch
CoarseGenerator
false
3,725
[ "MIT" ]
0
5cd5e818aa7394444b6c21df448d8b395492e4d7
https://github.com/jacobwjs/generative-inpainting-pytorch/tree/5cd5e818aa7394444b6c21df448d8b395492e4d7
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm as spectral_norm_fn from torch.nn.utils import weight_norm as weight_norm_fn def gen_conv(input_dim, output_dim, kernel_size=3, stride=1, padding=0, rate=1, activation='elu', gated=False): """ Conv...
SeasonalLayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.fft class SeasonalLayerNorm(nn.Module): """Special designed layernorm for the seasonal part.""" def __init__(self, channels): super(SeasonalLayerNorm, self).__init__() self.layernorm = nn.LayerNorm(channels) def forward(self, x): x_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.gu...
jianzhnie/TsFormer
SeasonalLayerNorm
false
3,726
[ "Apache-2.0" ]
0
47e362f02445ba00d5ab8db206667767e72faca7
https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7
import torch import torch.nn as nn import torch.fft class Model(nn.Module): """Special designed layernorm for the seasonal part.""" def __init__(self, channels): super().__init__() self.layernorm = nn.LayerNorm(channels) def forward(self, x): x_hat = self.layernorm(x) bia...
TokenEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.fft class TokenEmbedding(nn.Module): def __init__(self, c_in, d_model): super(TokenEmbedding, self).__init__() padding = 1 if torch.__version__ >= '1.5.0' else 2 self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.gua...
jianzhnie/TsFormer
TokenEmbedding
false
3,727
[ "Apache-2.0" ]
0
47e362f02445ba00d5ab8db206667767e72faca7
https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7
import torch import torch.nn as nn import torch.fft class Model(nn.Module): def __init__(self, c_in, d_model): super().__init__() padding = 1 if torch.__version__ >= '1.5.0' else 2 self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model, kernel_size=3, padding=paddin...
InjectNoise
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class InjectNoise(nn.Module): def __init__(self, channels): super().__init__() self.weight = nn.Parameter(torch.zeros(1, channels, 1, 1)) def forward(self, x): noise = torch.randn((x.shape[0], 1, x.shape[2], x.shape[3]), devic...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_...
jiazhi412/Machine-Learning-Collection
InjectNoise
false
3,728
[ "MIT" ]
0
1c30faf1e27a79eeca966c017e956df8f7f6ef17
https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, channels): super().__init__() self.weight = nn.Parameter(torch.zeros(1, channels, 1, 1)) def forward(self, x): noise = torch.randn((x.shape[0], 1, x.shape[2], x.shape[3]), device ...
WSConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class WSConv2d(nn.Module): """ Weight scaled Conv2d (Equalized Learning Rate) Note that input is multiplied rather than changing weights this will have the same result. Inspired and looked at: https://github.com/nvnbny/progressive_grow...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data assert_size_stride = torch._C._dyna...
jiazhi412/Machine-Learning-Collection
WSConv2d
false
3,729
[ "MIT" ]
0
1c30faf1e27a79eeca966c017e956df8f7f6ef17
https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17
import torch from torch import nn import torch.utils.data class Model(nn.Module): """ Weight scaled Conv2d (Equalized Learning Rate) Note that input is multiplied rather than changing weights this will have the same result. Inspired and looked at: https://github.com/nvnbny/progressive_growing...
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...
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn from torch.nn.parameter import Parameter def gelu(x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Conv1D(nn.Module): def __init__(self, nf, nx): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
CaptainJa/demo-torch-gpt2
MLP
false
3,730
[ "MIT" ]
0
83d6074e8b321101e08c0aa5749c8eb988a5faa8
https://github.com/CaptainJa/demo-torch-gpt2/tree/83d6074e8b321101e08c0aa5749c8eb988a5faa8
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn from torch.nn.parameter import Parameter def gelu(x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Conv1D(nn.Module): def __init__(self, nf, nx): ...
CNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.fft class CNN(nn.Module): """Convolutional Neural Networks.""" def __init__(self, input_size, hidden_dim, output_size): super(CNN, self).__init__() self.Conv1 = nn.Conv1d(in_channels=input_size, out_channels= hidden_dim, kernel_size=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
jianzhnie/TsFormer
CNN
false
3,731
[ "Apache-2.0" ]
0
47e362f02445ba00d5ab8db206667767e72faca7
https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7
import torch import torch.nn as nn import torch.fft class Model(nn.Module): """Convolutional Neural Networks.""" def __init__(self, input_size, hidden_dim, output_size): super().__init__() self.Conv1 = nn.Conv1d(in_channels=input_size, out_channels= hidden_dim, kernel_size=3, padd...
SeriesDecomp
# 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.fft class MovingAvg(nn.Module): """Moving average block to highlight the trend of time series.""" def __init__(self, kernel_size, stride): super(MovingAvg, self).__init__() self.kernel_size = kernel_size self.avg = nn.AvgPool1d(kernel_si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
jianzhnie/TsFormer
SeriesDecomp
false
3,732
[ "Apache-2.0" ]
0
47e362f02445ba00d5ab8db206667767e72faca7
https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7
import torch import torch.nn as nn import torch.fft class MovingAvg(nn.Module): """Moving average block to highlight the trend of time series.""" def __init__(self, kernel_size, stride): super().__init__() self.kernel_size = kernel_size self.avg = nn.AvgPool1d(kernel_size=kernel_size,...
WSLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class WSLinear(nn.Module): def __init__(self, in_features, out_features, gain=2): super(WSLinear, self).__init__() self.linear = nn.Linear(in_features, out_features) self.scale = (gain / in_features) ** 0.5 self.bias = 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 import nn import torch.utils.data assert_size_stride = torch._C._dyna...
jiazhi412/Machine-Learning-Collection
WSLinear
false
3,733
[ "MIT" ]
0
1c30faf1e27a79eeca966c017e956df8f7f6ef17
https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, in_features, out_features, gain=2): super().__init__() self.linear = nn.Linear(in_features, out_features) self.scale = (gain / in_features) ** 0.5 self.bias = self.linear.bias ...
LatentLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor import torch.nn as nn class LatentLoss(nn.Module): def forward(self, mu: 'Tensor', logvar: 'Tensor') ->Tensor: loss = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
jinyeom/vae
LatentLoss
false
3,734
[ "MIT" ]
0
861cb2edd5cebc9f56c2677d7b79f5ab0a05f874
https://github.com/jinyeom/vae/tree/861cb2edd5cebc9f56c2677d7b79f5ab0a05f874
import torch from torch import Tensor import torch.nn as nn class Model(nn.Module): def forward(self, mu: 'Tensor', logvar: 'Tensor') ->Tensor: loss = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4,...
DotProductSimilarity
# 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 class SimilarityFunction(nn.Module): """ A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity function on the vectors in the last dimension. For example, the tensors might both have shape `(batch_size, sentence_...
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...
immrz/qagnn
DotProductSimilarity
false
3,735
[ "MIT" ]
0
0e695c6fcbefcf25da25c056c0bea1940b3e0f2b
https://github.com/immrz/qagnn/tree/0e695c6fcbefcf25da25c056c0bea1940b3e0f2b
import math import torch import torch.nn as nn class SimilarityFunction(nn.Module): """ A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity function on the vectors in the last dimension. For example, the tensors might both have shape `(batch_size, sentence_...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jiahuanluo/Global-Encoding
MultiHeadAttention
false
3,736
[ "MIT" ]
0
2adb01def9525588b3a75e6f2a5181a3a11464ed
https://github.com/jiahuanluo/Global-Encoding/tree/2adb01def9525588b3a75e6f2a5181a3a11464ed
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout...
NN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F import torch.utils.data class NN(nn.Module): def __init__(self, input_size, num_classes): super(NN, self).__init__() self.fc1 = nn.Linear(input_size, 50) self.fc2 = nn.Linear(50, num_classes) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
jiazhi412/Machine-Learning-Collection
NN
false
3,737
[ "MIT" ]
0
1c30faf1e27a79eeca966c017e956df8f7f6ef17
https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17
import torch from torch import nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): def __init__(self, input_size, num_classes): super().__init__() self.fc1 = nn.Linear(input_size, 50) self.fc2 = nn.Linear(50, num_classes) def forward(self, x): "...
DummyLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DummyLayer(nn.Module): def __init__(self): super().__init__() self.dummy = nn.Parameter(torch.ones(1, dtype=torch.float)) def forward(self, x): return x + self.dummy - self.dummy def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
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...
jishnujayakumar/specter
DummyLayer
false
3,738
[ "Apache-2.0" ]
0
40e3b5e538004b00b0955f17dd3d71fb1f96b922
https://github.com/jishnujayakumar/specter/tree/40e3b5e538004b00b0955f17dd3d71fb1f96b922
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.dummy = nn.Parameter(torch.ones(1, dtype=torch.float)) def forward(self, x): return x + self.dummy - self.dummy def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_i...
MatrixAttention
# 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 class SimilarityFunction(nn.Module): """ A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity function on the vectors in the last dimension. For example, the tensors might both have shape `(batch_size, sentence_...
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 math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guar...
immrz/qagnn
MatrixAttention
false
3,739
[ "MIT" ]
0
0e695c6fcbefcf25da25c056c0bea1940b3e0f2b
https://github.com/immrz/qagnn/tree/0e695c6fcbefcf25da25c056c0bea1940b3e0f2b
import math import torch import torch.nn as nn class SimilarityFunction(nn.Module): """ A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity function on the vectors in the last dimension. For example, the tensors might both have shape `(batch_size, sentence_...
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...
jishnujayakumar/specter
BinaryLoss
false
3,740
[ "Apache-2.0" ]
0
40e3b5e538004b00b0955f17dd3d71fb1f96b922
https://github.com/jishnujayakumar/specter/tree/40e3b5e538004b00b0955f17dd3d71fb1f96b922
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...
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_...
jibin-liu/deep-reinforcement-learning
QNetwork
false
3,741
[ "MIT" ]
0
2a91a66a931e891d08cd1af95da973a522381b52
https://github.com/jibin-liu/deep-reinforcement-learning/tree/2a91a66a931e891d08cd1af95da973a522381b52
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 ...
AdaIN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class WSLinear(nn.Module): def __init__(self, in_features, out_features, gain=2): super(WSLinear, self).__init__() self.linear = nn.Linear(in_features, out_features) self.scale = (gain / in_features) ** 0.5 self.bias = self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
jiazhi412/Machine-Learning-Collection
AdaIN
false
3,742
[ "MIT" ]
0
1c30faf1e27a79eeca966c017e956df8f7f6ef17
https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17
import torch from torch import nn import torch.utils.data class WSLinear(nn.Module): def __init__(self, in_features, out_features, gain=2): super().__init__() self.linear = nn.Linear(in_features, out_features) self.scale = (gain / in_features) ** 0.5 self.bias = self.linear.bias ...
MatrixVectorScaledDotProductAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class MatrixVectorScaledDotProductAttention(nn.Module): def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) self.softmax = nn.Softmax(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....
immrz/qagnn
MatrixVectorScaledDotProductAttention
false
3,743
[ "MIT" ]
0
0e695c6fcbefcf25da25c056c0bea1940b3e0f2b
https://github.com/immrz/qagnn/tree/0e695c6fcbefcf25da25c056c0bea1940b3e0f2b
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) self.softmax = nn.Softmax(dim=-1) def forward(self, q, k,...
Qnet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import random import torch import torch.nn as nn import torch.nn.functional as F class Qnet(nn.Module): def __init__(self): super(Qnet, self).__init__() self.fc1 = nn.Linear(4, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, 2) def forward(self, x): x = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import random import torch.nn...
jinPrelude/minimalRL
Qnet
false
3,744
[ "MIT" ]
0
4eba82feac15bb29f4ad715c6c8fd7b11426b840
https://github.com/jinPrelude/minimalRL/tree/4eba82feac15bb29f4ad715c6c8fd7b11426b840
import random import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, 2) def forward(self, x): x = F.relu(se...
ChannelMaxPool
# 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 ChannelMaxPool(nn.MaxPool1d): def forward(self, input): n, c, w, h = input.size() input = input.view(n, c, w * h).permute(0, 2, 1) pooled = F.max_pool1d(input, self.kernel_size, self.stride, self. padding...
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...
joeization/CycleGAN
ChannelMaxPool
false
3,745
[ "MIT" ]
0
9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.MaxPool1d): def forward(self, input): n, c, w, h = input.size() input = input.view(n, c, w * h).permute(0, 2, 1) pooled = F.max_pool1d(input, self.kernel_size, self.stride, self. padding, self.di...
Policy
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical class Policy(nn.Module): def __init__(self, s_size=4, h_size=16, a_size=2): super(Policy, self).__init__() self.fc1 = nn.Linear(s_size, h_size) self.fc2 = nn.Linear(h_size, a_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 from torch._inductor.runtime....
jiruifu-jerry0219/DRLND_Jerry
Policy
false
3,746
[ "MIT" ]
0
6a342f99119d466f8ae96202452b034f1a2e70e1
https://github.com/jiruifu-jerry0219/DRLND_Jerry/tree/6a342f99119d466f8ae96202452b034f1a2e70e1
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical class Model(nn.Module): def __init__(self, s_size=4, h_size=16, a_size=2): super().__init__() self.fc1 = nn.Linear(s_size, h_size) self.fc2 = nn.Linear(h_size, a_size) def f...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class SelfAttention(nn.Module): def __init__(self, embed_size, heads): super(SelfAttention, self).__init__() self.embed_size = embed_size self.heads = heads self.head_dim = embed_size // heads assert self.head_dim *...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jiazhi412/Machine-Learning-Collection
SelfAttention
false
3,747
[ "MIT" ]
0
1c30faf1e27a79eeca966c017e956df8f7f6ef17
https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, embed_size, heads): super().__init__() self.embed_size = embed_size self.heads = heads self.head_dim = embed_size // heads assert self.head_dim * heads == embed_size, 'Embe...
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 numpy as np import torch.nn as nn class GELU(nn.Module): """Gaussian Error Linear Unit. Dan Hendrycks∗, Kevin Gimpel GAUSSIAN ERROR LINEAR UNITS (GELUS), 2016 Args: x: float Tensor to perform activation. Returns: `x` with the GELU activation applied. """ ...
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_...
joeization/CycleGAN
GELU
false
3,748
[ "MIT" ]
0
9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
import torch import numpy as np import torch.nn as nn class Model(nn.Module): """Gaussian Error Linear Unit. Dan Hendrycks∗, Kevin Gimpel GAUSSIAN ERROR LINEAR UNITS (GELUS), 2016 Args: x: float Tensor to perform activation. Returns: `x` with the GELU activation applied. """...
BertSelfOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.utils.checkpoint class BertSelfOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(confi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Hzfinfdu/Black-Box-Tuning
BertSelfOutput
false
3,749
[ "MIT" ]
0
64eb5505875dc1b242c6f0a2a2f07e4000c24cb4
https://github.com/Hzfinfdu/Black-Box-Tuning/tree/64eb5505875dc1b242c6f0a2a2f07e4000c24cb4
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.utils.checkpoint class Model(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_...
NPRNNCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 NPRNNCell(nn.Module): def __init__(self, input_size, hidden_size, output_size, clip=2.0): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.clip = clip self.fc_in = nn.Linear(input_size, hidden_size)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jinyeom/ga-plastic-models
NPRNNCell
false
3,750
[ "MIT" ]
0
e38b245ae51c35a5f32679cc9f215463a3d58f1a
https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a
import torch from torch import nn class Model(nn.Module): def __init__(self, input_size, hidden_size, output_size, clip=2.0): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.clip = clip self.fc_in = nn.Linear(input_size, hidden_size) ...
BlurPool2d
# 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 BlurPool2d(nn.Sequential): """Blur Pooling Layer (MaxPool2d replacement) See: https://richzhang.github.io/antialiased-cnns/ Paper: https://arxiv.org/abs/1904.11486 """ __constants__ = ['in_features'] _blur_kernel = torch.tensor([[1 / 16, 2 / 16, 1 / 16]...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
johanofverstedt/comir
BlurPool2d
false
3,751
[ "MIT" ]
0
fced349ebe3a7bf07ac59e25f02ca4780796b041
https://github.com/johanofverstedt/comir/tree/fced349ebe3a7bf07ac59e25f02ca4780796b041
import torch import torch.nn as nn class Model(nn.Sequential): """Blur Pooling Layer (MaxPool2d replacement) See: https://richzhang.github.io/antialiased-cnns/ Paper: https://arxiv.org/abs/1904.11486 """ __constants__ = ['in_features'] _blur_kernel = torch.tensor([[1 / 16, 2 / 16, 1 / 16], [2 ...
ChannelAvgPool
# 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 ChannelAvgPool(nn.AvgPool1d): def forward(self, input): n, c, w, h = input.size() input = input.view(n, c, w * h).permute(0, 2, 1) pooled = F.avg_pool1d(input, self.kernel_size, self.stride, self. padding...
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...
joeization/CycleGAN
ChannelAvgPool
false
3,752
[ "MIT" ]
0
9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.AvgPool1d): def forward(self, input): n, c, w, h = input.size() input = input.view(n, c, w * h).permute(0, 2, 1) pooled = F.avg_pool1d(input, self.kernel_size, self.stride, self. padding, self.ce...
IndependentNACLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import collections import scipy import torch import numpy as np import torch.utils.data import scipy.stats import scipy.optimize def sparsity_error(W): W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W))) return torch.max(W_error) def nac_w_variance(r): """Calculates the variance of W. As...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 collections ...
hoedt/stable-nalu
IndependentNACLayer
false
3,753
[ "MIT" ]
0
64b3d240db8bff4da857d955f213ef3c7e38e035
https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035
import collections import scipy import torch import numpy as np import torch.utils.data import scipy.stats import scipy.optimize def sparsity_error(W): W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W))) return torch.max(W_error) def nac_w_variance(r): """Calculates the variance of W. As...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class Encoder(nn.Module): def __init__(self, latent_size): super().__init__() self.latent_size = latent_size self.conv1 = nn.Conv2d(3, 32, 4, stride=2) self.conv2 = nn.Conv2d(32, 64, 4, stride=2) self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
jinyeom/ga-plastic-models
Encoder
false
3,754
[ "MIT" ]
0
e38b245ae51c35a5f32679cc9f215463a3d58f1a
https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, latent_size): super().__init__() self.latent_size = latent_size self.conv1 = nn.Conv2d(3, 32, 4, stride=2) self.conv2 = nn.Conv2d(32, 64, 4, stride=2) self.con...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class Decoder(nn.Module): def __init__(self, latent_size): super().__init__() self.latent_size = latent_size self.fc1 = nn.Linear(latent_size, 1024) self.deconv1 = nn.ConvTranspose2d(1024, 128, 5, stride=2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
jinyeom/ga-plastic-models
Decoder
false
3,755
[ "MIT" ]
0
e38b245ae51c35a5f32679cc9f215463a3d58f1a
https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, latent_size): super().__init__() self.latent_size = latent_size self.fc1 = nn.Linear(latent_size, 1024) self.deconv1 = nn.ConvTranspose2d(1024, 128, 5, stride=2) ...
CoralLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 class CoralLayer(torch.nn.Module): """ Implements CORAL layer described in Cao, Mirjalili, and Raschka (2020) *Rank Consistent Ordinal Regression for Neural Networks with Application to Age Estimation* Pattern Recognition Letters, https://doi.org/10.1016/j.patrec.2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
johann-petrak/farm-tools
CoralLayer
false
3,756
[ "Apache-2.0" ]
0
7d379bbc5b9b079eedd4a11d7bdb1636c0ad834c
https://github.com/johann-petrak/farm-tools/tree/7d379bbc5b9b079eedd4a11d7bdb1636c0ad834c
import torch import torch.nn class Model(torch.nn.Module): """ Implements CORAL layer described in Cao, Mirjalili, and Raschka (2020) *Rank Consistent Ordinal Regression for Neural Networks with Application to Age Estimation* Pattern Recognition Letters, https://doi.org/10.1016/j.patrec.2020.1...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn import functional as F from torch import nn class SelfAttention(nn.Module): def __init__(self, k, heads=8): super().__init__() self.k, self.heads = k, heads self.toKeys = nn.Linear(k, k * heads, bias=False) self.toQueries = nn.Linear(k, k * heads, bias=F...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jiyfeng/transformer-text-tasks
SelfAttention
false
3,757
[ "MIT" ]
0
b06349ca759bc8084a5880a425153dfdd7b91a98
https://github.com/jiyfeng/transformer-text-tasks/tree/b06349ca759bc8084a5880a425153dfdd7b91a98
import torch from torch.nn import functional as F from torch import nn class Model(nn.Module): def __init__(self, k, heads=8): super().__init__() self.k, self.heads = k, heads self.toKeys = nn.Linear(k, k * heads, bias=False) self.toQueries = nn.Linear(k, k * heads, bias=False) ...
Model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as f class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv = nn.Conv2d(1, 16, 5) self.pool = nn.MaxPool2d(2, 2) self.fc = nn.Linear(2304, 10) def forward(self, x): x = self.poo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
jizongFox/adversarial-robustness-toolbox
Model
false
3,758
[ "MIT" ]
0
0649fe44d42bc7ba39a4b1a2ff95a31320fd1ae5
https://github.com/jizongFox/adversarial-robustness-toolbox/tree/0649fe44d42bc7ba39a4b1a2ff95a31320fd1ae5
import torch import torch.nn as nn import torch.nn.functional as f class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv = nn.Conv2d(1, 16, 5) self.pool = nn.MaxPool2d(2, 2) self.fc = nn.Linear(2304, 10) def forward(self, x): x = self.poo...
DataEmbedding_wo_pos
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.fft class PositionalEmbedding(nn.Module): def __init__(self, d_model, max_len=5000): super(PositionalEmbedding, self).__init__() pe = torch.zeros(max_len, d_model).float() pe.require_grad = False position = torch.arange(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 import math import torch.nn as nn import torch.fft assert_size_stride = torch._C...
jianzhnie/TsFormer
DataEmbedding_wo_pos
false
3,759
[ "Apache-2.0" ]
0
47e362f02445ba00d5ab8db206667767e72faca7
https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7
import math import torch import torch.nn as nn import torch.fft class PositionalEmbedding(nn.Module): def __init__(self, d_model, max_len=5000): super().__init__() pe = torch.zeros(max_len, d_model).float() pe.require_grad = False position = torch.arange(0, max_len).float().unsque...
LossLoglikelihoodNb
# 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 LossLoglikelihoodNb(torch.nn.Module): def __init__(self, average=True): super(LossLoglikelihoodNb, self).__init__() self.average = average def forward(self, preds, target): """Implements the negative log likelihood loss as VAE reconstruction loss""" x = tar...
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...
johnmous/sfaira
LossLoglikelihoodNb
false
3,760
[ "BSD-3-Clause" ]
0
c50240a74530e614ab7681bf9c63b04cb815b361
https://github.com/johnmous/sfaira/tree/c50240a74530e614ab7681bf9c63b04cb815b361
import torch class Model(torch.nn.Module): def __init__(self, average=True): super().__init__() self.average = average def forward(self, preds, target): """Implements the negative log likelihood loss as VAE reconstruction loss""" x = target loc, scale = torch.chunk(pr...
BCEAfterSigmoidLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from torch.nn import functional import torch.autograd class Loss(nn.Module): """A loss function.""" class PointwiseLoss(Loss): """Pointwise loss functions compute an independent loss term for each triple-label pair.""" class BCEAfterSigmoidLoss(PointwiseLoss): """A lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
johnbachman/pykeen
BCEAfterSigmoidLoss
false
3,761
[ "MIT" ]
0
6595f6cefc462b6d1e057446e6c3ed66d36a078b
https://github.com/johnbachman/pykeen/tree/6595f6cefc462b6d1e057446e6c3ed66d36a078b
import torch from torch import nn from torch.nn import functional import torch.autograd class Loss(nn.Module): """A loss function.""" class PointwiseLoss(Loss): """Pointwise loss functions compute an independent loss term for each triple-label pair.""" class Model(PointwiseLoss): """A loss function wh...
unet_bottleneck
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 unet_bottleneck(nn.Module): def __init__(self, in_ch, out_ch, ker=3): super(unet_bottleneck, self).__init__() self.relu = nn.ReLU(inplace=True) self.conv1 = nn.Conv2d(in_ch, out_ch, 1) self.bn1 = nn.GroupNorm(out_ch // 4, out_ch) 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....
joeization/CycleGAN
unet_bottleneck
false
3,762
[ "MIT" ]
0
9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_ch, out_ch, ker=3): super().__init__() self.relu = nn.ReLU(inplace=True) self.conv1 = nn.Conv2d(in_ch, out_ch, 1) self.bn1 = nn.GroupNorm(out_ch // 4, out_ch) self.conv2 = nn.Conv2d(out_ch, ou...
LossCrossentropyAgg
# 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 LossCrossentropyAgg(torch.nn.Module): def __init__(self): super(LossCrossentropyAgg, self).__init__() def forward(self, preds, target): """ Modified crossentropy that aggregates allowed output classes into single class. """ preds = torch.clamp(preds, min=1e-10, max...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
johnmous/sfaira
LossCrossentropyAgg
false
3,763
[ "BSD-3-Clause" ]
0
c50240a74530e614ab7681bf9c63b04cb815b361
https://github.com/johnmous/sfaira/tree/c50240a74530e614ab7681bf9c63b04cb815b361
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, preds, target): """ Modified crossentropy that aggregates allowed output classes into single class. """ preds = torch.clamp(preds, min=1e-10, max=1.0) ll_cce_agg = -torch.log(t...
CmapPafHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn import torch.optim assert_size_stride = ...
intflow/trt_openpose
CmapPafHead
false
3,764
[ "MIT" ]
0
526b1b0d463f1c86a45ca4d4cd77a41732c7654b
https://github.com/intflow/trt_openpose/tree/526b1b0d463f1c86a45ca4d4cd77a41732c7654b
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
NearestInterp
# 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 NearestInterp(torch.nn.Module): """ Nearest neighbor interpolation layer. note: From the source code, it appears that Darknet uses nearest neighbor method for its upsampling layer (darknet master-30 oct 2018). Internally calls torch.nn.functional.interpolate to suppress the war...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
jonathanzjl/cam-vision
NearestInterp
false
3,765
[ "BSD-2-Clause" ]
0
d1bd865b147ea1137979b624c64a6baa4a4b0714
https://github.com/jonathanzjl/cam-vision/tree/d1bd865b147ea1137979b624c64a6baa4a4b0714
import torch class Model(torch.nn.Module): """ Nearest neighbor interpolation layer. note: From the source code, it appears that Darknet uses nearest neighbor method for its upsampling layer (darknet master-30 oct 2018). Internally calls torch.nn.functional.interpolate to suppress the warning on ...
NoisyLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.optim class NoisyLinear(nn.Linear): def __init__(self, in_dimension, out_dimension, std_dev_init=0.4) ->None: """ Noisy Networks for Exploration: https://arxiv.org/abs/1706.10295 Standard linear layer: y = wx + b ...
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.triton_helpers import libd...
johncliu/Horizon
NoisyLinear
false
3,766
[ "BSD-3-Clause" ]
0
cfa7a873ada5de3bb01e78e2f237d9849b8270b2
https://github.com/johncliu/Horizon/tree/cfa7a873ada5de3bb01e78e2f237d9849b8270b2
import math import torch import torch.nn as nn import torch.nn import torch.optim class Model(nn.Linear): def __init__(self, in_dimension, out_dimension, std_dev_init=0.4) ->None: """ Noisy Networks for Exploration: https://arxiv.org/abs/1706.10295 Standard linear layer: y = wx + b ...
ExpandNetLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class ExpandNetLoss(nn.Module): def __init__(self, loss_lambda=5): super(ExpandNetLoss, self).__init__() self.similarity = torch.nn.CosineSimilarity(dim=1, eps=1e-20) self.l1_loss = nn.L1Loss() self.loss_lambda = loss_lambda def forward(self,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
jongwookyi/hdr-expandnet
ExpandNetLoss
false
3,767
[ "BSD-3-Clause-Clear" ]
0
0594605c8f2041bc592c20c1e7fd8615994c6b01
https://github.com/jongwookyi/hdr-expandnet/tree/0594605c8f2041bc592c20c1e7fd8615994c6b01
import torch from torch import nn class Model(nn.Module): def __init__(self, loss_lambda=5): super().__init__() self.similarity = torch.nn.CosineSimilarity(dim=1, eps=1e-20) self.l1_loss = nn.L1Loss() self.loss_lambda = loss_lambda def forward(self, x, y): cosine_term...
ComplexConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ComplexConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, **kwargs): super().__init__() self.conv_re = nn.Conv2d(in_channels, out_channels, kernel_size, st...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jonashaag/PhoneFortifiedPerceptualLoss
ComplexConv2d
false
3,768
[ "MIT" ]
0
1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd
https://github.com/jonashaag/PhoneFortifiedPerceptualLoss/tree/1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, **kwargs): super().__init__() self.conv_re = nn.Conv2d(in_channels, out_channels, kernel_size, stride=str...
ComplexConvTranspose2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ComplexConvTranspose2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, dilation=1, groups=1, bias=True, **kwargs ): super().__init__() self.tconv_re = nn.ConvTranspose2d(in_chann...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
jonashaag/PhoneFortifiedPerceptualLoss
ComplexConvTranspose2d
false
3,769
[ "MIT" ]
0
1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd
https://github.com/jonashaag/PhoneFortifiedPerceptualLoss/tree/1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, dilation=1, groups=1, bias=True, **kwargs ): super().__init__() self.tconv_re = nn.ConvTranspose2d(in_channels, out_channels...
AddPositionalEncoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.onnx class AddPositionalEncoding(nn.Module): def __init__(self, hidden_size, max_sequence_length): super(AddPositionalEncoding, self).__init__() self.hidden_size = hidden_size self.max_sequence_length = max_sequence_length self.posit...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch
AddPositionalEncoding
false
3,770
[ "MIT" ]
0
d27d2d390f0831330405c16bd29c7f331ad2007a
https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a
import torch import torch.nn as nn import torch.onnx class Model(nn.Module): def __init__(self, hidden_size, max_sequence_length): super().__init__() self.hidden_size = hidden_size self.max_sequence_length = max_sequence_length self.positional_encoding = nn.Parameter(torch.empty( ...
GatedConv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.onnx class MaskedConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation else: padding = (kernel_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 import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.gu...
jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch
GatedConv1d
false
3,771
[ "MIT" ]
0
d27d2d390f0831330405c16bd29c7f331ad2007a
https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a
import torch import torch.nn as nn import torch.onnx class MaskedConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation else: padding = (kernel_s...
MaskedConv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.onnx class MaskedConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation else: padding = (kernel_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 import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.gu...
jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch
MaskedConv1d
false
3,772
[ "MIT" ]
0
d27d2d390f0831330405c16bd29c7f331ad2007a
https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a
import torch import torch.nn as nn import torch.onnx class Model(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation else: padding = (kernel_size - 1...
Swish
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class Swish(nn.Module): def forward(self, x): return torch.sigmoid(x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
jseppanen/sacking
Swish
false
3,773
[ "Apache-2.0" ]
0
ff16d9a0cbec2661bc84be33ee4b3987be22228e
https://github.com/jseppanen/sacking/tree/ff16d9a0cbec2661bc84be33ee4b3987be22228e
import torch from torch import nn class Model(nn.Module): def forward(self, x): return torch.sigmoid(x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
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): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
joyce-fang/deep-reinforcement-learning
Actor
false
3,774
[ "MIT" ]
0
62cedab584465bd1c3ef112eb149e8fc611546e3
https://github.com/joyce-fang/deep-reinforcement-learning/tree/62cedab584465bd1c3ef112eb149e8fc611546e3
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
SDPAttention
# 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.onnx import torch.nn.functional as F class SDPAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0, causal=False): super(SDPAttention, self).__init__() self.causal = causal self.dropout = nn.Dro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch
SDPAttention
false
3,775
[ "MIT" ]
0
d27d2d390f0831330405c16bd29c7f331ad2007a
https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a
import torch import torch.nn as nn import torch.onnx import torch.nn.functional as F class Model(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0, causal=False): super().__init__() self.causal = causal self.dropout = nn.Dropout(dropout) sel...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CausalConv1d(torch.nn.Conv1d): """Causal 1d convolution""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True): self.__padding = (kernel_size - 1) * dilation super(CausalConv1d, self).__init__(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
jonasvj/protein-generation
ResidualBlock
false
3,776
[ "MIT" ]
0
ad716f2dba6f6642a6d54571571e6f539cee3644
https://github.com/jonasvj/protein-generation/tree/ad716f2dba6f6642a6d54571571e6f539cee3644
import torch import torch.nn as nn class CausalConv1d(torch.nn.Conv1d): """Causal 1d convolution""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True): self.__padding = (kernel_size - 1) * dilation super().__init__(in_channels, out_ch...
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 numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
joyce-fang/deep-reinforcement-learning
Critic
false
3,777
[ "MIT" ]
0
62cedab584465bd1c3ef112eb149e8fc611546e3
https://github.com/joyce-fang/deep-reinforcement-learning/tree/62cedab584465bd1c3ef112eb149e8fc611546e3
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, 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 as nn import torch.nn.functional as F 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_...
jsztompka/DuelDQN
QNetwork
false
3,778
[ "MIT" ]
0
3b1234425b66034ef233ac988305dc13ffbf7ace
https://github.com/jsztompka/DuelDQN/tree/3b1234425b66034ef233ac988305dc13ffbf7ace
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): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state ...
LeakyClamp
# 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 LeakyClamp(nn.Module): def __init__(self, cap): super(LeakyClamp, self).__init__() self.cap = cap self.leakyrelu = nn.LeakyReLU(inplace=False) self.leakyrelu2 = nn.LeakyReLU(inplace=False) def forward(self, x): x = self.leakyre...
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...
junweima/pytorch-cnn-visualizations
LeakyClamp
false
3,779
[ "MIT" ]
0
c535e76e0a169d02a17ec5c8cc109ea687d698c1
https://github.com/junweima/pytorch-cnn-visualizations/tree/c535e76e0a169d02a17ec5c8cc109ea687d698c1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, cap): super().__init__() self.cap = cap self.leakyrelu = nn.LeakyReLU(inplace=False) self.leakyrelu2 = nn.LeakyReLU(inplace=False) def forward(self, x): x = self.leakyrelu(x) x_ret =...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn import torch.nn.parallel class MultiHeadAttention(nn.Module): def __init__(self, heads_count, d_model, dropout_prob): super().__init__() assert d_model % heads_count == 0, f'model dim {d_model} not divisible by {heads_count} heads' self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
junchen14/video_language
MultiHeadAttention
false
3,780
[ "Apache-2.0" ]
0
1d6d304b795501d1e0d56351047a259d992fab23
https://github.com/junchen14/video_language/tree/1d6d304b795501d1e0d56351047a259d992fab23
import torch import numpy as np from torch import nn import torch.nn.parallel class Model(nn.Module): def __init__(self, heads_count, d_model, dropout_prob): super().__init__() assert d_model % heads_count == 0, f'model dim {d_model} not divisible by {heads_count} heads' self.d_head = d_m...
AttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.onnx import torch.nn.functional as F class AttentionLayer(nn.Module): """ Attention layer according to https://arxiv.org/abs/1409.0473. Params: num_units: Number of units used in the attention layer """ def __init__(self, query_size, key_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch
AttentionLayer
false
3,781
[ "MIT" ]
0
d27d2d390f0831330405c16bd29c7f331ad2007a
https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a
import torch import torch.nn as nn import torch.onnx import torch.nn.functional as F class Model(nn.Module): """ Attention layer according to https://arxiv.org/abs/1409.0473. Params: num_units: Number of units used in the attention layer """ def __init__(self, query_size, key_size, value_s...