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
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.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * class DiceLoss(torch.nn.Module): def init(self): super(DiceLoss, self).init() def forward(self, pred, target): smooth = 1.0 iflat = pred.contiguous().view(-1) tflat = 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 import torch.optim.lr_scheduler import torch.utils.data from torchvision.transforms impor...
csharpshooter/DeepLearning
DiceLoss
false
1,750
[ "MIT" ]
0
c1d20660c32076468970f7376931e1fcd0d2644e
https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e
import torch import torch.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * class Model(torch.nn.Module): def init(self): super(DiceLoss, self).init() def forward(self, pred, target): smooth = 1.0 iflat = pred.contiguous().view(-1) tflat = target...
WeightedFeatureFusion
# 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.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * class WeightedFeatureFusion(nn.Module): def __init__(self, layers, weight=False): super(WeightedFeatureFusion, self).__init__() self.layers = layers self.weight ...
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.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * assert_size_stride = torc...
csharpshooter/DeepLearning
WeightedFeatureFusion
false
1,751
[ "MIT" ]
0
c1d20660c32076468970f7376931e1fcd0d2644e
https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e
import torch import torch.nn as nn import torch.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * class Model(nn.Module): def __init__(self, layers, weight=False): super().__init__() self.layers = layers self.weight = weight self.n = len(layers) + 1 ...
CondInjection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.cpp_extension class CondInjection(nn.Module): def __init__(self): super().__init__() self.weight = nn.Parameter(torch.zeros(1)) def forward(self, image, labels, noise=None): if noise is None: batch, _, height, width = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.cpp_extension assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = ...
crobbins327/semanticGAN_WSI
CondInjection
false
1,752
[ "BSD-2-Clause", "MIT" ]
0
4046ddc822f463e03952402247f79d540bf7be95
https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95
import torch import torch.nn as nn import torch.utils.cpp_extension class Model(nn.Module): def __init__(self): super().__init__() self.weight = nn.Parameter(torch.zeros(1)) def forward(self, image, labels, noise=None): if noise is None: batch, _, height, width = image.sh...
Attention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim=-1, margin=0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp()) return out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cshjin/pytorch_geometric
Attention
false
1,753
[ "MIT" ]
0
8dd0e76beb72135949a275edd851f80f7b97648f
https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim=-1, margin=0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp()) return out...
ActFirstResBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
cplusx/SIGN
ActFirstResBlock
false
1,754
[ "Apache-2.0" ]
0
9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae
https://github.com/cplusx/SIGN/tree/9777fc3ddd4c6f799caeefe1e72482d5b1ecd8ae
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super().__init__() self.num_features = num_features self.eps = eps self.momentum = momentum self.weight = N...
SoftmaxLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.cpp_extension class SoftmaxLoss(torch.nn.Module): def __init__(self, tau=1.0): super().__init__() self.tau = tau self.ce_loss = torch.nn.CrossEntropyLoss() def forward(self, pred, true): logits = pred / self.tau l = self.ce_loss(logits,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.cpp...
crobbins327/semanticGAN_WSI
SoftmaxLoss
false
1,755
[ "BSD-2-Clause", "MIT" ]
0
4046ddc822f463e03952402247f79d540bf7be95
https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95
import torch import torch.utils.cpp_extension class Model(torch.nn.Module): def __init__(self, tau=1.0): super().__init__() self.tau = tau self.ce_loss = torch.nn.CrossEntropyLoss() def forward(self, pred, true): logits = pred / self.tau l = self.ce_loss(logits, true)...
Gate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Gate(nn.Module): """Gate Unit g = sigmoid(Wx) x = g * x """ def __init__(self, input_size): super(Gate, self).__init__() self.linear = nn.Linear(input_size, input_size, bias=False) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
csarron/QAModels
Gate
false
1,756
[ "BSD-3-Clause" ]
0
2db2d7b0f546b88211e111b42744408bbf9b6f35
https://github.com/csarron/QAModels/tree/2db2d7b0f546b88211e111b42744408bbf9b6f35
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Gate Unit g = sigmoid(Wx) x = g * x """ def __init__(self, input_size): super().__init__() self.linear = nn.Linear(input_size, input_size, bias=False) def forward(self, x): "...
Linear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import Tensor from torch.nn import Linear from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import Tensor from torch.nn import Parameter import torch...
cshjin/pytorch_geometric
Linear
false
1,757
[ "MIT" ]
0
8dd0e76beb72135949a275edd851f80f7b97648f
https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f
import math import torch from torch import Tensor from torch.nn import Linear from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor ...
SFU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SFU(nn.Module): """Semantic Fusion Unit The ouput vector is expected to not only retrieve correlative information from fusion vectors, but also retain partly unchange as the input vector """ def __init__(self, input_size, fu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
csarron/QAModels
SFU
false
1,758
[ "BSD-3-Clause" ]
0
2db2d7b0f546b88211e111b42744408bbf9b6f35
https://github.com/csarron/QAModels/tree/2db2d7b0f546b88211e111b42744408bbf9b6f35
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Semantic Fusion Unit The ouput vector is expected to not only retrieve correlative information from fusion vectors, but also retain partly unchange as the input vector """ def __init__(self, input_size, ...
DecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
congson1293/Transformer
DecoderLayer
false
1,759
[ "Apache-2.0" ]
0
249638f3287e0ed11c71496178fe2ceac2d758df
https://github.com/congson1293/Transformer/tree/249638f3287e0ed11c71496178fe2ceac2d758df
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.0...
DenseSAGEConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class DenseSAGEConv(torch.nn.Module): """See :class:`torch_geometric...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math from torch.nn imp...
cshjin/pytorch_geometric
DenseSAGEConv
false
1,760
[ "MIT" ]
0
8dd0e76beb72135949a275edd851f80f7b97648f
https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f
import math import torch import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class Model(torch.nn.Module): """See :class:`torch_geometric.nn.conv...
LinearExcitability
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn from torch.nn.parameter import Parameter def linearExcitability(input, weight, excitability=None, bias=None): """Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`. Shape: - input: :math:`(N, *, in_features)` - we...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import nn from torch.nn.parameter import Parameter assert...
cuongpxu/continual-learning
LinearExcitability
false
1,761
[ "MIT" ]
0
0f799ddc0efe7e6df7038d2e97303add8d5e01fd
https://github.com/cuongpxu/continual-learning/tree/0f799ddc0efe7e6df7038d2e97303add8d5e01fd
import math import torch from torch import nn from torch.nn.parameter import Parameter def linearExcitability(input, weight, excitability=None, bias=None): """Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`. Shape: - input: :math:`(N, *, in_features)` - we...
EncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
congson1293/Transformer
EncoderLayer
false
1,762
[ "Apache-2.0" ]
0
249638f3287e0ed11c71496178fe2ceac2d758df
https://github.com/congson1293/Transformer/tree/249638f3287e0ed11c71496178fe2ceac2d758df
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.0...
DenseGraphConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class DenseGraphConv(torch.nn.Module): """See :class:`torch_geometric.nn.conv.GraphConv`. """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch.nn import Parameter import torch.utils.data assert_size_s...
cshjin/pytorch_geometric
DenseGraphConv
false
1,763
[ "MIT" ]
0
8dd0e76beb72135949a275edd851f80f7b97648f
https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f
import math import torch from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class Model(torch.nn.Module): """See :class:`torch_geometric.nn.conv.GraphConv`. """ def __...
BasicConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import time import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter def singleton(cls): obj = cls() cls.__new__ = staticmethod(lambda cls: obj) try: del cls.__init__ except AttributeError: pass return cls @singleton cla...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 time import torch.nn a...
Zikoat/musweeper
BasicConv
false
1,764
[ "MIT" ]
0
07e3e5e5e5e4edad4d8b1b6bb05aee2f33f8d9cb
https://github.com/Zikoat/musweeper/tree/07e3e5e5e5e4edad4d8b1b6bb05aee2f33f8d9cb
import time import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter def singleton(cls): obj = cls() cls.__new__ = staticmethod(lambda cls: obj) try: del cls.__init__ except AttributeError: pass return cls @singleton cla...
DenseGCNConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch.nn import Parameter import torch.utils.data def glorot(tensor): if tensor is not None: stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1))) tensor.data.uniform_(-stdv, stdv) def zeros(tensor): if tensor is not None: tensor.data.fill_(0) cl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
cshjin/pytorch_geometric
DenseGCNConv
false
1,765
[ "MIT" ]
0
8dd0e76beb72135949a275edd851f80f7b97648f
https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f
import math import torch from torch.nn import Parameter import torch.utils.data def glorot(tensor): if tensor is not None: stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1))) tensor.data.uniform_(-stdv, stdv) def zeros(tensor): if tensor is not None: tensor.data.fill_(0) cl...
InnerProductProbe
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 InnerProductProbe(nn.Module): def __init__(self, length: 'int', max_rank: 'int'=None): super().__init__() self.length = length if max_rank is None: max_rank = length self.b = nn.Parameter(torch.empty(max_rank, length, dtype=torc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
daemon/vizbert
InnerProductProbe
false
1,766
[ "MIT" ]
0
e40b7d1529f8857050313f8d87ff03b1b7226c9e
https://github.com/daemon/vizbert/tree/e40b7d1529f8857050313f8d87ff03b1b7226c9e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, length: 'int', max_rank: 'int'=None): super().__init__() self.length = length if max_rank is None: max_rank = length self.b = nn.Parameter(torch.empty(max_rank, length, dtype=torch. ...
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 as nn def conv3d(in_channels, out_channels, kernel_size, bias, padding=1): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding=1): """ Create...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cviaai/TMJ_tracking
Encoder
false
1,767
[ "MIT" ]
0
464ca21dbeb538dc9504bd5d0e5c4d92591e69c4
https://github.com/cviaai/TMJ_tracking/tree/464ca21dbeb538dc9504bd5d0e5c4d92591e69c4
import torch from torch import nn as nn def conv3d(in_channels, out_channels, kernel_size, bias, padding=1): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding=1): """ Create...
MultiHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import Tensor from torch.nn import Linear import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cshjin/pytorch_geometric
MultiHead
false
1,768
[ "MIT" ]
0
8dd0e76beb72135949a275edd851f80f7b97648f
https://github.com/cshjin/pytorch_geometric/tree/8dd0e76beb72135949a275edd851f80f7b97648f
import math import torch from torch import Tensor from torch.nn import Linear import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform...
MinibatchStdDev
# 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 MinibatchStdDev(nn.Module): """ Minibatch standard deviation layer for the discriminator, try to prevent mode collapse From https://github.com/akanimax/BMSG-GAN/ """ def __init__(self): """ derived class constructor """ 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
cwza/deep_t2i
MinibatchStdDev
false
1,769
[ "Apache-2.0" ]
0
22877fdd28ad407984ddc3bc4d57109c54c22fc0
https://github.com/cwza/deep_t2i/tree/22877fdd28ad407984ddc3bc4d57109c54c22fc0
import torch import torch.nn as nn class Model(nn.Module): """ Minibatch standard deviation layer for the discriminator, try to prevent mode collapse From https://github.com/akanimax/BMSG-GAN/ """ def __init__(self): """ derived class constructor """ super().__init...
Linker
# 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 Linker(nn.Module): def __init__(self, inplanes, outplanes, kernel_size, strides): super(Linker, self).__init__() self.avgpool = nn.AvgPool2d(kernel_size, strides) self.pad = (0, 0, 0, 0) + ((outplanes - inplanes) // ...
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...
daniel03c1/audio_augment
Linker
false
1,770
[ "MIT" ]
0
ee73bb0844e22c57c9cbeb129560da4a3853f77d
https://github.com/daniel03c1/audio_augment/tree/ee73bb0844e22c57c9cbeb129560da4a3853f77d
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inplanes, outplanes, kernel_size, strides): super().__init__() self.avgpool = nn.AvgPool2d(kernel_size, strides) self.pad = (0, 0, 0, 0) + ((outplanes - inplanes) // 2,) * 2 ...
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 import torch.nn import torch.nn as nn class Swish(nn.Module): """Applies the element-wise function: .. math:: \\text{Swish}(x) = x * \\text{Sigmoid}(\\alpha * x) for constant value alpha. Citation: Searching for Activation Functions, Ramachandran et al., 2017, https://arxiv.org/abs/...
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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo....
danielschulz/MONAI
Swish
false
1,772
[ "Apache-2.0" ]
0
54ef6e9e700f0de3d50184c0148f953be871a58e
https://github.com/danielschulz/MONAI/tree/54ef6e9e700f0de3d50184c0148f953be871a58e
import torch import torch.nn import torch.nn as nn class Model(nn.Module): """Applies the element-wise function: .. math:: \\text{Swish}(x) = x * \\text{Sigmoid}(\\alpha * x) for constant value alpha. Citation: Searching for Activation Functions, Ramachandran et al., 2017, https://arxiv.org/abs/...
DistanceMatrixLoss
# 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 DistanceMatrixLoss(nn.Module): def __init__(self): super().__init__() def forward(self, scores, labels, mask): sq_lengths = mask.view(mask.size(0), -1).sum(1) l1_diff = (mask * torch.abs(scores - labels)).view(labels.size(0), -1 )....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
daemon/vizbert
DistanceMatrixLoss
false
1,773
[ "MIT" ]
0
e40b7d1529f8857050313f8d87ff03b1b7226c9e
https://github.com/daemon/vizbert/tree/e40b7d1529f8857050313f8d87ff03b1b7226c9e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, scores, labels, mask): sq_lengths = mask.view(mask.size(0), -1).sum(1) l1_diff = (mask * torch.abs(scores - labels)).view(labels.size(0), -1 ).sum(1) ...
ExtResNetBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 as nn def conv3d(in_channels, out_channels, kernel_size, bias, padding=1): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding=1): """ Create...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
cviaai/TMJ_tracking
ExtResNetBlock
false
1,774
[ "MIT" ]
0
464ca21dbeb538dc9504bd5d0e5c4d92591e69c4
https://github.com/cviaai/TMJ_tracking/tree/464ca21dbeb538dc9504bd5d0e5c4d92591e69c4
import torch from torch import nn as nn def conv3d(in_channels, out_channels, kernel_size, bias, padding=1): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding=1): """ Create...
DepthwiseSeparableConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * class DepthwiseSeparableConv2d(nn.Module): def __init__(self, input, output, padding=0, bias=False): super(DepthwiseSeparableConv2d, self).__init__() self.depthwise = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.optim.lr_scheduler import torch.utils.data fr...
csharpshooter/DeepLearning
DepthwiseSeparableConv2d
false
1,775
[ "MIT" ]
0
c1d20660c32076468970f7376931e1fcd0d2644e
https://github.com/csharpshooter/DeepLearning/tree/c1d20660c32076468970f7376931e1fcd0d2644e
import torch import torch.nn as nn import torch.optim.lr_scheduler import torch.utils.data from torchvision.transforms import * class Model(nn.Module): def __init__(self, input, output, padding=0, bias=False): super().__init__() self.depthwise = nn.Conv2d(input, input, kernel_size=3, padding= ...
CARAFE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CARAFE(nn.Module): def __init__(self, inC, outC, Kencoder=3, delta=2, Kup=5, Cm=64): super(CARAFE, self).__init__() self.Kencoder = Kencoder self.delta = delta self.Kup = Kup self.down = nn.Conv2d(in_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
cs18chen/fbnn
CARAFE
false
1,776
[ "MIT" ]
0
1f52c49f8d1e0e1fa7b5a04677351817c4c0e977
https://github.com/cs18chen/fbnn/tree/1f52c49f8d1e0e1fa7b5a04677351817c4c0e977
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inC, outC, Kencoder=3, delta=2, Kup=5, Cm=64): super().__init__() self.Kencoder = Kencoder self.delta = delta self.Kup = Kup self.down = nn.Conv2d(in_channels=inC,...
AMBinaryLoss
# 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 AMBinaryLoss(nn.Module): def __init__(self, m=0.35, k=0.8, t=1, s=30, eps=1e-08, sym_adjustment= False, auto_balance=False, label_smooth=0.0, gamma_neg=0, gamma_pos=0): super().__init__() self.sym_adjustment = sym_adjustment self.gamma_neg ...
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 ...
daniil-lyakhov/deep-object-reid
AMBinaryLoss
false
1,777
[ "Apache-2.0" ]
0
b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, m=0.35, k=0.8, t=1, s=30, eps=1e-08, sym_adjustment= False, auto_balance=False, label_smooth=0.0, gamma_neg=0, gamma_pos=0): super().__init__() self.sym_adjustment = sym_adjustment self.gamma_neg = gamma...
MaxPoolBranch
# 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 MaxPoolBranch(nn.Module): """ InceptionV4 specific max pooling branch block. """ def __init__(self, kernel_size=3, stride=2, padding=0): super(MaxPoolBranch, self).__init__() self.pool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
daniil-lyakhov/deep-object-reid
MaxPoolBranch
false
1,778
[ "Apache-2.0" ]
0
b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
import torch import torch.nn as nn class Model(nn.Module): """ InceptionV4 specific max pooling branch block. """ def __init__(self, kernel_size=3, stride=2, padding=0): super().__init__() self.pool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=padding) ...
AsymmetricLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class AsymmetricLoss(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(self, gamma_neg=4, gamma_pos=0, probability_margin=0.05, eps=1e-08, label_smooth=0.0): super().__ini...
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...
daniil-lyakhov/deep-object-reid
AsymmetricLoss
false
1,779
[ "Apache-2.0" ]
0
b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
import torch import torch.nn as nn class Model(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(self, gamma_neg=4, gamma_pos=0, probability_margin=0.05, eps=1e-08, label_smooth=0.0): super().__init__() ...
CBOW
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CBOW(nn.Module): def __init__(self, input_size, hidden_size): super().__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, input_size) def forward(self, x): x = sum([*x]).float() x = self.f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
danny-1k/autocomplete_hist
CBOW
false
1,780
[ "BSD-2-Clause" ]
0
0a553ea59e08f2ddca60a1f35e9cf14d43370100
https://github.com/danny-1k/autocomplete_hist/tree/0a553ea59e08f2ddca60a1f35e9cf14d43370100
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, hidden_size): super().__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, input_size) def forward(self, x): x = sum([*x]).float() x = self....
GumbelSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def gumbel(x, eps=1e-20): return -torch.log(-torch.log(torch.rand_like(x) + eps) + eps) class GumbelSigmoid(nn.Module): def __init__(self, scale=1.0): super().__init__() self.scale = float(scale) def forward(self, logits): y = logits + gumbel(...
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...
daniil-lyakhov/deep-object-reid
GumbelSigmoid
false
1,781
[ "Apache-2.0" ]
0
b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
import torch import torch.nn as nn def gumbel(x, eps=1e-20): return -torch.log(-torch.log(torch.rand_like(x) + eps) + eps) class Model(nn.Module): def __init__(self, scale=1.0): super().__init__() self.scale = float(scale) def forward(self, logits): y = logits + gumbel(logits) ...
TorchDiceLoss
# 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 def soft_dice_loss(outputs, targets, per_image=False): batch_size = outputs.size()[0] eps = 1e-05 if not per_image: batch_size = 1 dice_target = targets.contiguous().view(batch_size, -1).float() dice_output = outputs.contiguous().view(batch_size, -1) i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
dannyjeck-matroid/solaris
TorchDiceLoss
false
1,782
[ "Apache-2.0" ]
0
463d220c1fe14f811cbbbf528a7353022538006e
https://github.com/dannyjeck-matroid/solaris/tree/463d220c1fe14f811cbbbf528a7353022538006e
import torch from torch import nn def soft_dice_loss(outputs, targets, per_image=False): batch_size = outputs.size()[0] eps = 1e-05 if not per_image: batch_size = 1 dice_target = targets.contiguous().view(batch_size, -1).float() dice_output = outputs.contiguous().view(batch_size, -1) i...
Normalize
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class Normalize(nn.Module): """ Scale Audio to be between -1 and 1 """ def __init__(self): super(Normalize, self).__init__() def forward(self, audio: 'torch.Tensor'): if len(audio.shape) != 2: raise ValueError('Audio should be 2D: [...
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...
dariocazzani/vo-id
Normalize
false
1,783
[ "MIT" ]
0
41d0f2779e7909cfa15afcb6c8222c48a5855eb8
https://github.com/dariocazzani/vo-id/tree/41d0f2779e7909cfa15afcb6c8222c48a5855eb8
import torch import torch.nn as nn class Model(nn.Module): """ Scale Audio to be between -1 and 1 """ def __init__(self): super().__init__() def forward(self, audio: 'torch.Tensor'): if len(audio.shape) != 2: raise ValueError('Audio should be 2D: [batch_size X audio_...
LCTGate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LCTGate(nn.Module): def __init__(self, channels, groups=16): super(LCTGate, self).__init__() assert channels > 0 assert groups > 0 while channels % groups != 0: groups //= 2 self.gn = nn.GroupNorm(groups, channels, affin...
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_...
daniil-lyakhov/deep-object-reid
LCTGate
false
1,784
[ "Apache-2.0" ]
0
b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
https://github.com/daniil-lyakhov/deep-object-reid/tree/b0f7d6a2d4cff8c417a66d82c09d16788d81ec67
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, channels, groups=16): super().__init__() assert channels > 0 assert groups > 0 while channels % groups != 0: groups //= 2 self.gn = nn.GroupNorm(groups, channels, affine=True) ...
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 collections import torch import warnings from typing import Optional from typing import Union from typing import Any from typing import Callable from typing import Tuple import torch.nn from torch.nn.modules.loss import _Loss from enum import Enum import collections.abc def issequenceiterable(obj: 'Any') ->boo...
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 collections from typing import Optional from typing import Union from typing import Any from typing import Callable from typing impor...
danielschulz/MONAI
DiceLoss
false
1,785
[ "Apache-2.0" ]
0
54ef6e9e700f0de3d50184c0148f953be871a58e
https://github.com/danielschulz/MONAI/tree/54ef6e9e700f0de3d50184c0148f953be871a58e
import collections import torch import warnings from typing import Optional from typing import Union from typing import Any from typing import Callable from typing import Tuple import torch.nn from torch.nn.modules.loss import _Loss from enum import Enum import collections.abc def issequenceiterable(obj: 'Any') ->boo...
TorchJaccardLoss
# 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 TorchJaccardLoss(torch.nn.modules.Module): def __init__(self): super(TorchJaccardLoss, self).__init__() def forward(self, outputs, targets): eps = 1e-15 jaccard_target = (targets == 1).float() jaccard_output = torch.sigmoid(outputs) intersection = (...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
dannyjeck-matroid/solaris
TorchJaccardLoss
false
1,786
[ "Apache-2.0" ]
0
463d220c1fe14f811cbbbf528a7353022538006e
https://github.com/dannyjeck-matroid/solaris/tree/463d220c1fe14f811cbbbf528a7353022538006e
import torch class Model(torch.nn.modules.Module): def __init__(self): super().__init__() def forward(self, outputs, targets): eps = 1e-15 jaccard_target = (targets == 1).float() jaccard_output = torch.sigmoid(outputs) intersection = (jaccard_output * jaccard_target)....
Normalize3D
# 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 Normalize3D(nn.Module): """ Scale Spectrogram to be between 0 and 1 """ def __init__(self): super(Normalize3D, self).__init__() def forward(self, X: 'torch.Tensor'): if len(X.shape) != 3: raise ValueError( 'Inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
dariocazzani/vo-id
Normalize3D
false
1,787
[ "MIT" ]
0
41d0f2779e7909cfa15afcb6c8222c48a5855eb8
https://github.com/dariocazzani/vo-id/tree/41d0f2779e7909cfa15afcb6c8222c48a5855eb8
import torch import torch.nn as nn class Model(nn.Module): """ Scale Spectrogram to be between 0 and 1 """ def __init__(self): super().__init__() def forward(self, X: 'torch.Tensor'): if len(X.shape) != 3: raise ValueError( 'Input should be 3D: [batch...
BertPooler
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.onnx class BertPooler(nn.Module): def __init__(self, config): super(BertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Alwaysproblem/examples-1
BertPooler
false
1,788
[ "MIT" ]
0
9754fa63ed1931489a21ac1f5b299f945e369a5c
https://github.com/Alwaysproblem/examples-1/tree/9754fa63ed1931489a21ac1f5b299f945e369a5c
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.onnx class Model(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() self.cls_position = c...
CriticNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class CriticNet(nn.Module): """Critic (Value estimator) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Params ====== ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
danthe42/drlnd_p2
CriticNet
false
1,789
[ "MIT" ]
0
693813feb7c99f3e01da583e5b67e4f8904639c4
https://github.com/danthe42/drlnd_p2/tree/693813feb7c99f3e01da583e5b67e4f8904639c4
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Critic (Value estimator) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Params ====== s...
SetConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn as nn class SetConv(nn.Module): def __init__(self, sample_feats, predicate_feats, join_feats, hid_units): super(SetConv, self).__init__() self.sample_mlp1 = nn.Linear(sample_feats, hid_units) self.sample_mlp2 = nn.Linear(hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
danield137/deep_query_optimzation
SetConv
false
1,790
[ "MIT" ]
0
01a25c966338007f15d14dea1b37e388e47bcfe3
https://github.com/danield137/deep_query_optimzation/tree/01a25c966338007f15d14dea1b37e388e47bcfe3
import torch from torch.nn import functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, sample_feats, predicate_feats, join_feats, hid_units): super().__init__() self.sample_mlp1 = nn.Linear(sample_feats, hid_units) self.sample_mlp2 = nn.Linear(hid_units, hid_un...
SetConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SetConv(nn.Module): def __init__(self, sample_feats, predicate_feats, predicate_uri_feats, join_feats, hid_units): super(SetConv, self).__init__() self.sample_mlp1 = nn.Linear(sample_feats, hid_units) self.sa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
dacasals/learnedcardinalities
SetConv
false
1,791
[ "MIT" ]
0
ee9741ce1a7b55ed18c33fbd6047484e50068037
https://github.com/dacasals/learnedcardinalities/tree/ee9741ce1a7b55ed18c33fbd6047484e50068037
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, sample_feats, predicate_feats, predicate_uri_feats, join_feats, hid_units): super().__init__() self.sample_mlp1 = nn.Linear(sample_feats, hid_units) self.sample_mlp2 = nn....
SoftArgmax2D
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from typing import Optional def create_meshgrid(x: 'torch.Tensor', normalized_coordinates: 'Optional[bool]' ) ->torch.Tensor: assert len(x.shape) == 4, x.shape _, _, height, width = x.shape _device, _dtype = x.device, x.dtype if normalized_coordinates: xs...
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 ...
danyayay/ynet_adaptive
SoftArgmax2D
false
1,792
[ "MIT" ]
0
f1daea6f3d5ec8a7349c2ee72bf742df83786103
https://github.com/danyayay/ynet_adaptive/tree/f1daea6f3d5ec8a7349c2ee72bf742df83786103
import torch import torch.nn as nn from typing import Optional def create_meshgrid(x: 'torch.Tensor', normalized_coordinates: 'Optional[bool]' ) ->torch.Tensor: assert len(x.shape) == 4, x.shape _, _, height, width = x.shape _device, _dtype = x.device, x.dtype if normalized_coordinates: xs...
FilterNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn.init import calculate_gain class FilterNorm(nn.Module): def __init__(self, in_channels, kernel_size, filter_type, nonlinearity= 'linear', running_std=False, running_mean=False): assert filter_type in ('spatial', 'channel') assert in_channel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.init import calculate_gain assert_size_stri...
danyayay/ynet_adaptive
FilterNorm
false
1,793
[ "MIT" ]
0
f1daea6f3d5ec8a7349c2ee72bf742df83786103
https://github.com/danyayay/ynet_adaptive/tree/f1daea6f3d5ec8a7349c2ee72bf742df83786103
import torch import torch.nn as nn from torch.nn.init import calculate_gain class Model(nn.Module): def __init__(self, in_channels, kernel_size, filter_type, nonlinearity= 'linear', running_std=False, running_mean=False): assert filter_type in ('spatial', 'channel') assert in_channels >= ...
TorchFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch import nn class TorchFocalLoss(nn.Module): """Implementation of Focal Loss[1]_ modified from Catalyst [2]_ . Arguments --------- gamma : :class:`int` or :class:`float` Focusing parameter. See [1]_ . alpha : :class:`int` or :class:`fl...
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 ...
dannyjeck-matroid/solaris
TorchFocalLoss
false
1,794
[ "Apache-2.0" ]
0
463d220c1fe14f811cbbbf528a7353022538006e
https://github.com/dannyjeck-matroid/solaris/tree/463d220c1fe14f811cbbbf528a7353022538006e
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): """Implementation of Focal Loss[1]_ modified from Catalyst [2]_ . Arguments --------- gamma : :class:`int` or :class:`float` Focusing parameter. See [1]_ . alpha : :class:`int` or :class:`float` ...
Cauchy
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.model_zoo class Cauchy(nn.Module): def __init__(self): super(Cauchy, self).__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = 0.5 * self.c ** 2 * torch.log(1 + (ra / sel...
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 ...
davefiorino/EDSR-PyTorch
Cauchy
false
1,795
[ "MIT" ]
0
97ad32a09a71816a36c45d92cdb2ea7ab42ba685
https://github.com/davefiorino/EDSR-PyTorch/tree/97ad32a09a71816a36c45d92cdb2ea7ab42ba685
import torch import torch.nn as nn import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = 0.5 * self.c ** 2 * torch.log(1 + (ra / self.c) ** 2) ...
Fair
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.model_zoo class Fair(nn.Module): def __init__(self): super(Fair, self).__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = self.c ** 2 * (ra / self.c - torch.log(1 + ra /...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
davefiorino/EDSR-PyTorch
Fair
false
1,796
[ "MIT" ]
0
97ad32a09a71816a36c45d92cdb2ea7ab42ba685
https://github.com/davefiorino/EDSR-PyTorch/tree/97ad32a09a71816a36c45d92cdb2ea7ab42ba685
import torch import torch.nn as nn import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = self.c ** 2 * (ra / self.c - torch.log(1 + ra / self.c))...
Charbonnier
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.model_zoo class Charbonnier(nn.Module): def __init__(self): super(Charbonnier, self).__init__() self.eps = 1e-06 def forward(self, X, Y): diff = torch.add(X, -Y) error = torch.sqrt(diff * diff + self.eps) loss = to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
davefiorino/EDSR-PyTorch
Charbonnier
false
1,797
[ "MIT" ]
0
97ad32a09a71816a36c45d92cdb2ea7ab42ba685
https://github.com/davefiorino/EDSR-PyTorch/tree/97ad32a09a71816a36c45d92cdb2ea7ab42ba685
import torch import torch.nn as nn import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.eps = 1e-06 def forward(self, X, Y): diff = torch.add(X, -Y) error = torch.sqrt(diff * diff + self.eps) loss = torch.sum(error) ...
Classifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.distributed import torch import torch.nn as nn class Classifier(nn.Module): def __init__(self, hidden_size): super(Classifier, self).__init__() self.linear1 = nn.Linear(hidden_size, 1) self.sigmoid = nn.Sigmoid() def forward(self, x, mask_cls): h = 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.distributed import torch import torch.nn as nn assert_size_stride =...
dat821168/PreSumm
Classifier
false
1,798
[ "MIT" ]
0
3c84fc97f50a193a865ccef2300adf5683397539
https://github.com/dat821168/PreSumm/tree/3c84fc97f50a193a865ccef2300adf5683397539
import torch import torch.distributed import torch import torch.nn as nn class Model(nn.Module): def __init__(self, hidden_size): super().__init__() self.linear1 = nn.Linear(hidden_size, 1) self.sigmoid = nn.Sigmoid() def forward(self, x, mask_cls): h = self.linear1(x).squeez...
CustomBatchNormManualModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CustomBatchNormManualFunction(torch.autograd.Function): """ This torch.autograd.Function implements a functional custom version of the batch norm operation for MLPs. Using torch.autograd.Function allows you to write a custom backward function. The function will...
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_...
davide-belli/deep-learning-labs
CustomBatchNormManualModule
false
1,799
[ "MIT" ]
0
1acd37a527711dccdc00c1935724cc5de7c10955
https://github.com/davide-belli/deep-learning-labs/tree/1acd37a527711dccdc00c1935724cc5de7c10955
import torch import torch.nn as nn class CustomBatchNormManualFunction(torch.autograd.Function): """ This torch.autograd.Function implements a functional custom version of the batch norm operation for MLPs. Using torch.autograd.Function allows you to write a custom backward function. The function will...
Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self): super(Discriminator, self).__init__() self.linear1 = nn.Linear(784, 512) self.lrelu2 = nn.LeakyReLU(0.2) self.linear2 = nn.Linear(512, 256) self.lrelu3 = nn.LeakyReLU(0.2) self.l...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
davide-belli/deep-learning-labs
Discriminator
false
1,800
[ "MIT" ]
0
1acd37a527711dccdc00c1935724cc5de7c10955
https://github.com/davide-belli/deep-learning-labs/tree/1acd37a527711dccdc00c1935724cc5de7c10955
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.linear1 = nn.Linear(784, 512) self.lrelu2 = nn.LeakyReLU(0.2) self.linear2 = nn.Linear(512, 256) self.lrelu3 = nn.LeakyReLU(0.2) self.linear3 = nn.Linear(256, 1) ...
ConcatPool2d
# 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 ConcatPool2d(nn.Module): """Layer that concats `AvgPool2d` and `MaxPool2d`""" def __init__(self, ks, stride=None, padding=0): super().__init__() self.ap = nn.AvgPool2d(ks, stride, padding) self.mp = nn.MaxPool2d(ks, stride, padding) def fo...
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...
davidleonfdez/face2anime
ConcatPool2d
false
1,801
[ "MIT" ]
0
896bf85a7aa28322cc9e9e586685db8cbbf39d89
https://github.com/davidleonfdez/face2anime/tree/896bf85a7aa28322cc9e9e586685db8cbbf39d89
import torch import torch.nn as nn class Model(nn.Module): """Layer that concats `AvgPool2d` and `MaxPool2d`""" def __init__(self, ks, stride=None, padding=0): super().__init__() self.ap = nn.AvgPool2d(ks, stride, padding) self.mp = nn.MaxPool2d(ks, stride, padding) def forward(s...
CustomBatchNormAutograd
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CustomBatchNormAutograd(nn.Module): """ This nn.module implements a custom version of the batch norm operation for MLPs. The operations called in self.forward track the history if the input tensors have the flag requires_grad set to True. The backward pass does...
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_...
davide-belli/deep-learning-labs
CustomBatchNormAutograd
false
1,802
[ "MIT" ]
0
1acd37a527711dccdc00c1935724cc5de7c10955
https://github.com/davide-belli/deep-learning-labs/tree/1acd37a527711dccdc00c1935724cc5de7c10955
import torch import torch.nn as nn class Model(nn.Module): """ This nn.module implements a custom version of the batch norm operation for MLPs. The operations called in self.forward track the history if the input tensors have the flag requires_grad set to True. The backward pass does not need to be im...
PixelWise
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.utils.data.distributed import torch.nn.init class PixelWise(torch.nn.Module): """ Implemented - https://arxiv.org/pdf/1710.10196.pdf """ def __init__(self, eps=1e-08): super(PixelWise, self).__init__() self.eps = eps def forward(self, ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch.utils.data.distributed import torch.nn.ini...
davidwagnerkc/TensorMONK
PixelWise
false
1,803
[ "MIT" ]
0
3607836d3d6bfd0994e044536b2a51bc84b35f31
https://github.com/davidwagnerkc/TensorMONK/tree/3607836d3d6bfd0994e044536b2a51bc84b35f31
import torch import torch.utils.data import torch.utils.data.distributed import torch.nn.init class Model(torch.nn.Module): """ Implemented - https://arxiv.org/pdf/1710.10196.pdf """ def __init__(self, eps=1e-08): super().__init__() self.eps = eps def forward(self, tensor): retur...
PositionwiseFeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.distributed import torch import torch.nn as nn def gelu(x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
dat821168/PreSumm
PositionwiseFeedForward
false
1,804
[ "MIT" ]
0
3c84fc97f50a193a865ccef2300adf5683397539
https://github.com/dat821168/PreSumm/tree/3c84fc97f50a193a865ccef2300adf5683397539
import math import torch import torch.distributed import torch import torch.nn as nn def gelu(x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Model(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_m...
MiniBatchStdDev
# 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 MiniBatchStdDev(nn.Module): """Layer that appends to every element of a batch a new ftr map containing the std of its group.""" def __init__(self, group_sz=4, unbiased_std=False): super().__init__() self.group_sz = group_sz self.unbiased_std = ...
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_...
davidleonfdez/face2anime
MiniBatchStdDev
false
1,805
[ "MIT" ]
0
896bf85a7aa28322cc9e9e586685db8cbbf39d89
https://github.com/davidleonfdez/face2anime/tree/896bf85a7aa28322cc9e9e586685db8cbbf39d89
import torch import torch.nn as nn class Model(nn.Module): """Layer that appends to every element of a batch a new ftr map containing the std of its group.""" def __init__(self, group_sz=4, unbiased_std=False): super().__init__() self.group_sz = group_sz self.unbiased_std = unbiased_s...
MultiheadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch as th import torch.nn as nn class QKVMultiheadAttention(nn.Module): def __init__(self, n_heads: 'int', n_ctx: 'int'): super().__init__() self.n_heads = n_heads self.n_ctx = n_ctx def forward(self, qkv): bs, n_ctx, width = qkv.shape ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
dashstander/glide-text2im
MultiheadAttention
false
1,806
[ "MIT" ]
0
58f03a871ee0567e27fccc40df98203e675a9b8e
https://github.com/dashstander/glide-text2im/tree/58f03a871ee0567e27fccc40df98203e675a9b8e
import math import torch import torch as th import torch.nn as nn class QKVMultiheadAttention(nn.Module): def __init__(self, n_heads: 'int', n_ctx: 'int'): super().__init__() self.n_heads = n_heads self.n_ctx = n_ctx def forward(self, qkv): bs, n_ctx, width = qkv.shape ...
Q_Index
# 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 Q_Index(nn.Module): """ Quality measurement between perturbated (image with applied noise) and denoised target image. This module works only for images with a single color channel (grayscale) """ def __init__(self): super().__init__() def forw...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
dawnofthedebayan/MedAI_Project
Q_Index
false
1,807
[ "Apache-2.0" ]
0
a7f2597c96569662f1ca9d21ffd0eb41c77211c1
https://github.com/dawnofthedebayan/MedAI_Project/tree/a7f2597c96569662f1ca9d21ffd0eb41c77211c1
import torch import torch.nn as nn class Model(nn.Module): """ Quality measurement between perturbated (image with applied noise) and denoised target image. This module works only for images with a single color channel (grayscale) """ def __init__(self): super().__init__() def forwar...
myNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 myNet(nn.Module): def __init__(self, in_features, num_classes=10): super(myNet, self).__init__() self.fc1 = nn.Linear(in_features, 1000) self.fc2 = nn.Linear(1000, 100) self.fc3 = nn.Linear(100, num_classes) self.relu = nn.ReLU() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
daxiongpro/pytorch-tutorial
myNet
false
1,808
[ "MIT" ]
0
abafc32f7ee1092024085f703e4ced51ce358a1b
https://github.com/daxiongpro/pytorch-tutorial/tree/abafc32f7ee1092024085f703e4ced51ce358a1b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_features, num_classes=10): super().__init__() self.fc1 = nn.Linear(in_features, 1000) self.fc2 = nn.Linear(1000, 100) self.fc3 = nn.Linear(100, num_classes) self.relu = nn.ReLU() def forw...
ConvolutionTranspose
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.utils.data.distributed import torch.nn.init import torch.nn as nn import torch.nn.functional as F def Normalizations(tensor_size=None, normalization=None, available=False, **kwargs): """Does normalization on 4D tensor. Args: tensor_size: shape of ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
davidwagnerkc/TensorMONK
ConvolutionTranspose
false
1,809
[ "MIT" ]
0
3607836d3d6bfd0994e044536b2a51bc84b35f31
https://github.com/davidwagnerkc/TensorMONK/tree/3607836d3d6bfd0994e044536b2a51bc84b35f31
import torch import torch.utils.data import torch.utils.data.distributed import torch.nn.init import torch.nn as nn import torch.nn.functional as F def Normalizations(tensor_size=None, normalization=None, available=False, **kwargs): """Does normalization on 4D tensor. Args: tensor_size: shape of ...
Conv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch from torch.nn.modules.utils import _pair import torch.nn.functional as F import torch.utils.data from torch.nn.parameter import Parameter from torch.nn.functional import pad from torch.nn.modules import Module def conv2d_same_padding(input, weight, bias=None, strid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import math from torch.nn.modules.utils import _pair...
ddayzzz/mmdetection
Conv2d
false
1,810
[ "Apache-2.0" ]
0
b9940c56cc19b3dda7468a5fd858b9683e93a486
https://github.com/ddayzzz/mmdetection/tree/b9940c56cc19b3dda7468a5fd858b9683e93a486
from torch.nn import Module import math import torch from torch.nn.modules.utils import _pair import torch.nn.functional as F import torch.utils.data from torch.nn.parameter import Parameter from torch.nn.functional import pad from torch.nn.modules import Module def conv2d_same_padding(input, weight, bias=None, strid...
GeneralizedDiceLoss
# 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 collections import torch import warnings from typing import Optional from typing import Union from typing import Any from typing import Callable from typing import Tuple import torch.nn from torch.nn.modules.loss import _Loss from enum import Enum import collections.abc def issequenceiterable(obj: 'Any') ->boo...
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 collections from typi...
danielschulz/MONAI
GeneralizedDiceLoss
false
1,811
[ "Apache-2.0" ]
0
54ef6e9e700f0de3d50184c0148f953be871a58e
https://github.com/danielschulz/MONAI/tree/54ef6e9e700f0de3d50184c0148f953be871a58e
import collections import torch import warnings from typing import Optional from typing import Union from typing import Any from typing import Callable from typing import Tuple import torch.nn from torch.nn.modules.loss import _Loss from enum import Enum import collections.abc def issequenceiterable(obj: 'Any') ->boo...
AngularPenaltySMLoss
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 AngularPenaltySMLoss(nn.Module): def __init__(self, in_features, out_features, loss_type='arcface', eps= 1e-07, s=None, m=None): """ Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
dayoungMM/Angular-Penalty-Softmax-Losses-Pytorch
AngularPenaltySMLoss
false
1,812
[ "MIT" ]
0
5599f2e280b2af8d40e53727290eb797d18e7239
https://github.com/dayoungMM/Angular-Penalty-Softmax-Losses-Pytorch/tree/5599f2e280b2af8d40e53727290eb797d18e7239
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_features, out_features, loss_type='arcface', eps= 1e-07, s=None, m=None): """ Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cos...
ToSEG
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.autograd import Function import math import torch import warnings import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.utils.cpp_extension def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5): if input.device.type == 'cpu': if bias is not 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.autograd import Function import math import warnings import numpy as ...
crobbins327/semanticGAN_WSI
ToSEG
false
1,813
[ "BSD-2-Clause", "MIT" ]
0
4046ddc822f463e03952402247f79d540bf7be95
https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95
from torch.autograd import Function import math import torch import warnings import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.utils.cpp_extension def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5): if input.device.type == 'cpu': if bias is not N...
ResidualAttentionBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 as th import torch.nn as nn class LayerNorm(nn.LayerNorm): """ Implementation that supports fp16 inputs but fp32 gains/biases. """ def forward(self, x: 'th.Tensor'): return super().forward(x.float()) class QKVMultiheadAttention(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 import triton_helpers from torch._inductor.runtime....
dashstander/glide-text2im
ResidualAttentionBlock
false
1,814
[ "MIT" ]
0
58f03a871ee0567e27fccc40df98203e675a9b8e
https://github.com/dashstander/glide-text2im/tree/58f03a871ee0567e27fccc40df98203e675a9b8e
import math import torch import torch as th import torch.nn as nn class LayerNorm(nn.LayerNorm): """ Implementation that supports fp16 inputs but fp32 gains/biases. """ def forward(self, x: 'th.Tensor'): return super().forward(x.float()) class QKVMultiheadAttention(nn.Module): def __in...
FilterResponseNorm_layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class FilterResponseNorm_layer(nn.Module): def __init__(self, num_filters, eps=1e-06): super(FilterResponseNorm_layer, self).__init__() self.eps = eps par_shape = 1, num_filters, 1, 1 self.tau = torch.nn.Parameter(torch.zeros(par_shape)) ...
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...
deebuls/pytorch-cifar
FilterResponseNorm_layer
false
1,815
[ "MIT" ]
0
c6d9b16eeb00418d8c4f4f4c1e97f141c1f7d198
https://github.com/deebuls/pytorch-cifar/tree/c6d9b16eeb00418d8c4f4f4c1e97f141c1f7d198
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_filters, eps=1e-06): super().__init__() self.eps = eps par_shape = 1, num_filters, 1, 1 self.tau = torch.nn.Parameter(torch.zeros(par_shape)) self.beta = torch.nn.Parameter(torch.zeros(par_sh...
TSA_Fusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.functional as F import torch.nn as nn class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super(TSA_Fusion, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
creeper121386/EDVR-modified
TSA_Fusion
false
1,816
[ "Apache-2.0" ]
0
3fa565b99811e8f84f6ea3793090614606382332
https://github.com/creeper121386/EDVR-modified/tree/3fa565b99811e8f84f6ea3793090614606382332
import torch import torch.utils.data import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super().__init__() ...
ps_FNNDenoiser
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.init import xavier_normal_ from torch.nn.functional import relu class ps_FNNDenoiser(Module): def __init__(self, input_dim): """The FNN enc and FNN dec of the Denoiser. :param input_dim: The input dimensionality. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module f...
ddcas/singing-language-identification
ps_FNNDenoiser
false
1,817
[ "MIT" ]
0
d104419b196d56d4de37cff47c32e88e28c58690
https://github.com/ddcas/singing-language-identification/tree/d104419b196d56d4de37cff47c32e88e28c58690
from torch.nn import Module import torch from torch.nn import Linear from torch.nn.init import xavier_normal_ from torch.nn.functional import relu class Model(Module): def __init__(self, input_dim): """The FNN enc and FNN dec of the Denoiser. :param input_dim: The input dimensionality. :...
RegularizedLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 RegularizedLinear(nn.Linear): def __init__(self, *args, ar_weight=0.001, l1_weight=0.001, **kwargs): super(RegularizedLinear, self).__init__(*args, **kwargs) self.ar_weight = ar_weight self.l1_weight = l1_weight self._losses = {} def 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....
dearkafka/inferno
RegularizedLinear
false
1,818
[ "Apache-2.0" ]
0
e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a
https://github.com/dearkafka/inferno/tree/e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a
import torch import torch.nn as nn class Model(nn.Linear): def __init__(self, *args, ar_weight=0.001, l1_weight=0.001, **kwargs): super().__init__(*args, **kwargs) self.ar_weight = ar_weight self.l1_weight = l1_weight self._losses = {} def forward(self, input): output...
SorensenDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.autograd import Variable def assert_(condition, message='', exception_type=AssertionError): """Like assert, but with arbitrary exception types.""" if not condition: raise exception_type(message) def flatten_samples(tensor_or_variable): """ Flatte...
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...
dearkafka/inferno
SorensenDiceLoss
false
1,819
[ "Apache-2.0" ]
0
e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a
https://github.com/dearkafka/inferno/tree/e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a
import torch import torch.nn as nn from torch.autograd import Variable def assert_(condition, message='', exception_type=AssertionError): """Like assert, but with arbitrary exception types.""" if not condition: raise exception_type(message) def flatten_samples(tensor_or_variable): """ Flatte...
MTFullyConnected
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import time import torch import numpy as np from torch import nn from torch import optim from torch.nn import functional as F class Base(nn.Module): """ This class is the base structure for all of classification/regression DNN models. Mainly, it provides the general methods for training, evaluating model and ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 time import numpy as n...
cthoyt/DrugEx
MTFullyConnected
false
1,820
[ "MIT" ]
0
9e4d31adb2c65d0afc852948f502c79dcf8308a3
https://github.com/cthoyt/DrugEx/tree/9e4d31adb2c65d0afc852948f502c79dcf8308a3
import time import torch import numpy as np from torch import nn from torch import optim from torch.nn import functional as F class Base(nn.Module): """ This class is the base structure for all of classification/regression DNN models. Mainly, it provides the general methods for training, evaluating model and ...
Maxout
# 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 Maxout(nn.Module): def __init__(self, pool_size): super().__init__() self._pool_size = pool_size def forward(self, x): assert x.shape[-1 ] % self._pool_size == 0, 'Wrong input last dim size ({}) for Maxout({})'.format( 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 import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
demdecuong/SEGMENT
Maxout
false
1,821
[ "MIT" ]
0
629dc55dcbc9629b35fb237e313b95ceacecdc89
https://github.com/demdecuong/SEGMENT/tree/629dc55dcbc9629b35fb237e313b95ceacecdc89
import torch from torch import nn class Model(nn.Module): def __init__(self, pool_size): super().__init__() self._pool_size = pool_size def forward(self, x): assert x.shape[-1 ] % self._pool_size == 0, 'Wrong input last dim size ({}) for Maxout({})'.format( x....
Debayer2x2
# 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 Debayer2x2(nn.Module): """Demosaicing of Bayer images using 2x2 convolutions. Requires BG-Bayer color filter array layout. That is, the image[1,1]='B', image[1,2]='G'. """ def __init__(self): super(Debayer2x2, self)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
delldu/ImageClean
Debayer2x2
false
1,822
[ "MIT" ]
0
ffa5b180d36afb3840c6b36c08a767c520068498
https://github.com/delldu/ImageClean/tree/ffa5b180d36afb3840c6b36c08a767c520068498
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Demosaicing of Bayer images using 2x2 convolutions. Requires BG-Bayer color filter array layout. That is, the image[1,1]='B', image[1,2]='G'. """ def __init__(self): super().__init__() s...
MuSigmaEncoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 typing import Tuple from torch import nn class MuSigmaEncoder(nn.Module): """ Maps a representation r to mu and sigma which will define the normal distribution from which we sample the latent variable z. Parameters ---------- r_dim : int Dimension of output representa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
deltaskelta/neural-processes
MuSigmaEncoder
false
1,823
[ "MIT" ]
0
34a6b98b7a9142f5e5f87f7f1644217d5aa9e1bb
https://github.com/deltaskelta/neural-processes/tree/34a6b98b7a9142f5e5f87f7f1644217d5aa9e1bb
import torch from typing import Tuple from torch import nn class Model(nn.Module): """ Maps a representation r to mu and sigma which will define the normal distribution from which we sample the latent variable z. Parameters ---------- r_dim : int Dimension of output representation r. ...
fixed_loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class fixed_loss(nn.Module): def __init__(self): super().__init__() def forward(self, out_image, gt_image, est_noise, gt_noise, if_asym): h_x = est_noise.size()[2] w_x = est_noise.size()[3] count_h = self._ten...
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 ...
delldu/ImageClean
fixed_loss
false
1,824
[ "MIT" ]
0
ffa5b180d36afb3840c6b36c08a767c520068498
https://github.com/delldu/ImageClean/tree/ffa5b180d36afb3840c6b36c08a767c520068498
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, out_image, gt_image, est_noise, gt_noise, if_asym): h_x = est_noise.size()[2] w_x = est_noise.size()[3] count_h = self._tensor_s...
Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.utils.data def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class Discriminator(nn.Module): def __init__(self, hidden_dim): super(Discriminator, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn import torch.utils.data assert_size_stride = t...
dendisuhubdy/pytorch_geometric
Discriminator
false
1,825
[ "MIT" ]
0
a0592f61aef617c0c8ff61b3d822d04901054c22
https://github.com/dendisuhubdy/pytorch_geometric/tree/a0592f61aef617c0c8ff61b3d822d04901054c22
import math import torch import torch.nn as nn import torch.utils.data def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class Model(nn.Module): def __init__(self, hidden_dim): super().__init__() self.weight = nn.Par...
STFullyConnected
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import time import torch import numpy as np from torch import nn from torch import optim from torch.nn import functional as F class Base(nn.Module): """ This class is the base structure for all of classification/regression DNN models. Mainly, it provides the general methods for training, evaluating model and ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cthoyt/DrugEx
STFullyConnected
false
1,826
[ "MIT" ]
0
9e4d31adb2c65d0afc852948f502c79dcf8308a3
https://github.com/cthoyt/DrugEx/tree/9e4d31adb2c65d0afc852948f502c79dcf8308a3
import time import torch import numpy as np from torch import nn from torch import optim from torch.nn import functional as F class Base(nn.Module): """ This class is the base structure for all of classification/regression DNN models. Mainly, it provides the general methods for training, evaluating model and ...
SoftDetectionModule
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class SoftDetectionModule(nn.Module): def __init__(self, soft_local_max_size=3): super(SoftDetectionModule, self).__init__() self.soft_local_max_size = soft_local_max_size self.pad = self.soft_local_max_size // 2 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
deep-learning-20/d2-net
SoftDetectionModule
false
1,827
[ "BSD-3-Clause-Clear" ]
0
b092186353af23e9247c7f56ac2de3396b8c5a00
https://github.com/deep-learning-20/d2-net/tree/b092186353af23e9247c7f56ac2de3396b8c5a00
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, soft_local_max_size=3): super().__init__() self.soft_local_max_size = soft_local_max_size self.pad = self.soft_local_max_size // 2 def forward(self, batch): b = batch...
AdaptiveAvgPool3dOutSize1
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data from abc import abstractmethod from typing import Tuple import torch.nn class EfficientBlockBase(nn.Module): """ PyTorchVideo/accelerator provides a set of efficient blocks that have optimal efficiency for each target hardware device. Each ef...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data from abc import abstractmethod from typing import Tuple import torch.nn assert_size_stride = t...
denred0/pytorchvideo
AdaptiveAvgPool3dOutSize1
false
1,828
[ "Apache-2.0" ]
0
d874bfc9969895d2afcedea2e12bae5e1bcfb809
https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809
import torch import torch.nn as nn import torch.utils.data from abc import abstractmethod from typing import Tuple import torch.nn class EfficientBlockBase(nn.Module): """ PyTorchVideo/accelerator provides a set of efficient blocks that have optimal efficiency for each target hardware device. Each ef...
SELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F def where(condition, if_true, if_false): """ Torch equivalent of numpy.where. Parameters ---------- condition : torch.ByteTensor or torch.cuda.ByteTensor or torch.autograd.Variable Condi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.autograd import Variable import torch.nn.funct...
dearkafka/inferno
SELU
false
1,829
[ "Apache-2.0" ]
0
e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a
https://github.com/dearkafka/inferno/tree/e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F def where(condition, if_true, if_false): """ Torch equivalent of numpy.where. Parameters ---------- condition : torch.ByteTensor or torch.cuda.ByteTensor or torch.autograd.Variable Condi...
BatchDHCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.utils.data import torch.optim class BatchDHCN(nn.Module): """docstring for BatchDHCN""" def __init__(self, embed_size=512, output_size=512, num_channel=2, conv_size=3, batch_norm=True): super(Ba...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
deeplearning2020/self
BatchDHCN
false
1,830
[ "MIT" ]
0
cf0e6f9acdcfe17906c6327042d25ac9c8894885
https://github.com/deeplearning2020/self/tree/cf0e6f9acdcfe17906c6327042d25ac9c8894885
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils import torch.utils.data import torch.optim class Model(nn.Module): """docstring for BatchDHCN""" def __init__(self, embed_size=512, output_size=512, num_channel=2, conv_size=3, batch_norm=True): super().__in...
DenseSAGEConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn.functional as F import torch.utils.data from torch.nn import Parameter def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class DenseSAGEConv(torch.nn.Module): def __init__(self, in_channels, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
dendisuhubdy/pytorch_geometric
DenseSAGEConv
false
1,831
[ "MIT" ]
0
a0592f61aef617c0c8ff61b3d822d04901054c22
https://github.com/dendisuhubdy/pytorch_geometric/tree/a0592f61aef617c0c8ff61b3d822d04901054c22
import math import torch import torch.nn.functional as F import torch.utils.data from torch.nn import Parameter def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class Model(torch.nn.Module): def __init__(self, in_channels, out_chan...
MaskedMSE
# 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 MaskedMSE(nn.Module): def __init__(self): super(MaskedMSE, self).__init__() self.criterion = nn.MSELoss() def forward(self, input, target, gamma=2.0): mask = gamma * target / (target + 1e-07) self.loss = self.criterion(input * mask, ta...
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...
dhruvramani/AccentTransfer
MaskedMSE
false
1,832
[ "MIT" ]
0
63a35b4aa37bc41c1f66dfb4bae76e2924183d7c
https://github.com/dhruvramani/AccentTransfer/tree/63a35b4aa37bc41c1f66dfb4bae76e2924183d7c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.criterion = nn.MSELoss() def forward(self, input, target, gamma=2.0): mask = gamma * target / (target + 1e-07) self.loss = self.criterion(input * mask, target * mask) ...
adaILN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.parameter import Parameter class adaILN(nn.Module): def __init__(self, num_features, eps=1e-05): super(adaILN, self).__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.rho.data.fill_(0.9) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
denny3388/Conditional-UGATIT
adaILN
false
1,833
[ "MIT" ]
0
86ad35f05aaa105a814dec031d37370f44b71d5b
https://github.com/denny3388/Conditional-UGATIT/tree/86ad35f05aaa105a814dec031d37370f44b71d5b
import torch import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_features, eps=1e-05): super().__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.rho.data.fill_(0.9) def forward(se...
MaskedTemporalPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data from typing import Optional import torch.nn class MaskedTemporalPooling(torch.nn.Module): """ Applies temporal pooling operations on masked inputs. For each pooling operation all masked values are ignored. """ def __init__(self, method: 'str'): """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data import torch.nn assert_size_stride = torch._C._dynamo.guards.asse...
denred0/pytorchvideo
MaskedTemporalPooling
false
1,834
[ "Apache-2.0" ]
0
d874bfc9969895d2afcedea2e12bae5e1bcfb809
https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809
import torch import torch.utils.data from typing import Optional import torch.nn class Model(torch.nn.Module): """ Applies temporal pooling operations on masked inputs. For each pooling operation all masked values are ignored. """ def __init__(self, method: 'str'): """ method (str...
TemporalConvNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.utils import weight_norm class Chomp1d(nn.Module): def __init__(self, chomp_size): super(Chomp1d, self).__init__() self.chomp_size = chomp_size def forward(self, x, pad_right=True): return x[:, :, :-self.chomp_size].contiguous() if pad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
ddcas/singing-language-identification
TemporalConvNet
false
1,835
[ "MIT" ]
0
d104419b196d56d4de37cff47c32e88e28c58690
https://github.com/ddcas/singing-language-identification/tree/d104419b196d56d4de37cff47c32e88e28c58690
import torch import torch.nn as nn from torch.nn.utils import weight_norm class Chomp1d(nn.Module): def __init__(self, chomp_size): super().__init__() self.chomp_size = chomp_size def forward(self, x, pad_right=True): return x[:, :, :-self.chomp_size].contiguous() if pad_right else x...
NaiveTorchNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.autograd import Variable import torch.nn as nn import torch.autograd import torch.optim as optim class NaiveTorchNet(nn.Module): """A reimplementation of from-scratch NaiveNet using PyTorch""" def __init__(self, input_nodes, hidden_nodes, output_nodes, learn_rate=0.1 ): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.autograd import Variable import torch.nn as nn import torch.autograd ...
deo1/deo1
NaiveTorchNet
false
1,836
[ "MIT" ]
0
36671f12269d3bd662d746e8b9f66c22255c9df7
https://github.com/deo1/deo1/tree/36671f12269d3bd662d746e8b9f66c22255c9df7
import torch from torch.autograd import Variable import torch.nn as nn import torch.autograd import torch.optim as optim class Model(nn.Module): """A reimplementation of from-scratch NaiveNet using PyTorch""" def __init__(self, input_nodes, hidden_nodes, output_nodes, learn_rate=0.1 ): super(...
Attn
# 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 Attn(nn.Module): def __init__(self, hidden_size, batch_size=1, method='dot'): super(Attn, self).__init__() self.method = method self.hidden_size = hidden_size self.batch_size = batch_size if self.meth...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
dhpollack/mgc
Attn
false
1,837
[ "MIT" ]
0
ed1b8fb512f0b42cb8121a2809def65f232dc154
https://github.com/dhpollack/mgc/tree/ed1b8fb512f0b42cb8121a2809def65f232dc154
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_size, batch_size=1, method='dot'): super().__init__() self.method = method self.hidden_size = hidden_size self.batch_size = batch_size if self.method == 'ge...
PositiveLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PositiveLinear(nn.Linear): """Applies a transformation to the incoming data of the following form: :math:`y_i = xlog(exp(A)+1)^T` where log and exp are elementwise operations. Args: in_features: size of each inpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
dfioravanti/copula_vae
PositiveLinear
false
1,838
[ "MIT" ]
0
4fdadfb9ca65a75367d50df4a5848942de20741f
https://github.com/dfioravanti/copula_vae/tree/4fdadfb9ca65a75367d50df4a5848942de20741f
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Linear): """Applies a transformation to the incoming data of the following form: :math:`y_i = xlog(exp(A)+1)^T` where log and exp are elementwise operations. Args: in_features: size of each input sample ...
PrimaryCaps
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class PrimaryCaps(nn.Module): """ 输入:(B,C,H,W)=(B,256,20,20) 输出:(B,C_N,C_L)=(B,32*6*6, 8)=(B,1152,8) C_N:capsule_num,胶囊的个数 C_L:capsule_length,每个胶囊的长度 """ def __init__(self, capsule_length=8, in_channels=256, out_channels=32, capsu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
daxiongpro/pytorch-tutorial
PrimaryCaps
false
1,839
[ "MIT" ]
0
abafc32f7ee1092024085f703e4ced51ce358a1b
https://github.com/daxiongpro/pytorch-tutorial/tree/abafc32f7ee1092024085f703e4ced51ce358a1b
import torch import torch.nn as nn class Model(nn.Module): """ 输入:(B,C,H,W)=(B,256,20,20) 输出:(B,C_N,C_L)=(B,32*6*6, 8)=(B,1152,8) C_N:capsule_num,胶囊的个数 C_L:capsule_length,每个胶囊的长度 """ def __init__(self, capsule_length=8, in_channels=256, out_channels=32, capsule_num...
LearnMaskedDefault
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn class LearnMaskedDefault(nn.Module): """ Learns default values to fill invalid entries within input tensors. The invalid entries are represented by a mask which is passed into forward alongside the input tensor. Note the defaul...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch.nn assert_size_stride = torch....
denred0/pytorchvideo
LearnMaskedDefault
false
1,840
[ "Apache-2.0" ]
0
d874bfc9969895d2afcedea2e12bae5e1bcfb809
https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809
import torch import torch.nn as nn import torch.utils.data import torch.nn class Model(nn.Module): """ Learns default values to fill invalid entries within input tensors. The invalid entries are represented by a mask which is passed into forward alongside the input tensor. Note the default value is on...
SynthWide
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SynthWide(nn.Module): def __init__(self, num_c=10, f=1): super(SynthWide, self).__init__() self.pool = nn.MaxPool2d(2, 2) self.conv1 = nn.Conv2d(3, 32 * f, 3, padding=1) self.conv2 = nn.Conv2d(32 * f, 64 * f,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
dengliming/iotnets
SynthWide
false
1,842
[ "MIT" ]
0
db744e56769c799dbf765a27fc5aa91e3edeaaa3
https://github.com/dengliming/iotnets/tree/db744e56769c799dbf765a27fc5aa91e3edeaaa3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_c=10, f=1): super().__init__() self.pool = nn.MaxPool2d(2, 2) self.conv1 = nn.Conv2d(3, 32 * f, 3, padding=1) self.conv2 = nn.Conv2d(32 * f, 64 * f, 3, padding=1) ...
TCN_SLID
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.utils import weight_norm class Chomp1d(nn.Module): def __init__(self, chomp_size): super(Chomp1d, self).__init__() self.chomp_size = chomp_size def forward(self, x, pad_right=True): return x[:, :, :-self.chomp_size].contiguous() if pad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ddcas/singing-language-identification
TCN_SLID
false
1,843
[ "MIT" ]
0
d104419b196d56d4de37cff47c32e88e28c58690
https://github.com/ddcas/singing-language-identification/tree/d104419b196d56d4de37cff47c32e88e28c58690
import torch import torch.nn as nn from torch.nn.utils import weight_norm class Chomp1d(nn.Module): def __init__(self, chomp_size): super().__init__() self.chomp_size = chomp_size def forward(self, x, pad_right=True): return x[:, :, :-self.chomp_size].contiguous() if pad_right else x...
HearthstoneNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class HearthstoneNet(nn.Module): def __init__(self): super(HearthstoneNet, self).__init__() self.conv1 = nn.Conv2d(1, 64, kernel_size=(3, 3), padding=1) self.conv2 = nn.Conv2d(64, 64, kernel_size=(3, 3), padding=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
dianarvp/stone_ground_hearth_battles
HearthstoneNet
false
1,844
[ "Apache-2.0" ]
0
450e70eaef21b543be579a6d696676fb148a99b0
https://github.com/dianarvp/stone_ground_hearth_battles/tree/450e70eaef21b543be579a6d696676fb148a99b0
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 64, kernel_size=(3, 3), padding=1) self.conv2 = nn.Conv2d(64, 64, kernel_size=(3, 3), padding=1) self.max_pool = nn.MaxPool2d(...
AttnBertPooler
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 from torch import nn class AttnBertPooler(nn.Module): def __init__(self, config): super(AttnBertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size * 2, config.hidden_size * 2) self.activation = nn.Tanh(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
AnonymousAuthor2013/PostRec
AttnBertPooler
false
1,845
[ "MIT" ]
0
a1461f716d177e28b96ca29d1398f96b5717c1e1
https://github.com/AnonymousAuthor2013/PostRec/tree/a1461f716d177e28b96ca29d1398f96b5717c1e1
from _paritybench_helpers import _mock_config import math import torch from torch import nn class Model(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size * 2, config.hidden_size * 2) self.activation = nn.Tanh() self.hidden_size = ...
TestNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ScaleLayer(nn.Module): def __init__(self, init_value=0.001): super().__init__() self.scale = nn.Parameter(torch.FloatTensor([init_value])) def forward(self, input): return input * self.scale class TestNet(nn.Module): def __init__(self):...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
dizzyvn/torch-tcav
TestNet
false
1,846
[ "Apache-2.0" ]
0
c9795e817d1104923ef7422f5575607e6b835abc
https://github.com/dizzyvn/torch-tcav/tree/c9795e817d1104923ef7422f5575607e6b835abc
import torch import torch.nn as nn class ScaleLayer(nn.Module): def __init__(self, init_value=0.001): super().__init__() self.scale = nn.Parameter(torch.FloatTensor([init_value])) def forward(self, input): return input * self.scale class Model(nn.Module): def __init__(self): ...
BertPooler
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class BertPooler(nn.Module): def __init__(self, config): super(BertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Andr3wis2Cool4School/AI-pro
BertPooler
false
1,847
[ "MIT" ]
0
dfe5f5959bc187d899a86f13b84158c66f64d1cc
https://github.com/Andr3wis2Cool4School/AI-pro/tree/dfe5f5959bc187d899a86f13b84158c66f64d1cc
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Model(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states): ...
BatchNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import tensor import torch.nn as nn import numpy.random as rng class BaseFlow(nn.Module): """ """ def __init__(self, n_inputs, **kwargs): super(BaseFlow, self).__init__() self.n_inputs = n_inputs def forward(self, x, **kwargs): raise Not...
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 numpy as np from torch import tensor import torch.nn as...
dlvp/madminer
BatchNorm
false
1,848
[ "MIT" ]
0
4ae7d9b73452848a6c9d1b81b50ef316ff7a054f
https://github.com/dlvp/madminer/tree/4ae7d9b73452848a6c9d1b81b50ef316ff7a054f
import torch import numpy as np from torch import tensor import torch.nn as nn import numpy.random as rng class BaseFlow(nn.Module): """ """ def __init__(self, n_inputs, **kwargs): super().__init__() self.n_inputs = n_inputs def forward(self, x, **kwargs): raise NotImplementedErr...
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...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, num_inputs, args): super(Critic, self).__init__() self.fc1 = nn.Linear(num_inputs, args.hidden_size) self.fc2 = nn.Linear(args.hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
dlrudco/pg_travel
Critic
false
1,849
[ "MIT" ]
0
33733b624894095096af8201f7597c3244d3480d
https://github.com/dlrudco/pg_travel/tree/33733b624894095096af8201f7597c3244d3480d
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_inputs, args): super().__init__() self.fc1 = nn.Linear(num_inputs, args.hidden_size) self.fc2 = nn.Linear(args.hidden_size, args....
MetapathAggrLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MetapathAggrLayer(nn.Module): """ metapath attention layer. """ def __init__(self, in_features, nmeta, dropout, alpha): super(MetapathAggrLayer, self).__init__() self.dropout = dropout self.in_feature...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
dingdanhao110/HINGCN
MetapathAggrLayer
false
1,850
[ "MIT" ]
0
281b73c03bd3b00e35bce4c5e1c27076233555e4
https://github.com/dingdanhao110/HINGCN/tree/281b73c03bd3b00e35bce4c5e1c27076233555e4
import torch from torch.nn import functional as F from torch import nn class Model(nn.Module): """ metapath attention layer. """ def __init__(self, in_features, nmeta, dropout, alpha): super().__init__() self.dropout = dropout self.in_features = in_features self.alpha ...
SoftDiceLossSquared
# 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._C import torch.serialization class SoftDiceLossSquared(nn.Module): def __init__(self, apply_nonlin=None, batch_dice=False, do_bg=True, smooth=1.0): """ squares the terms in the denominator as proposed by Milletari et al. """ ...
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._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
dkswxd/Swin-Transformer-Semantic-Segmentation
SoftDiceLossSquared
false
1,851
[ "Apache-2.0" ]
0
6af19736e5492a01d8952d4ee86a6d59b21c2ae1
https://github.com/dkswxd/Swin-Transformer-Semantic-Segmentation/tree/6af19736e5492a01d8952d4ee86a6d59b21c2ae1
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): def __init__(self, apply_nonlin=None, batch_dice=False, do_bg=True, smooth=1.0): """ squares the terms in the denominator as proposed by Milletari et al. """ super().__ini...