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
LocationLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(LinearNorm, self).__init__() self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) torch.nn.init.xavier_uniform_(self.linear_layer.wei...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
BenAAndrew/tacotron2-model
LocationLayer
false
16,975
[ "BSD-3-Clause" ]
4
cd2aaf605f94e97225319fbf876e4213ae517b40
https://github.com/BenAAndrew/tacotron2-model/tree/cd2aaf605f94e97225319fbf876e4213ae517b40
import torch from torch import nn class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super().__init__() self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) torch.nn.init.xavier_uniform_(self.linear_layer.weight, gain=torch....
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """Calculates attention over the input nodes given the current state.""" def __init__(self, encoder_hidden_size, decoder_hidden_size): super(Attention, self).__init__() self.v = nn.Parameter(torch.z...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Bachery/Shape-driven-Coordinate-Ordering
Attention
false
16,976
[ "MIT" ]
6
6afa933a882cbe7a40ddf1de169537eccfe415b7
https://github.com/Bachery/Shape-driven-Coordinate-Ordering/tree/6afa933a882cbe7a40ddf1de169537eccfe415b7
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Calculates attention over the input nodes given the current state.""" def __init__(self, encoder_hidden_size, decoder_hidden_size): super().__init__() self.v = nn.Parameter(torch.zeros((1, 1, decoder...
ImgPatchConverter
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch as t class ImgPatchConverter(nn.Module): def __init__(self): super(ImgPatchConverter, self).__init__() def forward(self, x): x = t.flatten(x, start_dim=2) x = t.transpose(x, 1, 2).contiguous() return x def get_inputs(): ret...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Asichurter/MalFusionFSL
ImgPatchConverter
false
16,977
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn import torch as t class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): x = t.flatten(x, start_dim=2) x = t.transpose(x, 1, 2).contiguous() return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] de...
AddFusion
# 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 AddFusion(nn.Module): def __init__(self): super(AddFusion, self).__init__() def forward(self, seq_features, img_features, **kwargs): return seq_features + img_features def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Asichurter/MalFusionFSL
AddFusion
false
16,978
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, seq_features, img_features, **kwargs): return seq_features + img_features def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inpu...
CatFusion
# 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 CatFusion(nn.Module): def __init__(self): super(CatFusion, self).__init__() def forward(self, seq_features, img_features, fuse_dim=1, **kwargs): return torch.cat((seq_features, img_features), dim=fuse_dim) def get_inputs(): return [torch.rand([4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Asichurter/MalFusionFSL
CatFusion
false
16,979
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, seq_features, img_features, fuse_dim=1, **kwargs): return torch.cat((seq_features, img_features), dim=fuse_dim) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.r...
LocalDiscrepancy
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils import torch.distributed class LocalDiscrepancy(nn.Module): def __init__(self, in_channels=19, padding_mode='replicate', neighbor=8, l_type='l1'): """ depth-wise conv to calculate the mean of neighbor ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
BIT-DA/RIPU
LocalDiscrepancy
false
16,980
[ "MIT" ]
9
125edf112c9ded1e7497aedb2a092331824df100
https://github.com/BIT-DA/RIPU/tree/125edf112c9ded1e7497aedb2a092331824df100
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils import torch.distributed class Model(nn.Module): def __init__(self, in_channels=19, padding_mode='replicate', neighbor=8, l_type='l1'): """ depth-wise conv to calculate the mean of neighbor """ ...
SigmoidFocalClassificationLoss
# 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 _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class SigmoidFocalClassificationLoss(nn.Module): """Sigmoid focal cross entrop...
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...
Benedict0819/pointrcnn_multiclass
SigmoidFocalClassificationLoss
false
16,981
[ "MIT" ]
4
61781815920c0a5d44486ed25cf5bed805eb6b89
https://github.com/Benedict0819/pointrcnn_multiclass/tree/61781815920c0a5d44486ed25cf5bed805eb6b89
import torch import torch.nn as nn def _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class Model(nn.Module): """Sigmoid focal cross entropy loss. Focal loss ...
NormalDiagonalCovarianceLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import abc import math import torch class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta): """Probabilistic layer to be used by the encoder/decoder of a Variational AutoEncoder. """ @abc.abstractmethod def forward(self, inputs): """Compute the parameters of the distribution co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
BUTSpeechFIT/beer
NormalDiagonalCovarianceLayer
false
16,982
[ "MIT" ]
6
43fb9027a859db28d2f2f8709260ca2ce9501e25
https://github.com/BUTSpeechFIT/beer/tree/43fb9027a859db28d2f2f8709260ca2ce9501e25
import abc import math import torch class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta): """Probabilistic layer to be used by the encoder/decoder of a Variational AutoEncoder. """ @abc.abstractmethod def forward(self, inputs): """Compute the parameters of the distribution co...
criticAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 criticAttention(nn.Module): """Calculates attention over the input nodes given the current state.""" def __init__(self, hidden_size): super(criticAttention, self).__init__() self.v = nn.Parameter(torch.zeros((1, 1, hidden_size), requires_gr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Bachery/Shape-driven-Coordinate-Ordering
criticAttention
false
16,983
[ "MIT" ]
6
6afa933a882cbe7a40ddf1de169537eccfe415b7
https://github.com/Bachery/Shape-driven-Coordinate-Ordering/tree/6afa933a882cbe7a40ddf1de169537eccfe415b7
import torch import torch.nn as nn class Model(nn.Module): """Calculates attention over the input nodes given the current state.""" def __init__(self, hidden_size): super().__init__() self.v = nn.Parameter(torch.zeros((1, 1, hidden_size), requires_grad=True)) self.W = nn.P...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Benedict0819/pointrcnn_multiclass
DiceLoss
false
16,984
[ "MIT" ]
4
61781815920c0a5d44486ed25cf5bed805eb6b89
https://github.com/Benedict0819/pointrcnn_multiclass/tree/61781815920c0a5d44486ed25cf5bed805eb6b89
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :return: ""...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class LayerNorm(nn.LayerNorm): """Subclass torch's LayerNorm to handle fp16.""" def forward(self, x: 'torch.Tensor'): orig_type = x.dtype ret = super().forward(x.type(torch.float32)) return ret.type(orig_type) def get_inputs(): return [torch.ran...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Beximus/ResearchPortfolioCode
LayerNorm
false
16,985
[ "MIT" ]
6
db8343be6bbac361c3f6d01bbb82e458ff40f44e
https://github.com/Beximus/ResearchPortfolioCode/tree/db8343be6bbac361c3f6d01bbb82e458ff40f44e
import torch from torch import nn class Model(nn.LayerNorm): """Subclass torch's LayerNorm to handle fp16.""" def forward(self, x: 'torch.Tensor'): orig_type = x.dtype ret = super().forward(x.type(torch.float32)) return ret.type(orig_type) def get_inputs(): return [torch.rand([4...
TransitionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 TransitionLayer(nn.Module): """ TransitionLayer between dense blocks """ def __init__(self, n_in, n_out, use_dropout=False): """ Args: n_in (int) : number of input channels n_out (int) : numbe...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
BingoH/ReinventingWheel
TransitionLayer
false
16,986
[ "MIT" ]
4
5232d0ab697ad57a039c766355545bbde3b2a200
https://github.com/BingoH/ReinventingWheel/tree/5232d0ab697ad57a039c766355545bbde3b2a200
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ TransitionLayer between dense blocks """ def __init__(self, n_in, n_out, use_dropout=False): """ Args: n_in (int) : number of input channels n_out (int) : number of outpu...
QuickGELU
# 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 QuickGELU(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Beximus/ResearchPortfolioCode
QuickGELU
false
16,987
[ "MIT" ]
6
db8343be6bbac361c3f6d01bbb82e458ff40f44e
https://github.com/Beximus/ResearchPortfolioCode/tree/db8343be6bbac361c3f6d01bbb82e458ff40f44e
import torch from torch import nn class Model(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from time import * class FocalLoss(nn.Module): def __init__(self, gamma=2, eps=1e-07): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.ce = nn.CrossEntropyLoss() def forward(self, input, target): logp = self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
BillKerman/FaceNetCustomized
FocalLoss
false
16,988
[ "MIT" ]
4
30bb99b62f960034c4aa4206d7dc22de672a997f
https://github.com/BillKerman/FaceNetCustomized/tree/30bb99b62f960034c4aa4206d7dc22de672a997f
import torch import torch.nn as nn from time import * class Model(nn.Module): def __init__(self, gamma=2, eps=1e-07): super().__init__() self.gamma = gamma self.eps = eps self.ce = nn.CrossEntropyLoss() def forward(self, input, target): logp = self.ce(input, target) ...
BiliAttnReduction
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 as t from torch.nn import functional as F def getMaskFromLens(lens, max_seq_len=200, expand_feature_dim=None): if type(lens) == list: lens = t.LongTensor(lens) batch_size = len(lens) idx_matrix = t.arange(0, max_seq_len, 1).repeat((batch_size, 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....
Asichurter/MalFusionFSL
BiliAttnReduction
false
16,989
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn import torch as t from torch.nn import functional as F def getMaskFromLens(lens, max_seq_len=200, expand_feature_dim=None): if type(lens) == list: lens = t.LongTensor(lens) batch_size = len(lens) idx_matrix = t.arange(0, max_seq_len, 1).repeat((batch_size, 1)) ...
BahdanauAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class BahdanauAttention(nn.Module): """ Class performs Additive Bahdanau Attention. Source: https://arxiv.org/pdf/1409.0473.pdf """ def __init__(self, num_features, hidden_dim, output_dim=1): super(BahdanauAttention, self).__...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
BhushanMahajan25/image-captioning
BahdanauAttention
false
16,990
[ "MIT" ]
5
c3e1db358267fbb1b8abe723542f7fd8c6b0c966
https://github.com/BhushanMahajan25/image-captioning/tree/c3e1db358267fbb1b8abe723542f7fd8c6b0c966
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Class performs Additive Bahdanau Attention. Source: https://arxiv.org/pdf/1409.0473.pdf """ def __init__(self, num_features, hidden_dim, output_dim=1): super().__init__() self.num_features ...
RSoftmax
# 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 RSoftmax(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input. """ def __init__(self, radix, groups): super().__init__() ...
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 ...
Bin-ze/Food_detection
RSoftmax
false
16,991
[ "Apache-2.0" ]
4
1c1a067f12644f2b0289e49aec4637d580722f70
https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input. """ def __init__(self, radix, groups): super().__init__() ...
TransformerSet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class TransformerSet(nn.Module): def __init__(self, input_size, dropout=0.5, trans_head_nums=1, **kwargs): super(TransformerSet, self).__init__() self.Transformer = nn.MultiheadAttention(embed_dim=input_size, num_heads=trans_head_nums, dropout=dropout...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Asichurter/MalFusionFSL
TransformerSet
false
16,992
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn class Model(nn.Module): def __init__(self, input_size, dropout=0.5, trans_head_nums=1, **kwargs): super().__init__() self.Transformer = nn.MultiheadAttention(embed_dim=input_size, num_heads=trans_head_nums, dropout=dropout) self.fc = nn.Linear...
SeqAttendImgAttOnlyFusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class SeqAttendImgFusion(nn.Module): def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout, att_scale_factor=1, **kwargs): super(SeqAttendImgFusion, self).__init__() self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False) self.ImgTrans =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Asichurter/MalFusionFSL
SeqAttendImgAttOnlyFusion
false
16,993
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn class SeqAttendImgFusion(nn.Module): def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout, att_scale_factor=1, **kwargs): super().__init__() self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False) self.ImgTrans = nn.Linear(img_dim, hidd...
MSE_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 from torch.nn import functional as F class MSE_Loss(nn.Module): def __init__(self): super(MSE_Loss, self).__init__() def forward(self, input, target): return F.mse_loss(input, target, reduction='mean') def get_inputs(): return [torch.rand([4, 4, 4, 4]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
BennyZhang-Codes/LDCT-denoising-with-DL-Methods-and-Dicom-Viewer-by-Benny
MSE_Loss
false
16,994
[ "MIT" ]
7
07e3dc1e3c6dcdea314b2a9e3cf9ac1036cf5eb6
https://github.com/BennyZhang-Codes/LDCT-denoising-with-DL-Methods-and-Dicom-Viewer-by-Benny/tree/07e3dc1e3c6dcdea314b2a9e3cf9ac1036cf5eb6
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input, target): return F.mse_loss(input, target, reduction='mean') def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4,...
SeqAttendImgCatFusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class SeqAttendImgFusion(nn.Module): def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout, att_scale_factor=1, **kwargs): super(SeqAttendImgFusion, self).__init__() self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False) self.ImgTrans =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Asichurter/MalFusionFSL
SeqAttendImgCatFusion
false
16,995
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn class SeqAttendImgFusion(nn.Module): def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout, att_scale_factor=1, **kwargs): super().__init__() self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False) self.ImgTrans = nn.Linear(img_dim, hidd...
SeqAttendImgResAttOnlyFusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class SeqAttendImgFusion(nn.Module): def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout, att_scale_factor=1, **kwargs): super(SeqAttendImgFusion, self).__init__() self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False) self.ImgTrans =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Asichurter/MalFusionFSL
SeqAttendImgResAttOnlyFusion
false
16,996
[ "MIT" ]
4
713bf64cc07a3489f42941fd2299837075575ac0
https://github.com/Asichurter/MalFusionFSL/tree/713bf64cc07a3489f42941fd2299837075575ac0
import torch from torch import nn class SeqAttendImgFusion(nn.Module): def __init__(self, seq_dim, img_dim, hidden_dim, att_dropout, att_scale_factor=1, **kwargs): super().__init__() self.SeqTrans = nn.Linear(seq_dim, hidden_dim, bias=False) self.ImgTrans = nn.Linear(img_dim, hidd...
Conv1d2Score
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.utils.data class Conv1d2Score(nn.Module): """Calculate a N*out_dim tensor from N*in_dim*seq_len using nn.Conv1d Essentially it is a linear layer Args: in_dim: int out_dim: int, usually number of classes seq_len: int 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 import torch.nn as nn import torch.optim import torch.utils.data assert_size_str...
BeautyOfWeb/DeepBio
Conv1d2Score
false
16,997
[ "MIT" ]
5
9207357bd3591f67d8e23c7dad217938dcc123ed
https://github.com/BeautyOfWeb/DeepBio/tree/9207357bd3591f67d8e23c7dad217938dcc123ed
import torch import torch.nn as nn import torch.optim import torch.utils.data class Model(nn.Module): """Calculate a N*out_dim tensor from N*in_dim*seq_len using nn.Conv1d Essentially it is a linear layer Args: in_dim: int out_dim: int, usually number of classes seq_len: int Shape: -...
AttentionPool2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 AttentionPool2d(nn.Module): def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads: 'int', output_dim: 'int'=None): super().__init__() self.positional_embedding = nn.Parameter(torch.randn(spacial_dim ** ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Beximus/ResearchPortfolioCode
AttentionPool2d
false
16,998
[ "MIT" ]
6
db8343be6bbac361c3f6d01bbb82e458ff40f44e
https://github.com/Beximus/ResearchPortfolioCode/tree/db8343be6bbac361c3f6d01bbb82e458ff40f44e
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads: 'int', output_dim: 'int'=None): super().__init__() self.positional_embedding = nn.Parameter(torch.randn(spacial_dim ** ...
CNN_MNIST
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CNN_MNIST(nn.Module): def __init__(self, num_channels, num_classes): super(CNN_MNIST, self).__init__() self.conv1 = nn.Conv2d(num_channels, 32, 3, stride=1, padding=0) self.conv2 = nn.Conv2d(32, 64, 3, stride=1, padd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Billy1900/Noise-Adaption-Layer
CNN_MNIST
false
16,999
[ "MIT" ]
5
57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8
https://github.com/Billy1900/Noise-Adaption-Layer/tree/57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_channels, num_classes): super().__init__() self.conv1 = nn.Conv2d(num_channels, 32, 3, stride=1, padding=0) self.conv2 = nn.Conv2d(32, 64, 3, stride=1, padding=0) self...
CNN_CIFAR10
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CNN_CIFAR10(nn.Module): def __init__(self, num_channels, num_classes): super(CNN_CIFAR10, self).__init__() self.conv1 = nn.Conv2d(num_channels, 32, 3, stride=1, padding=0) self.conv2 = nn.Conv2d(32, 64, 3, stride=1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Billy1900/Noise-Adaption-Layer
CNN_CIFAR10
false
17,000
[ "MIT" ]
5
57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8
https://github.com/Billy1900/Noise-Adaption-Layer/tree/57b52dc4873f8eba7b8332db0ca3e593c2e3ffa8
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_channels, num_classes): super().__init__() self.conv1 = nn.Conv2d(num_channels, 32, 3, stride=1, padding=0) self.conv2 = nn.Conv2d(32, 64, 3, stride=1, padding=0) self...
Triangle_transform
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Triangle_transform(nn.Module): def __init__(self, output_dim): """ output dim is the number of t parameters in the triangle point transformation """ super().__init__() self.output_dim = output_dim self.t_param = torch.nn.Par...
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 ...
BorgwardtLab/TOGL
Triangle_transform
false
17,001
[ "BSD-3-Clause" ]
6
d0c986cf829ca6bbae1a23e5cdab1c99146503cd
https://github.com/BorgwardtLab/TOGL/tree/d0c986cf829ca6bbae1a23e5cdab1c99146503cd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, output_dim): """ output dim is the number of t parameters in the triangle point transformation """ super().__init__() self.output_dim = output_dim self.t_param = torch.nn.Parameter(torch....
Replicate_unit1d
# 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 Replicate_unit1d(torch.nn.Module): def __init__(self, width, height): super(Replicate_unit1d, self).__init__() self.width = width self.height = height def forward(self, x): assert len(x.size()) == 2 batch_num = x.size()[0] tmp = torch.cat([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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
BlackParure/AI-StarCraft-II
Replicate_unit1d
false
17,002
[ "Apache-2.0" ]
7
7feee4addff9881b3c735791f4a43421f813fcfc
https://github.com/BlackParure/AI-StarCraft-II/tree/7feee4addff9881b3c735791f4a43421f813fcfc
import torch class Model(torch.nn.Module): def __init__(self, width, height): super().__init__() self.width = width self.height = height def forward(self, x): assert len(x.size()) == 2 batch_num = x.size()[0] tmp = torch.cat([x.view((batch_num, -1, 1)) for _ i...
SEModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import torch.nn as nn from torch.nn import Conv2d from torch.nn import ReLU from torch.nn import Sigmoid from torch.nn import AdaptiveAvgPool2d from time import * class SEModule(Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
BillKerman/FaceNetCustomized
SEModule
false
17,003
[ "MIT" ]
4
30bb99b62f960034c4aa4206d7dc22de672a997f
https://github.com/BillKerman/FaceNetCustomized/tree/30bb99b62f960034c4aa4206d7dc22de672a997f
from torch.nn import Module import torch import torch.nn as nn from torch.nn import Conv2d from torch.nn import ReLU from torch.nn import Sigmoid from torch.nn import AdaptiveAvgPool2d from time import * class Model(Module): def __init__(self, channels, reduction): super().__init__() self.avg_poo...
NormedLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class NormedLinear(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Bin-ze/Food_detection
NormedLinear
false
17,004
[ "Apache-2.0" ]
4
1c1a067f12644f2b0289e49aec4637d580722f70
https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of div...
Chebyshev_GL
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import Module from torch.nn.parameter import Parameter class Chebyshev_GL(Module): """ GCN k-hop Layers x' = Sigma^k-1 (Z^k * w0^k), Z^k= polynomial """ def __init__(self, in_features, out_features, k_hop, bias=True): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 import Module from...
Brain03Yao/M2TGCN
Chebyshev_GL
false
17,005
[ "MIT" ]
6
72c65687fa52c618740cd6d1db7366116f68398c
https://github.com/Brain03Yao/M2TGCN/tree/72c65687fa52c618740cd6d1db7366116f68398c
from torch.nn import Module import math import torch from torch.nn.modules import Module from torch.nn.parameter import Parameter class Model(Module): """ GCN k-hop Layers x' = Sigma^k-1 (Z^k * w0^k), Z^k= polynomial """ def __init__(self, in_features, out_features, k_hop, bias=True): sup...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from math import sqrt as sqrt from itertools import product as product import torch.nn.init as init class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch._utils from math import sqrt as sqrt from it...
BingzheWu/ssd-pytorch
L2Norm
false
17,006
[ "MIT" ]
7
bc3f1f5473170082e3b01adb1f4e5d4fb7e0077e
https://github.com/BingzheWu/ssd-pytorch/tree/bc3f1f5473170082e3b01adb1f4e5d4fb7e0077e
import torch import torch.nn as nn import torch._utils from math import sqrt as sqrt from itertools import product as product import torch.nn.init as init class Model(nn.Module): def __init__(self, n_channels, scale): super().__init__() self.n_channels = n_channels self.gamma = scale or N...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 L2Norm(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): """L2 normalization layer. Args: n_dims (int): Number of dimensions to be normalized scale (float, optional): Defaults to 20.. eps (float, optional):...
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_...
Bin-ze/Food_detection
L2Norm
false
17,007
[ "Apache-2.0" ]
4
1c1a067f12644f2b0289e49aec4637d580722f70
https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): """L2 normalization layer. Args: n_dims (int): Number of dimensions to be normalized scale (float, optional): Defaults to 20.. eps (float, optional): ...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch from torch.nn.modules import Module import torch.nn.functional as F from torch.nn.parameter import Parameter class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Z = f(X, A) = softmax(A` * ReLU(A` * X * W0)* ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 i...
Brain03Yao/M2TGCN
GCN
false
17,008
[ "MIT" ]
6
72c65687fa52c618740cd6d1db7366116f68398c
https://github.com/Brain03Yao/M2TGCN/tree/72c65687fa52c618740cd6d1db7366116f68398c
from torch.nn import Module import math import torch from torch.nn.modules import Module import torch.nn.functional as F from torch.nn.parameter import Parameter class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Z = f(X, A) = softmax(A` * ReLU(A` * X * W0)* ...
Gaussian_transform
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Gaussian_transform(nn.Module): def __init__(self, output_dim): """ output dim is the number of t parameters in the Gaussian point transformation """ super().__init__() self.output_dim = output_dim self.t_param = torch.nn.Par...
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...
BorgwardtLab/TOGL
Gaussian_transform
false
17,009
[ "BSD-3-Clause" ]
6
d0c986cf829ca6bbae1a23e5cdab1c99146503cd
https://github.com/BorgwardtLab/TOGL/tree/d0c986cf829ca6bbae1a23e5cdab1c99146503cd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, output_dim): """ output dim is the number of t parameters in the Gaussian point transformation """ super().__init__() self.output_dim = output_dim self.t_param = torch.nn.Parameter(torch....
NormedConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 NormedConv2d(nn.Conv2d): """Normalized Conv2d Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of divisor to keep...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Bin-ze/Food_detection
NormedConv2d
false
17,010
[ "Apache-2.0" ]
4
1c1a067f12644f2b0289e49aec4637d580722f70
https://github.com/Bin-ze/Food_detection/tree/1c1a067f12644f2b0289e49aec4637d580722f70
import torch import torch.nn as nn class Model(nn.Conv2d): """Normalized Conv2d Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of divisor to keep numeri...
DoubleConvRelu
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class DoubleConvRelu(nn.Module): def __init__(self, in_dec_filters: 'int', out_filters: 'int'): super().__init__() self.conv1 = nn.Conv2d(in_dec_filters, out_filters, kernel_size=3, padding=1, stride=1) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
BloodAxe/Catalyst-CamVid-Segmentation-Example
DoubleConvRelu
false
17,011
[ "MIT" ]
7
a24ed6301c2f2a97cbd4d5ba4ef2348d7ed1d9f3
https://github.com/BloodAxe/Catalyst-CamVid-Segmentation-Example/tree/a24ed6301c2f2a97cbd4d5ba4ef2348d7ed1d9f3
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_dec_filters: 'int', out_filters: 'int'): super().__init__() self.conv1 = nn.Conv2d(in_dec_filters, out_filters, kernel_size=3, padding=1, stride=1) self.conv2 =...
WeightedView
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.utils.data class WeightedView(nn.Module): """Calculate weighted view Args: num_groups: int, number of groups (views) reduce_dimension: bool, default False. If True, reduce dimension dim dim: default -1. Only used w...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.optim import torch.utils.data assert_s...
BeautyOfWeb/DeepBio
WeightedView
false
17,012
[ "MIT" ]
5
9207357bd3591f67d8e23c7dad217938dcc123ed
https://github.com/BeautyOfWeb/DeepBio/tree/9207357bd3591f67d8e23c7dad217938dcc123ed
import torch import torch.nn as nn import torch.optim import torch.utils.data class Model(nn.Module): """Calculate weighted view Args: num_groups: int, number of groups (views) reduce_dimension: bool, default False. If True, reduce dimension dim dim: default -1. Only used when red...
ContrastiveLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import torch.nn as nn from torch.nn.modules import Module class ContrastiveLoss(Module): def __init__(self, margin=3): super(ContrastiveLoss, self).__init__() self.margin = margin self.loss = nn.BCELoss() def forward(self, output, label): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module import torch.nn as nn from torch.nn.modules import Module ass...
Brain03Yao/M2TGCN
ContrastiveLoss
false
17,013
[ "MIT" ]
6
72c65687fa52c618740cd6d1db7366116f68398c
https://github.com/Brain03Yao/M2TGCN/tree/72c65687fa52c618740cd6d1db7366116f68398c
from torch.nn import Module import torch import torch.nn as nn from torch.nn.modules import Module class Model(Module): def __init__(self, margin=3): super().__init__() self.margin = margin self.loss = nn.BCELoss() def forward(self, output, label): label = label.view(label.si...
BCEFocalLoss
# 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 BCEFocalLoss(torch.nn.Module): """ 二分类的Focalloss alpha 固定 """ def __init__(self, gamma=2, alpha=0.25, reduction='elementwise_mean'): super().__init__() self.gamma = gamma self.alpha = alpha self.reduction = reduction def forward(self, _input, 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 from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
CCChenhao997/CCL2020-Humor-Computation
BCEFocalLoss
false
17,014
[ "MIT" ]
7
700e539588904da40a9db899668437188a6b4613
https://github.com/CCChenhao997/CCL2020-Humor-Computation/tree/700e539588904da40a9db899668437188a6b4613
import torch class Model(torch.nn.Module): """ 二分类的Focalloss alpha 固定 """ def __init__(self, gamma=2, alpha=0.25, reduction='elementwise_mean'): super().__init__() self.gamma = gamma self.alpha = alpha self.reduction = reduction def forward(self, _input, target): ...
ScaledDotProductAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.optim class Bottle(nn.Module): """ Perform the reshape routine before and after an operation """ def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) size = input.size()[:2] out = sup...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Blickwinkel1107/NJUNMT-pytorch
ScaledDotProductAttention
false
17,015
[ "MIT" ]
9
82f684fe768b137ca0649b7b79a1820077917385
https://github.com/Blickwinkel1107/NJUNMT-pytorch/tree/82f684fe768b137ca0649b7b79a1820077917385
import torch import torch.nn as nn import torch.optim class Bottle(nn.Module): """ Perform the reshape routine before and after an operation """ def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) size = input.size()[:2] out = sup...
WeightNormConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.weight_norm import weight_norm import torch.onnx class WeightNormConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros'): super(WeightNormConv2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AntixK/Neural-Blocks
WeightNormConv2d
false
17,016
[ "MIT" ]
3
018a44bbb703fc848234b95a3e604576bd9df88f
https://github.com/AntixK/Neural-Blocks/tree/018a44bbb703fc848234b95a3e604576bd9df88f
import torch import torch.nn as nn from torch.nn.utils.weight_norm import weight_norm import torch.onnx class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros'): super().__init__() self.c...
WeightNormLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.weight_norm import weight_norm import torch.onnx class WeightNormLinear(nn.Module): def __init__(self, in_features, out_features, bias=True): super(WeightNormLinear, self).__init__() self.lin = weight_norm(nn.Linear(in_features, out_features,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
AntixK/Neural-Blocks
WeightNormLinear
false
17,017
[ "MIT" ]
3
018a44bbb703fc848234b95a3e604576bd9df88f
https://github.com/AntixK/Neural-Blocks/tree/018a44bbb703fc848234b95a3e604576bd9df88f
import torch import torch.nn as nn from torch.nn.utils.weight_norm import weight_norm import torch.onnx class Model(nn.Module): def __init__(self, in_features, out_features, bias=True): super().__init__() self.lin = weight_norm(nn.Linear(in_features, out_features, bias)) def forward(self, in...
RegressionNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class RegressionNN(nn.Module): def __init__(self, feature_number): super(RegressionNN, self).__init__() self.feature_number = feature_number self.fc1 = nn.Linear(self.feature_number, 12) self.fc2 = nn.Linear(12, 8) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
BuildFL/BuildFL
RegressionNN
false
17,018
[ "MIT" ]
6
2b9fb786c9655b52d54b53e3efaf25e033a5b532
https://github.com/BuildFL/BuildFL/tree/2b9fb786c9655b52d54b53e3efaf25e033a5b532
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, feature_number): super().__init__() self.feature_number = feature_number self.fc1 = nn.Linear(self.feature_number, 12) self.fc2 = nn.Linear(12, 8) self.fc3 = nn.Linear(8, 1) ...
RationalHat_transform
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 RationalHat_transform(nn.Module): """ Coordinate function as defined in /Hofer, C., Kwitt, R., and Niethammer, M. Learning representations of persistence barcodes. JMLR, 20(126):1–45, 2019b./ """ def __init__(self, output_dim, input_dim=1): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
BorgwardtLab/TOGL
RationalHat_transform
false
17,019
[ "BSD-3-Clause" ]
6
d0c986cf829ca6bbae1a23e5cdab1c99146503cd
https://github.com/BorgwardtLab/TOGL/tree/d0c986cf829ca6bbae1a23e5cdab1c99146503cd
import torch import torch.nn as nn class Model(nn.Module): """ Coordinate function as defined in /Hofer, C., Kwitt, R., and Niethammer, M. Learning representations of persistence barcodes. JMLR, 20(126):1–45, 2019b./ """ def __init__(self, output_dim, input_dim=1): """ ...
GeneralizedMeanPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.modules import Module class GeneralizedMeanPooling(Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module ...
ByungHeeCha/visual_localization
GeneralizedMeanPooling
false
17,020
[ "BSD-3-Clause" ]
3
787fb8f6ee5c6e69ece9e83a016d15596e5524bc
https://github.com/ByungHeeCha/visual_localization/tree/787fb8f6ee5c6e69ece9e83a016d15596e5524bc
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.modules import Module class Model(Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - ...
KeypointRCNNPredictor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class KeypointRCNNPredictor(nn.Module): def __init__(self, in_channels, num_keypoints): super(KeypointRCNNPredictor, self).__init__() input_features = in_channels deconv_kernel = 4 self.kps_score_lowres = nn.ConvTranspose2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
BoChenYS/ROPE
KeypointRCNNPredictor
false
17,021
[ "BSD-3-Clause" ]
6
3e50f134259b555cf547e4a3ef8b14cf5cda4e00
https://github.com/BoChenYS/ROPE/tree/3e50f134259b555cf547e4a3ef8b14cf5cda4e00
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, in_channels, num_keypoints): super().__init__() input_features = in_channels deconv_kernel = 4 self.kps_score_lowres = nn.ConvTranspose2d(input_features, num_keypoints,...
GatedConnection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class GatedConnection(nn.Module): def __init__(self, d_model): super().__init__() self.w = nn.Linear(d_model * 2, d_model, True) def forward(self, t1, t2): g = F.sigmoid(self.w(torch.cat([t1, t2], -...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynamo.g...
Blickwinkel1107/NJUNMT-pytorch
GatedConnection
false
17,022
[ "MIT" ]
9
82f684fe768b137ca0649b7b79a1820077917385
https://github.com/Blickwinkel1107/NJUNMT-pytorch/tree/82f684fe768b137ca0649b7b79a1820077917385
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class Model(nn.Module): def __init__(self, d_model): super().__init__() self.w = nn.Linear(d_model * 2, d_model, True) def forward(self, t1, t2): g = F.sigmoid(self.w(torch.cat([t1, t2], -1))) ...
Pow
# 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 Pow(nn.Module): """ Applies `x ** sigmoid(a)`, with `a` fixed or trainable. """ def __init__(self, a=0, trainable=False): super(Pow, self).__init__() if trainable: a = nn.Parameter(torch.tensor(a, dtype=torch.get_default_dtype())) ...
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_...
CPJKU/kagglebirds2020
Pow
false
17,023
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import torch.nn as nn class Model(nn.Module): """ Applies `x ** sigmoid(a)`, with `a` fixed or trainable. """ def __init__(self, a=0, trainable=False): super().__init__() if trainable: a = nn.Parameter(torch.tensor(a, dtype=torch.get_default_dtype())) ...
TripletGCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import Module import torch.nn.functional as F from torch.nn.parameter import Parameter class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Z = f(X, A) = softmax(A` * ReLU(A` * X * W0)* ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Brain03Yao/M2TGCN
TripletGCN
false
17,024
[ "MIT" ]
6
72c65687fa52c618740cd6d1db7366116f68398c
https://github.com/Brain03Yao/M2TGCN/tree/72c65687fa52c618740cd6d1db7366116f68398c
from torch.nn import Module import math import torch from torch.nn.modules import Module import torch.nn.functional as F from torch.nn.parameter import Parameter class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Z = f(X, A) = softmax(A` * ReLU(A` * X * W0)* ...
FCDiscriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data import torch.distributed import torch.backends.cudnn import torch.utils import torch.backends class FCDiscriminator(nn.Module): def __init__(self, num_classes, ndf=64): super(FCDiscriminator, self).__init__() self.conv1 = nn.Conv2d(num_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 import nn import torch.utils.data import torch.distributed import tor...
BinhuiXie/SPCL
FCDiscriminator
false
17,025
[ "MIT" ]
6
9e5bab7b5d38fde847f9e8f85ca64498baaf86be
https://github.com/BinhuiXie/SPCL/tree/9e5bab7b5d38fde847f9e8f85ca64498baaf86be
import torch from torch import nn import torch.utils.data import torch.distributed import torch.backends.cudnn import torch.utils import torch.backends class Model(nn.Module): def __init__(self, num_classes, ndf=64): super().__init__() self.conv1 = nn.Conv2d(num_classes, ndf, kernel_size=4, strid...
GlobalAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def aeq(*args): base = args[0] for a in args[1:]: assert a == base, str(args) class Bottle(nn.Module): def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) size = input.size()[:2] ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
BurakaKrishna/Question-Generation
GlobalAttention
false
17,026
[ "MIT" ]
4
4614bf07243ab1b3df337fc1cb22175947c71a14
https://github.com/BurakaKrishna/Question-Generation/tree/4614bf07243ab1b3df337fc1cb22175947c71a14
import torch import torch.nn as nn def aeq(*args): base = args[0] for a in args[1:]: assert a == base, str(args) class Bottle(nn.Module): def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) size = input.size()[:2] ou...
TripletLogExpLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn import torch.nn.functional as F class TripletLogExpLoss(nn.Module): """Creates a criterion that measures the triplet loss given an input tensors x1, x2, x3. This is used for measuring a relative similarity between samples. A triplet is composed by `...
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 nn assert_size_stride = t...
ByungHeeCha/visual_localization
TripletLogExpLoss
false
17,027
[ "BSD-3-Clause" ]
3
787fb8f6ee5c6e69ece9e83a016d15596e5524bc
https://github.com/ByungHeeCha/visual_localization/tree/787fb8f6ee5c6e69ece9e83a016d15596e5524bc
import torch import numpy as np from torch import nn import torch.nn.functional as F class Model(nn.Module): """Creates a criterion that measures the triplet loss given an input tensors x1, x2, x3. This is used for measuring a relative similarity between samples. A triplet is composed by `a`, `p` and ...
GeneralizedMeanPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.autograd class GeneralizedMeanPooling(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At...
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...
CASIA-IVA-Lab/PASS_reID
GeneralizedMeanPooling
false
17,028
[ "Apache-2.0" ]
5
46dc6d25f4396e35ac1a766ad2dcaa580beccf15
https://github.com/CASIA-IVA-Lab/PASS_reID/tree/46dc6d25f4396e35ac1a766ad2dcaa580beccf15
import torch import torch.nn as nn import torch.nn.functional as F import torch.autograd class Model(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, on...
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 torch import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.1): super().__init__() self.w_1 = nn.Conv1d(d_in, d_hid, 1) self.w_2 = nn.Conv1d(d_hid, d_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....
CSLT-THU/Vivi_3.0
PositionwiseFeedForward
false
17,029
[ "Apache-2.0" ]
3
86996d99d662cd33100755501a971c41ce30ca70
https://github.com/CSLT-THU/Vivi_3.0/tree/86996d99d662cd33100755501a971c41ce30ca70
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.1): super().__init__() self.w_1 = nn.Conv1d(d_in, d_hid, 1) self.w_2 = nn.Conv1d(d_hid, d_in, 1) self.la...
SpatialLogMeanExp
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn def _lme(x, alpha, dim=-1, keepdim=False): """ Apply log-mean-exp pooling with sharpness `alpha` across dimension `dim`. """ if x.shape[dim] <= 1: return x if keepdim else x.squeeze(dim) if not torch.is_tensor(alpha) and alpha == 0: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np imp...
CPJKU/kagglebirds2020
SpatialLogMeanExp
false
17,030
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import numpy as np import torch.nn as nn def _lme(x, alpha, dim=-1, keepdim=False): """ Apply log-mean-exp pooling with sharpness `alpha` across dimension `dim`. """ if x.shape[dim] <= 1: return x if keepdim else x.squeeze(dim) if not torch.is_tensor(alpha) and alpha == 0: ...
WeightNormTransConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.weight_norm import weight_norm import torch.onnx class WeightNormTransConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros'):...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AntixK/Neural-Blocks
WeightNormTransConv2d
false
17,031
[ "MIT" ]
3
018a44bbb703fc848234b95a3e604576bd9df88f
https://github.com/AntixK/Neural-Blocks/tree/018a44bbb703fc848234b95a3e604576bd9df88f
import torch import torch.nn as nn from torch.nn.utils.weight_norm import weight_norm import torch.onnx class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros'): super()...
IndRNNCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({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.nn import Module i...
CSLT-THU/Vivi_3.0
IndRNNCell
false
17,032
[ "Apache-2.0" ]
3
86996d99d662cd33100755501a971c41ce30ca70
https://github.com/CSLT-THU/Vivi_3.0/tree/86996d99d662cd33100755501a971c41ce30ca70
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({in...
GeneralizedMeanPoolingFpn
# 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 abc import ABC import torch.autograd class GeneralizedMeanPoolingFpn(nn.Module, ABC): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At...
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 from a...
CASIA-IVA-Lab/PASS_reID
GeneralizedMeanPoolingFpn
false
17,033
[ "Apache-2.0" ]
5
46dc6d25f4396e35ac1a766ad2dcaa580beccf15
https://github.com/CASIA-IVA-Lab/PASS_reID/tree/46dc6d25f4396e35ac1a766ad2dcaa580beccf15
import torch import torch.nn as nn from abc import ABC import torch.autograd class Model(nn.Module, ABC): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, one g...
Log1p
# 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 Log1p(nn.Module): """ Applies `log(1 + 10**a * x)`, with `a` fixed or trainable. """ def __init__(self, a=0, trainable=False): super(Log1p, self).__init__() if trainable: a = nn.Parameter(torch.tensor(a, dtype=torch.get_default_dtyp...
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_...
CPJKU/kagglebirds2020
Log1p
false
17,034
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import torch.nn as nn class Model(nn.Module): """ Applies `log(1 + 10**a * x)`, with `a` fixed or trainable. """ def __init__(self, a=0, trainable=False): super().__init__() if trainable: a = nn.Parameter(torch.tensor(a, dtype=torch.get_default_dtype())) ...
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 torch import torch.nn as nn import torch.optim class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: size (int): the size of input for the first-layer of the FFN. hidden_size (int): the hidden layer size of the second...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Blickwinkel1107/NJUNMT-pytorch
PositionwiseFeedForward
false
17,035
[ "MIT" ]
9
82f684fe768b137ca0649b7b79a1820077917385
https://github.com/Blickwinkel1107/NJUNMT-pytorch/tree/82f684fe768b137ca0649b7b79a1820077917385
import torch import torch.nn as nn import torch.optim class Model(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: size (int): the size of input for the first-layer of the FFN. hidden_size (int): the hidden layer size of the second-layer ...
RED_CNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class RED_CNN(nn.Module): def __init__(self, out_ch=96): super(RED_CNN, self).__init__() self.conv1 = nn.Conv2d(1, out_ch, kernel_size=5, stride=1, padding=0) self.conv2 = nn.Conv2d(out_ch, out_ch, kernel_size=5, stride=1, padding=0) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
BennyZhang-Codes/LDCT-denoising-with-DL-Methods-and-Dicom-Viewer-by-Benny
RED_CNN
false
17,036
[ "MIT" ]
7
07e3dc1e3c6dcdea314b2a9e3cf9ac1036cf5eb6
https://github.com/BennyZhang-Codes/LDCT-denoising-with-DL-Methods-and-Dicom-Viewer-by-Benny/tree/07e3dc1e3c6dcdea314b2a9e3cf9ac1036cf5eb6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, out_ch=96): super().__init__() self.conv1 = nn.Conv2d(1, out_ch, kernel_size=5, stride=1, padding=0) self.conv2 = nn.Conv2d(out_ch, out_ch, kernel_size=5, stride=1, padding=0) self.conv3 = nn...
Classifier_MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Classifier_MLP(nn.Module): def __init__(self, in_dim, hidden_dim, out_dim): super(Classifier_MLP, self).__init__() self.h1 = nn.Linear(in_dim, hidden_dim) self.h2 = nn.Linear(hidden_dim, hidden_dim) self.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....
CORE-Robotics-Lab/Personalized_Neural_Trees
Classifier_MLP
false
17,037
[ "MIT" ]
3
3e8dd12fe4fc850be65c96c847eb143ef3bcdc2e
https://github.com/CORE-Robotics-Lab/Personalized_Neural_Trees/tree/3e8dd12fe4fc850be65c96c847eb143ef3bcdc2e
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_dim, hidden_dim, out_dim): super().__init__() self.h1 = nn.Linear(in_dim, hidden_dim) self.h2 = nn.Linear(hidden_dim, hidden_dim) self.out = nn.Linear(hidden_dim, out_d...
MultiHeadAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_model = d_model...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Blickwinkel1107/NJUNMT-pytorch
MultiHeadAttn
false
17,038
[ "MIT" ]
9
82f684fe768b137ca0649b7b79a1820077917385
https://github.com/Blickwinkel1107/NJUNMT-pytorch/tree/82f684fe768b137ca0649b7b79a1820077917385
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class Model(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super().__init__() self.n_head = n_head self.d_model = d_model self.d_head = d_he...
MGRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({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.nn import Module i...
CSLT-THU/Vivi_3.0
MGRUCell
false
17,039
[ "Apache-2.0" ]
3
86996d99d662cd33100755501a971c41ce30ca70
https://github.com/CSLT-THU/Vivi_3.0/tree/86996d99d662cd33100755501a971c41ce30ca70
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({in...
APLoss_dist
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn def sim_to_dist(scores): return 1 - torch.sqrt(2.001 - 2 * scores) class APLoss(nn.Module): """ Differentiable AP loss, through quantization. From the paper: Learning with Average Precision: Training Image Retrieval with a Listwise Loss J...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ByungHeeCha/visual_localization
APLoss_dist
false
17,040
[ "BSD-3-Clause" ]
3
787fb8f6ee5c6e69ece9e83a016d15596e5524bc
https://github.com/ByungHeeCha/visual_localization/tree/787fb8f6ee5c6e69ece9e83a016d15596e5524bc
import torch import numpy as np from torch import nn def sim_to_dist(scores): return 1 - torch.sqrt(2.001 - 2 * scores) class APLoss(nn.Module): """ Differentiable AP loss, through quantization. From the paper: Learning with Average Precision: Training Image Retrieval with a Listwise Loss J...
GeneralizedMeanPoolingList
# 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 abc import ABC import torch.autograd class GeneralizedMeanPoolingList(nn.Module, ABC): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - A...
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 from abc import ABC import torch.autograd assert_size_stride = torc...
CASIA-IVA-Lab/PASS_reID
GeneralizedMeanPoolingList
false
17,041
[ "Apache-2.0" ]
5
46dc6d25f4396e35ac1a766ad2dcaa580beccf15
https://github.com/CASIA-IVA-Lab/PASS_reID/tree/46dc6d25f4396e35ac1a766ad2dcaa580beccf15
import torch import torch.nn as nn from abc import ABC import torch.autograd class Model(nn.Module, ABC): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, one g...
RNNCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({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.nn import Module i...
CSLT-THU/Vivi_3.0
RNNCell
false
17,042
[ "Apache-2.0" ]
3
86996d99d662cd33100755501a971c41ce30ca70
https://github.com/CSLT-THU/Vivi_3.0/tree/86996d99d662cd33100755501a971c41ce30ca70
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({in...
Shift
# 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 Shift(nn.Module): def __init__(self, amount, inplace=False): super(Shift, self).__init__() self.amount = amount self.inplace = inplace def extra_repr(self): return 'amount={}'.format(self.amount) def forward(self, x): if s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CPJKU/kagglebirds2020
Shift
false
17,043
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, amount, inplace=False): super().__init__() self.amount = amount self.inplace = inplace def extra_repr(self): return 'amount={}'.format(self.amount) def forward(self, x): if self.inplace...
SpatialMeanPool
# 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 SpatialMeanPool(nn.Module): """ Performs mean pooling over spatial dimensions; keeps only the first `ndim` dimensions of the input. """ def __init__(self, ndim=2): super(SpatialMeanPool, self).__init__() self.ndim = ndim def forward(se...
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...
CPJKU/kagglebirds2020
SpatialMeanPool
false
17,044
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import torch.nn as nn class Model(nn.Module): """ Performs mean pooling over spatial dimensions; keeps only the first `ndim` dimensions of the input. """ def __init__(self, ndim=2): super().__init__() self.ndim = ndim def forward(self, x): return x.mean(t...
SubtractMedian
# 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 SubtractMedian(nn.Module): """ Subtracts the median over the last axis. """ def forward(self, x): return x - x.median(-1, keepdim=True).values def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CPJKU/kagglebirds2020
SubtractMedian
false
17,045
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import torch.nn as nn class Model(nn.Module): """ Subtracts the median over the last axis. """ def forward(self, x): return x - x.median(-1, keepdim=True).values def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SpatialMaxPool
# 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 SpatialMaxPool(nn.Module): """ Performs max pooling over spatial dimensions; keeps only the first `ndim` dimensions of the input. """ def __init__(self, ndim=2): super(SpatialMaxPool, self).__init__() self.ndim = ndim def forward(self,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CPJKU/kagglebirds2020
SpatialMaxPool
false
17,046
[ "MIT" ]
4
f86b459389b1d0b0af96ebc9252ffc8496c272e8
https://github.com/CPJKU/kagglebirds2020/tree/f86b459389b1d0b0af96ebc9252ffc8496c272e8
import torch import torch.nn as nn class Model(nn.Module): """ Performs max pooling over spatial dimensions; keeps only the first `ndim` dimensions of the input. """ def __init__(self, ndim=2): super().__init__() self.ndim = ndim def forward(self, x): max, _argmax = x...
NNSmall
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 NNSmall(nn.Module): """ Sammut et. al. benchmark """ def __init__(self, state_dim, output_dim): super(NNSmall, self).__init__() self.fc1 = nn.Linear(state_dim, 128) self.relu1 = nn.ReLU() self.fc2 = nn.Linear(128, 128) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
CORE-Robotics-Lab/Personalized_Neural_Trees
NNSmall
false
17,047
[ "MIT" ]
3
3e8dd12fe4fc850be65c96c847eb143ef3bcdc2e
https://github.com/CORE-Robotics-Lab/Personalized_Neural_Trees/tree/3e8dd12fe4fc850be65c96c847eb143ef3bcdc2e
import torch import torch.nn as nn class Model(nn.Module): """ Sammut et. al. benchmark """ def __init__(self, state_dim, output_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 128) self.relu1 = nn.ReLU() self.fc2 = nn.Linear(128, 128) self.relu2 = nn....
SimMinLoss
# 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 SimMinLoss(torch.nn.Module): def __init__(self, margin=0): super(SimMinLoss, self).__init__() self.margin = margin def forward(self, x, weights): return -(torch.log(1 - x + self.margin) * weights).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), tor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
CVI-SZU/CLIMS
SimMinLoss
false
17,048
[ "MIT" ]
4
9d3d0123b625b2c6941069e8fb359019a5cabd59
https://github.com/CVI-SZU/CLIMS/tree/9d3d0123b625b2c6941069e8fb359019a5cabd59
import torch class Model(torch.nn.Module): def __init__(self, margin=0): super().__init__() self.margin = margin def forward(self, x, weights): return -(torch.log(1 - x + self.margin) * weights).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])...
SimMaxLoss
# 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 SimMaxLoss(torch.nn.Module): def __init__(self, margin=0): super(SimMaxLoss, self).__init__() self.margin = margin def forward(self, x, weights): return -(torch.log(x + self.margin) * weights).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
CVI-SZU/CLIMS
SimMaxLoss
false
17,049
[ "MIT" ]
4
9d3d0123b625b2c6941069e8fb359019a5cabd59
https://github.com/CVI-SZU/CLIMS/tree/9d3d0123b625b2c6941069e8fb359019a5cabd59
import torch class Model(torch.nn.Module): def __init__(self, margin=0): super().__init__() self.margin = margin def forward(self, x, weights): return -(torch.log(x + self.margin) * weights).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] ...
GRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({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.nn import Module i...
CSLT-THU/Vivi_3.0
GRUCell
false
17,050
[ "Apache-2.0" ]
3
86996d99d662cd33100755501a971c41ce30ca70
https://github.com/CSLT-THU/Vivi_3.0/tree/86996d99d662cd33100755501a971c41ce30ca70
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn import Parameter def clip_grad(v, min, max): v_tmp = v.expand_as(v) v_tmp.register_hook(lambda g: g.clamp(min, max)) return v_tmp class RNNCellBase(Module): def __repr__(self): s = '{name}({in...
GradientReversalLayer
# 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 GradientReversalFunction(torch.autograd.Function): """ From: https://github.com/jvanvugt/pytorch-domain-adaptation/blob/cb65581f20b71ff9883dd2435b2275a1fd4b90df/utils.py#L26 Gradient Reversal Layer from: Unsupervised Domain Adaptation by Backpropagation (G...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CZSLwithCVAE/CZSL_CVAE
GradientReversalLayer
false
17,051
[ "MIT" ]
5
b77d40f7efde96d2512ac15ebe592ef56b13f2e3
https://github.com/CZSLwithCVAE/CZSL_CVAE/tree/b77d40f7efde96d2512ac15ebe592ef56b13f2e3
import torch import torch.nn as nn class GradientReversalFunction(torch.autograd.Function): """ From: https://github.com/jvanvugt/pytorch-domain-adaptation/blob/cb65581f20b71ff9883dd2435b2275a1fd4b90df/utils.py#L26 Gradient Reversal Layer from: Unsupervised Domain Adaptation by Backpropagation (G...
EncoderBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.optim class MultiHeadedAttention(nn.Module): def __init__(self, model_dim, head_count, dim_per_head=None, dropout=0.1): super(MultiHeadedAttention, self).__init__() if dim_per_head is None: assert model_dim % head_count == 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....
Blickwinkel1107/NJUNMT-pytorch
EncoderBlock
false
17,052
[ "MIT" ]
9
82f684fe768b137ca0649b7b79a1820077917385
https://github.com/Blickwinkel1107/NJUNMT-pytorch/tree/82f684fe768b137ca0649b7b79a1820077917385
import math import torch import torch.nn as nn import torch.optim class MultiHeadedAttention(nn.Module): def __init__(self, model_dim, head_count, dim_per_head=None, dropout=0.1): super().__init__() if dim_per_head is None: assert model_dim % head_count == 0 dim_per_head =...
Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.autograd def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
CASIA-IVA-Lab/PASS_reID
Block
false
17,053
[ "Apache-2.0" ]
5
46dc6d25f4396e35ac1a766ad2dcaa580beccf15
https://github.com/CASIA-IVA-Lab/PASS_reID/tree/46dc6d25f4396e35ac1a766ad2dcaa580beccf15
import torch import torch.nn as nn import torch.autograd def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, ...
ExampleBackbone
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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._C import torch.serialization class ExampleBackbone(nn.Module): def __init__(self): super(ExampleBackbone, self).__init__() self.conv = nn.Conv2d(3, 3, 3) def init_weights(self, pretrained=None): pass def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch._C import torch.serialization assert_size_str...
CVIU-CSU/M2MRF-Lesion-Segmentation
ExampleBackbone
false
17,054
[ "Apache-2.0" ]
10
13af87927f4cdeca70e35d570edd1aec43b387b6
https://github.com/CVIU-CSU/M2MRF-Lesion-Segmentation/tree/13af87927f4cdeca70e35d570edd1aec43b387b6
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 3, 3) def init_weights(self, pretrained=None): pass def forward(self, x): return [self.conv(x)] def get...
RelPartialLearnableMultiHeadAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class RelMultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, tgt_len =None, ext_len=None, mem_len=None, pre_lnorm=False): super(RelMultiHeadAttn, self).__init__() se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Blickwinkel1107/NJUNMT-pytorch
RelPartialLearnableMultiHeadAttn
false
17,055
[ "MIT" ]
9
82f684fe768b137ca0649b7b79a1820077917385
https://github.com/Blickwinkel1107/NJUNMT-pytorch/tree/82f684fe768b137ca0649b7b79a1820077917385
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class RelMultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, tgt_len =None, ext_len=None, mem_len=None, pre_lnorm=False): super().__init__() self.n_head = n_head ...
SpatialGatherModule
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization class SpatialGatherModule(nn.Module): """Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted method to aggregate the context. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
CVIU-CSU/M2MRF-Lesion-Segmentation
SpatialGatherModule
false
17,056
[ "Apache-2.0" ]
10
13af87927f4cdeca70e35d570edd1aec43b387b6
https://github.com/CVIU-CSU/M2MRF-Lesion-Segmentation/tree/13af87927f4cdeca70e35d570edd1aec43b387b6
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): """Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted method to aggregate the context. """ def _...
Downscale2d
# 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 Downscale2d(nn.Module): def __init__(self, factor=2): super().__init__() self.downsample = nn.AvgPool2d(kernel_size=factor, stride=factor) def forward(self, x): return self.downsample(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
BillyXYB/TransEditor
Downscale2d
false
17,057
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import torch from torch import nn class Model(nn.Module): def __init__(self, factor=2): super().__init__() self.downsample = nn.AvgPool2d(kernel_size=factor, stride=factor) def forward(self, x): return self.downsample(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def...
InputInjection
# 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 InputInjection(nn.Module): """Downsampling module for CGNet.""" def __init__(self, num_downsampling): super(InputInjection, self).__init__() self.pool = nn.ModuleList() for i in range(num_downsampling)...
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...
CVIU-CSU/M2MRF-Lesion-Segmentation
InputInjection
false
17,058
[ "Apache-2.0" ]
10
13af87927f4cdeca70e35d570edd1aec43b387b6
https://github.com/CVIU-CSU/M2MRF-Lesion-Segmentation/tree/13af87927f4cdeca70e35d570edd1aec43b387b6
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): """Downsampling module for CGNet.""" def __init__(self, num_downsampling): super().__init__() self.pool = nn.ModuleList() for i in range(num_downsampling): self.pool.appen...
Flatten
# 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 Flatten(nn.Module): def __init__(self): super(Flatten, self).__init__() def forward(self, x): """ Arguments: x: a float tensor with shape [batch_size, c, h, w]. Returns: a float tensor with shape [batch_size, c*h...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
BillyXYB/TransEditor
Flatten
false
17,059
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): """ Arguments: x: a float tensor with shape [batch_size, c, h, w]. Returns: a float tensor with shape [batch_size, c*h*w]. ""...
DiffLoss
# 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 DiffLoss(torch.nn.Module): def __init__(self): super(DiffLoss, self).__init__() def forward(self, D1, D2): D1 = D1.view(D1.size(0), -1) D1_norm = torch.norm(D1, p=2, dim=1, keepdim=True).detach() D1_norm = D1.div(D1_norm.expand_as(D1) + 1e-06) D2 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 assert_size_stride ...
CZSLwithCVAE/CZSL_CVAE
DiffLoss
false
17,060
[ "MIT" ]
5
b77d40f7efde96d2512ac15ebe592ef56b13f2e3
https://github.com/CZSLwithCVAE/CZSL_CVAE/tree/b77d40f7efde96d2512ac15ebe592ef56b13f2e3
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, D1, D2): D1 = D1.view(D1.size(0), -1) D1_norm = torch.norm(D1, p=2, dim=1, keepdim=True).detach() D1_norm = D1.div(D1_norm.expand_as(D1) + 1e-06) D2 = D2.view(D2.size(0...
EqualConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 functional as F from torch import nn class EqualConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True): super().__init__() self.weight = nn.Parameter(torch.randn(out_channel, in_channel, ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynamo.guards.as...
BillyXYB/TransEditor
EqualConv2d
false
17,061
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import math import torch from torch.nn import functional as F from torch import nn class Model(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True): super().__init__() self.weight = nn.Parameter(torch.randn(out_channel, in_channel, ...
NoiseInjection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class NoiseInjection(nn.Module): def __init__(self): super().__init__() self.weight = nn.Parameter(torch.zeros(1)) def forward(self, image, noise=None): if noise is None: batch, _, height, width = image.shape noise = image.new...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
BillyXYB/TransEditor
NoiseInjection
false
17,062
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() self.weight = nn.Parameter(torch.zeros(1)) def forward(self, image, noise=None): if noise is None: batch, _, height, width = image.shape noise = image.new_empty(ba...
CrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
CVIU-CSU/M2MRF-Lesion-Segmentation
CrossEntropyLoss
false
17,063
[ "Apache-2.0" ]
10
13af87927f4cdeca70e35d570edd1aec43b387b6
https://github.com/CVIU-CSU/M2MRF-Lesion-Segmentation/tree/13af87927f4cdeca70e35d570edd1aec43b387b6
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
PixelNorm
# 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 PixelNorm(nn.Module): def __init__(self, pixel_norm_op_dim): super().__init__() self.pixel_norm_op_dim = pixel_norm_op_dim def forward(self, input): return input * torch.rsqrt(torch.mean(input ** 2, dim=self. pixel_norm_op_dim, keep...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
BillyXYB/TransEditor
PixelNorm
false
17,064
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import torch from torch import nn class Model(nn.Module): def __init__(self, pixel_norm_op_dim): super().__init__() self.pixel_norm_op_dim = pixel_norm_op_dim def forward(self, input): return input * torch.rsqrt(torch.mean(input ** 2, dim=self. pixel_norm_op_dim, keepdim=...
PPMConcat
# 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 PPMConcat(nn.ModuleList): """Pyramid Pooling Module that only concat the features of each layer. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. """ def __init__(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 import torch.nn as nn import torch._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
CVIU-CSU/M2MRF-Lesion-Segmentation
PPMConcat
false
17,065
[ "Apache-2.0" ]
10
13af87927f4cdeca70e35d570edd1aec43b387b6
https://github.com/CVIU-CSU/M2MRF-Lesion-Segmentation/tree/13af87927f4cdeca70e35d570edd1aec43b387b6
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.ModuleList): """Pyramid Pooling Module that only concat the features of each layer. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. """ def __init__(self, p...
Encoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization class Encoding(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels). Ar...
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 ...
CVIU-CSU/M2MRF-Lesion-Segmentation
Encoding
false
17,066
[ "Apache-2.0" ]
10
13af87927f4cdeca70e35d570edd1aec43b387b6
https://github.com/CVIU-CSU/M2MRF-Lesion-Segmentation/tree/13af87927f4cdeca70e35d570edd1aec43b387b6
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels). Args:...
ScaledLeakyReLU
# 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 from torch.nn import functional as F from torch import nn class ScaledLeakyReLU(nn.Module): def __init__(self, negative_slope=0.2): super().__init__() self.negative_slope = negative_slope def forward(self, input): out = F.leaky_relu(input, negative_slope=self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
BillyXYB/TransEditor
ScaledLeakyReLU
false
17,067
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import math import torch from torch.nn import functional as F from torch import nn class Model(nn.Module): def __init__(self, negative_slope=0.2): super().__init__() self.negative_slope = negative_slope def forward(self, input): out = F.leaky_relu(input, negative_slope=self.negative_...
EqualLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 from torch.nn import functional as F from torch import nn def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) class FusedLeakyReLUFunctionBackward(Function): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 from torch import nn assert_size...
BillyXYB/TransEditor
EqualLinear
false
17,068
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
from torch.autograd import Function import math import torch from torch.nn import functional as F from torch import nn def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) class FusedLeakyReLUFunctionBackward(Function): ...
MinibatchStdLayer
# 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 MinibatchStdLayer(nn.Module): def __init__(self, group_size=4): super().__init__() self.group_size = group_size def forward(self, x): group_size = min(self.group_size, x.shape[0]) s = x.shape y = x.view([group_size, -1, s[1], s[...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
BillyXYB/TransEditor
MinibatchStdLayer
false
17,069
[ "MIT" ]
4
0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
https://github.com/BillyXYB/TransEditor/tree/0194cd6f0e96c801d55c0cb9683e1f552bcf6d48
import torch from torch import nn class Model(nn.Module): def __init__(self, group_size=4): super().__init__() self.group_size = group_size def forward(self, x): group_size = min(self.group_size, x.shape[0]) s = x.shape y = x.view([group_size, -1, s[1], s[2], s[3]]) ...
h_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 as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class h_swish(nn.Module): def __init__(self, inplace=True)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CYHYCY/voice-classification
h_swish
false
17,071
[ "Apache-2.0" ]
8
a6f62e2f1c39b08323da3632411f4ba6b04d5f37
https://github.com/CYHYCY/voice-classification/tree/a6f62e2f1c39b08323da3632411f4ba6b04d5f37
import torch import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super().__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class Model(nn.Module): def __init__(self, inplace=True): super()...
PAConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 PAConv(nn.Module): def __init__(self, nf, k_size=3): super(PAConv, self).__init__() self.k2 = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() self.k3 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1 ) // 2, bias=Fals...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Cai631/MBMFN
PAConv
false
17,072
[ "Apache-2.0" ]
6
9a48744d7de87a6a7ec08ad87b2d0bd727e1d23c
https://github.com/Cai631/MBMFN/tree/9a48744d7de87a6a7ec08ad87b2d0bd727e1d23c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nf, k_size=3): super().__init__() self.k2 = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() self.k3 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1 ) // 2, bias=False) se...
PA
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 PA(nn.Module): """PA is pixel attention""" def __init__(self, nf): super(PA, self).__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) y = self.sigmoid(y) o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Cai631/MBMFN
PA
false
17,073
[ "Apache-2.0" ]
6
9a48744d7de87a6a7ec08ad87b2d0bd727e1d23c
https://github.com/Cai631/MBMFN/tree/9a48744d7de87a6a7ec08ad87b2d0bd727e1d23c
import torch import torch.nn as nn class Model(nn.Module): """PA is pixel attention""" def __init__(self, nf): super().__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) y = self.sigmoid(y) out = ...
h_sigmoid
# 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 h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def g...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CYHYCY/voice-classification
h_sigmoid
false
17,074
[ "Apache-2.0" ]
8
a6f62e2f1c39b08323da3632411f4ba6b04d5f37
https://github.com/CYHYCY/voice-classification/tree/a6f62e2f1c39b08323da3632411f4ba6b04d5f37
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inplace=True): super().__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
Self_Attn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class Self_Attn(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super(Self_Attn, self).__init__() self.chanel_in = in_dim self.activation = activation if in_dim >= 8: self.query_conv = nn.Conv2d(in_c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
CVPR2020/EnAET
Self_Attn
false
17,075
[ "MIT" ]
3
f490777980d20c68ca63764b7fc25537d7e72660
https://github.com/CVPR2020/EnAET/tree/f490777980d20c68ca63764b7fc25537d7e72660
import torch from torch import nn class Model(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super().__init__() self.chanel_in = in_dim self.activation = activation if in_dim >= 8: self.query_conv = nn.Conv2d(in_channels=in_dim, out...