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
Conv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 spectral_norm(module, mode=True): if mode: return nn.utils.spectral_norm(module) return module class Conv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, transpose=False, use_spectral_norm=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DQiaole/ZITS
Conv
false
7,946
[ "Apache-2.0" ]
40
5f7a060167790789d5e29a3d14d3c2ef8a34e765
https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765
import torch import torch.nn as nn def spectral_norm(module, mode=True): if mode: return nn.utils.spectral_norm(module) return module class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, transpose=False, use_spectral_norm=False): ...
MaxLayer
# 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 MaxLayer(nn.Module): def __init__(self): super(MaxLayer, self).__init__() def forward(self, a, b): return torch.max(a, b) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DingXiaoH/Centripetal-SGD
MaxLayer
false
7,947
[ "Apache-2.0" ]
35
992dd0fb31ee47a79cb0891f4f231707abd0c5c6
https://github.com/DingXiaoH/Centripetal-SGD/tree/992dd0fb31ee47a79cb0891f4f231707abd0c5c6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, a, b): return torch.max(a, b) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
BinaryCrossEntropyLoss
# 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 BinaryCrossEntropyLoss(nn.Module): def __init__(self, pos_weight=None, reduction='mean'): super(BinaryCrossEntropyLoss, self).__init__() self.BCE_loss = nn.BCEWithLogitsLoss(pos_weight=pos_weight, reduction=reduction) def forward(self, inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
DerekRay/2020-instanceSeg
BinaryCrossEntropyLoss
false
7,948
[ "MIT" ]
25
a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3
https://github.com/DerekRay/2020-instanceSeg/tree/a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, pos_weight=None, reduction='mean'): super().__init__() self.BCE_loss = nn.BCEWithLogitsLoss(pos_weight=pos_weight, reduction=reduction) def forward(self, inputs, targets): return self.BCE_loss(i...
GateConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 GateConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, transpose=False): super(GateConv, self).__init__() self.out_channels = out_channels if transpose: self.gate_conv = nn.ConvTra...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
DQiaole/ZITS
GateConv
false
7,949
[ "Apache-2.0" ]
40
5f7a060167790789d5e29a3d14d3c2ef8a34e765
https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, transpose=False): super().__init__() self.out_channels = out_channels if transpose: self.gate_conv = nn.ConvTranspose2d(in_chann...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards....
DQiaole/ZITS
GELU
false
7,950
[ "Apache-2.0" ]
40
5f7a060167790789d5e29a3d14d3c2ef8a34e765
https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765
import math import torch import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
ScaledDotProductAttentionMemory
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ScaledDotProductAttentionMemory(nn.Module): """ Scaled dot-product attention with memory """ def __init__(self, d_model, d_k, d_v, h, m): """ :param d_model: Output dimensionality of the model :param d_k: Dimensionali...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
CurryYuan/X-Trans2Cap
ScaledDotProductAttentionMemory
false
7,951
[ "Apache-2.0" ]
11
c78a27209f14fcbbec74fe8b5edc06faea2e7d44
https://github.com/CurryYuan/X-Trans2Cap/tree/c78a27209f14fcbbec74fe8b5edc06faea2e7d44
import torch import numpy as np import torch.nn as nn class Model(nn.Module): """ Scaled dot-product attention with memory """ def __init__(self, d_model, d_k, d_v, h, m): """ :param d_model: Output dimensionality of the model :param d_k: Dimensionality of queries and keys ...
BinaryLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F def adjust_smooth_l1_loss(y_pred, theta=0.1): less_grad_factor = 1.0 / (2 * theta) less_loss_bias = less_grad_factor * theta ** 2 less_than_theta = (y_pred < theta).float() loss = less_than_theta * y_pred ** 2 * less_grad_factor + (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 import torch.nn.functional as F assert_size_stride ...
DerekRay/2020-instanceSeg
BinaryLoss
false
7,952
[ "MIT" ]
25
a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3
https://github.com/DerekRay/2020-instanceSeg/tree/a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3
import torch import torch.nn as nn import torch.nn.functional as F def adjust_smooth_l1_loss(y_pred, theta=0.1): less_grad_factor = 1.0 / (2 * theta) less_loss_bias = less_grad_factor * theta ** 2 less_than_theta = (y_pred < theta).float() loss = less_than_theta * y_pred ** 2 * less_grad_factor + (1 -...
BCEDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F class BCEDiceLoss(nn.Module): def __init__(self): super(BCEDiceLoss, self).__init__() def forward(self, input, target): bce = F.binary_cross_entropy_with_logits(input, target) input = torch.sigmoid(input) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
DLWK/EANet
BCEDiceLoss
false
7,953
[ "MIT" ]
14
3680e099dd815117d4a54f928fb8247aa2f0b71a
https://github.com/DLWK/EANet/tree/3680e099dd815117d4a54f928fb8247aa2f0b71a
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): bce = F.binary_cross_entropy_with_logits(input, target) input = torch.sigmoid(input) num = target.size(0) ...
PointerAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same valu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DenDen047/data2text-macro-plan-py
PointerAttention
false
7,954
[ "MIT" ]
20
bb01ec6e23dab28c1e969f23bd55776b597fb995
https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995
import torch import torch.nn as nn import torch.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same valu...
PolicyNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 PolicyNetwork(nn.Module): def __init__(self): super(PolicyNetwork, self).__init__() self.fc1 = nn.Linear(4, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 2) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DensoITLab/spinningup_in_pytorch
PolicyNetwork
false
7,955
[ "MIT" ]
11
612d8c4c6593c8c5ecb5a939bf43085daac9e552
https://github.com/DensoITLab/spinningup_in_pytorch/tree/612d8c4c6593c8c5ecb5a939bf43085daac9e552
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 2) def forward(self, x): x = F.relu(self.fc1(x)) ...
InformedSender
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class InformedSender(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super(InformedSender, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Daetheys/Lazimpa
InformedSender
false
7,956
[ "MIT" ]
15
21f4f4ebcdfa8b6a775b64673dd3001763c91cf1
https://github.com/Daetheys/Lazimpa/tree/21f4f4ebcdfa8b6a775b64673dd3001763c91cf1
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class Model(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super().__init__() self.g...
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.cuda import torch.distributed class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_model (int): the size of input for the first-layer of the FFN. d_ff (int): the hidden layer size of th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DenDen047/data2text-macro-plan-py
PositionwiseFeedForward
false
7,957
[ "MIT" ]
20
bb01ec6e23dab28c1e969f23bd55776b597fb995
https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995
import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_model (int): the size of input for the first-layer of the FFN. d_ff (int): the hidden layer size of the second-layer ...
GELU2
# 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 GELU2(nn.Module): def __init__(self): super().__init__() def forward(self, x): 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
DQiaole/ZITS
GELU2
false
7,958
[ "Apache-2.0" ]
40
5f7a060167790789d5e29a3d14d3c2ef8a34e765
https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GlobalAttentionContext
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DenDen047/data2text-macro-plan-py
GlobalAttentionContext
false
7,959
[ "MIT" ]
20
bb01ec6e23dab28c1e969f23bd55776b597fb995
https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not ...
SEBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SEBlock(nn.Module): def __init__(self, input_channels, internal_neurons): super(SEBlock, self).__init__() self.down = nn.Conv2d(in_channels=input_channels, out_channels= internal_neurons, kernel_size=1, 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_...
DingXiaoH/GSM-SGD
SEBlock
false
7,960
[ "MIT" ]
40
ffc605651c4c5115dfb8659ebe48ccf71d3955a0
https://github.com/DingXiaoH/GSM-SGD/tree/ffc605651c4c5115dfb8659ebe48ccf71d3955a0
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_channels, internal_neurons): super().__init__() self.down = nn.Conv2d(in_channels=input_channels, out_channels= internal_neurons, kernel_size=1, stride=1, bias=True) ...
Contract
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.onnx class Contract(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): b, c, h, w = x.size() s = self.gain x = x.view(b, c, h // s, s, w // s, s) x = x.permute(0, 3,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
DDGRCF/YOLOX_OBB
Contract
false
7,961
[ "Apache-2.0" ]
39
27b80953306492b8bc83b86b1353d8cee01ef9b6
https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6
import torch import torch.nn as nn import torch.onnx class Model(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): b, c, h, w = x.size() s = self.gain x = x.view(b, c, h // s, s, w // s, s) x = x.permute(0, 3, 5,...
ValueNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ValueNetwork(nn.Module): def __init__(self): super(ValueNetwork, self).__init__() self.fc1 = nn.Linear(4, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 1) def forward(self, x): x ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
DensoITLab/spinningup_in_pytorch
ValueNetwork
false
7,962
[ "MIT" ]
11
612d8c4c6593c8c5ecb5a939bf43085daac9e552
https://github.com/DensoITLab/spinningup_in_pytorch/tree/612d8c4c6593c8c5ecb5a939bf43085daac9e552
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 1) def forward(self, x): x = F.relu(self.fc1(x)) ...
Sum
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.onnx class Sum(nn.Module): def __init__(self, n, weight=False): super().__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=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 import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
DDGRCF/YOLOX_OBB
Sum
false
7,963
[ "Apache-2.0" ]
39
27b80953306492b8bc83b86b1353d8cee01ef9b6
https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6
import torch import torch.nn as nn import torch.onnx class Model(nn.Module): def __init__(self, n, weight=False): super().__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=True ...
DenseSAGEConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn.functional as F import torch.utils.data from torch.nn import Parameter def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class DenseSAGEConv(torch.nn.Module): """See :class:`torch_geometric.nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Cyanogenoid/fspool
DenseSAGEConv
false
7,964
[ "MIT" ]
41
7525cb17992ec7a1bb7f92996c2b31a65aa8eba2
https://github.com/Cyanogenoid/fspool/tree/7525cb17992ec7a1bb7f92996c2b31a65aa8eba2
import math import torch import torch.nn.functional as F import torch.utils.data from torch.nn import Parameter def uniform(size, tensor): stdv = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-stdv, stdv) class Model(torch.nn.Module): """See :class:`torch_geometric.nn.conv.sa...
MultiplicationComposition
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from abc import abstractmethod import torch.utils.data class Composition(nn.Module): """A base class for compositions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Compose two batches vectors. .....
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 from abc import abstractmethod import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
DimitrisAlivas/StarQE
MultiplicationComposition
false
7,965
[ "MIT" ]
11
c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
import torch from torch import nn from abc import abstractmethod import torch.utils.data class Composition(nn.Module): """A base class for compositions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Compose two batches vectors. .....
Cutout
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import random import torch def _gen_cutout_coord(height, width, size): height_loc = random.randint(0, height - 1) width_loc = random.randint(0, width - 1) upper_coord = max(0, height_loc - size // 2), max(0, width_loc - size // 2) lower_coord = min(height, height_loc + size // 2), min(width, width_loc...
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 random assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cu...
DensoITLab/TeachAugment
Cutout
false
7,966
[ "BSD-2-Clause" ]
20
66ec099a0afab99e18531c5437182cfe17dc30c8
https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8
import random import torch def _gen_cutout_coord(height, width, size): height_loc = random.randint(0, height - 1) width_loc = random.randint(0, width - 1) upper_coord = max(0, height_loc - size // 2), max(0, width_loc - size // 2) lower_coord = min(height, height_loc + size // 2), min(width, width_loc...
GlobalSelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DenDen047/data2text-macro-plan-py
GlobalSelfAttention
false
7,967
[ "MIT" ]
20
bb01ec6e23dab28c1e969f23bd55776b597fb995
https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not ...
AverageAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.cuda import torch.distributed class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_model (int): the size of input for the first-layer of the FFN. d_ff (int): the hidden layer size of th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.cuda import torch.distributed assert_size_str...
DenDen047/data2text-macro-plan-py
AverageAttention
false
7,968
[ "MIT" ]
20
bb01ec6e23dab28c1e969f23bd55776b597fb995
https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995
import torch import torch.nn as nn import torch.cuda import torch.distributed class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_model (int): the size of input for the first-layer of the FFN. d_ff (int): the hidden layer size of th...
ComplexRotationComposition
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from abc import abstractmethod import torch.utils.data def _to_complex(x: 'torch.Tensor') ->torch.Tensor: """View real tensor as complex.""" return torch.view_as_complex(x.view(*x.shape[:-1], -1, 2)) def _to_real(x: 'torch.Tensor') ->torch.Tensor: """View complex tensor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from abc import abstractmethod import torch.utils.data assert_size_s...
DimitrisAlivas/StarQE
ComplexRotationComposition
false
7,969
[ "MIT" ]
11
c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
import torch from torch import nn from abc import abstractmethod import torch.utils.data def _to_complex(x: 'torch.Tensor') ->torch.Tensor: """View real tensor as complex.""" return torch.view_as_complex(x.view(*x.shape[:-1], -1, 2)) def _to_real(x: 'torch.Tensor') ->torch.Tensor: """View complex tensor...
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 class FocalLoss(nn.Module): def __init__(self, gamma=2, eps=1e-07, size_average=True): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.size_average = size_average def forward(self, prob, labels): p_t = prob *...
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 ...
Dong-JinKim/ActionCooccurrencePriors
FocalLoss
false
7,970
[ "MIT" ]
27
110dbeecf4c25955b5b0160bd7d31d25c759ef21
https://github.com/Dong-JinKim/ActionCooccurrencePriors/tree/110dbeecf4c25955b5b0160bd7d31d25c759ef21
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, gamma=2, eps=1e-07, size_average=True): super().__init__() self.gamma = gamma self.eps = eps self.size_average = size_average def forward(self, prob, labels): p_t = prob * labels + (1 - prob...
ScalarMix
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class ScalarMix(nn.Module): def __init__(self, n_layers, dropout=0): super(ScalarMix, self).__init__() self.n_layers = n_layers self.dropout = dropout self.weights = nn.Parameter(torch.zeros(n_la...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.data.dataloader import torch.nn as nn import torch.nn ...
Dadmatech/DadmaTools
ScalarMix
false
7,971
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class Model(nn.Module): def __init__(self, n_layers, dropout=0): super().__init__() self.n_layers = n_layers self.dropout = dropout self.weights = nn.Parameter(torch.zeros(n_layers)) self...
CosineSimilarity
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from abc import abstractmethod import torch.utils.data from torch.nn import functional class Similarity(nn.Module): """Base class for similarity functions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Comp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DimitrisAlivas/StarQE
CosineSimilarity
false
7,972
[ "MIT" ]
11
c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
import torch from torch import nn from abc import abstractmethod import torch.utils.data from torch.nn import functional class Similarity(nn.Module): """Base class for similarity functions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Comp...
Biaffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class Biaffine(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True, diagonal=False ): super(Biaffine, self).__init__() self.n_in = n_in self.n_out = n_out self.bias_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.utils.data.dataloader import torch.nn as nn import torch.nn assert_...
Dadmatech/DadmaTools
Biaffine
false
7,973
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class Model(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True, diagonal=False ): super().__init__() self.n_in = n_in self.n_out = n_out self.bias_x = bias_x s...
BiaffineScorer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class BiaffineScorer(nn.Module): def __init__(self, input1_size, input2_size, output_size): super().__init__() self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1, output_size) self.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 import torch.utils.data.dataloader import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Dadmatech/DadmaTools
BiaffineScorer
false
7,974
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class Model(nn.Module): def __init__(self, input1_size, input2_size, output_size): super().__init__() self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1, output_size) self.W_bilin.we...
MsgNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn import functional as F class MsgNorm(torch.nn.Module): def __init__(self, learn_msg_scale=False): super(MsgNorm, self).__init__() self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]), requires_grad=learn_msg_scale) def forward(self, x, msg, p=2): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
Dianezzy/YOLaT-VectorGraphicsRecognition
MsgNorm
false
7,975
[ "MIT" ]
44
ae21ad5850a49048f639d9b283ded927c3b367f7
https://github.com/Dianezzy/YOLaT-VectorGraphicsRecognition/tree/ae21ad5850a49048f639d9b283ded927c3b367f7
import torch from torch.nn import functional as F class Model(torch.nn.Module): def __init__(self, learn_msg_scale=False): super().__init__() self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]), requires_grad=learn_msg_scale) def forward(self, x, msg, p=2): msg = F.no...
NegativeLpSimilarity
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from abc import abstractmethod import torch.utils.data class Similarity(nn.Module): """Base class for similarity functions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Compute pair-wise similarities. ...
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 from abc import abstractmethod import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
DimitrisAlivas/StarQE
NegativeLpSimilarity
false
7,976
[ "MIT" ]
11
c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
import torch from torch import nn from abc import abstractmethod import torch.utils.data class Similarity(nn.Module): """Base class for similarity functions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Compute pair-wise similarities. ...
Classifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class Classifier(nn.Module): def __init__(self, input_size): super().__init__() self.hidden_1 = nn.Linear(input_size, 100) self.hidden_2 = nn.Linear(100, 100) self.hidden_3 = nn.Linear(100, 50) self.hidden_4...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Develop-Packt/Solving-a-Classification-Problem-with-DNNs-Using-PyTorch
Classifier
false
7,977
[ "MIT" ]
16
d0fe33c71242da256e3727bb49417a08de39c85c
https://github.com/Develop-Packt/Solving-a-Classification-Problem-with-DNNs-Using-PyTorch/tree/d0fe33c71242da256e3727bb49417a08de39c85c
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size): super().__init__() self.hidden_1 = nn.Linear(input_size, 100) self.hidden_2 = nn.Linear(100, 100) self.hidden_3 = nn.Linear(100, 50) self.hidden_4 = nn...
NegativePowerNormSimilarity
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from abc import abstractmethod from typing import Union import torch.utils.data class Similarity(nn.Module): """Base class for similarity functions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Compute pai...
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 from abc import abstractmethod from typing import Union import torch.utils.data assert_size_stride = torch._C._dynamo.g...
DimitrisAlivas/StarQE
NegativePowerNormSimilarity
false
7,978
[ "MIT" ]
11
c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28
import torch from torch import nn from abc import abstractmethod from typing import Union import torch.utils.data class Similarity(nn.Module): """Base class for similarity functions.""" @abstractmethod def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: """ Compute pai...
StableBCELoss
# 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 StableBCELoss(torch.nn.modules.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() def get_in...
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...
Diyago/Automatic-salt-deposits-segmentation
StableBCELoss
false
7,979
[ "MIT" ]
20
fedfc7f1d9878674382eeb16a820b5f16791f4ab
https://github.com/Diyago/Automatic-salt-deposits-segmentation/tree/fedfc7f1d9878674382eeb16a820b5f16791f4ab
import torch class Model(torch.nn.modules.Module): def __init__(self): super().__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() def get_inputs(): return [torch.r...
NormalizeLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn as nn import torch.nn.init as init class NormalizeLinear(nn.Module): def __init__(self, in_features, num_class): super(NormalizeLinear, self).__init__() self.weight = nn.Parameter(torch.Tensor(num_class, in_features)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DoubtedSteam/MPANet
NormalizeLinear
false
7,980
[ "MIT" ]
25
fe4f3f1d83c45485b1498786f89ace96c634f187
https://github.com/DoubtedSteam/MPANet/tree/fe4f3f1d83c45485b1498786f89ace96c634f187
import math import torch from torch.nn import functional as F import torch.nn as nn import torch.nn.init as init class Model(nn.Module): def __init__(self, in_features, num_class): super().__init__() self.weight = nn.Parameter(torch.Tensor(num_class, in_features)) self.reset_parameters() ...
MatrixTree
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda import torch.distributed class MatrixTree(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :ci...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda import torch.distributed assert_s...
DenDen047/data2text-macro-plan-py
MatrixTree
false
7,981
[ "MIT" ]
20
bb01ec6e23dab28c1e969f23bd55776b597fb995
https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995
import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :cite:`D...
SpatialAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv = nn.Conv2d(2, 1, kernel_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
DoubtedSteam/MPANet
SpatialAttention
false
7,982
[ "MIT" ]
25
fe4f3f1d83c45485b1498786f89ace96c634f187
https://github.com/DoubtedSteam/MPANet/tree/fe4f3f1d83c45485b1498786f89ace96c634f187
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, kernel_size=7): super().__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False) ...
NonSaturatingLoss
# 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 def non_saturating_loss(logits, targets): probs = logits.softmax(1) log_prob = torch.log(1 - probs + 1e-12) if targets.ndim == 2: return -(targets * log_prob).sum(1).mean() else: return F.nll_loss(log_prob, targets) class NonSaturatingLoss...
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...
DensoITLab/TeachAugment
NonSaturatingLoss
false
7,983
[ "BSD-2-Clause" ]
20
66ec099a0afab99e18531c5437182cfe17dc30c8
https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8
import torch import torch.nn.functional as F def non_saturating_loss(logits, targets): probs = logits.softmax(1) log_prob = torch.log(1 - probs + 1e-12) if targets.ndim == 2: return -(targets * log_prob).sum(1).mean() else: return F.nll_loss(log_prob, targets) class Model(torch.nn.Mo...
ShakeResNeXt
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.size(0)).uniform_() al...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
DensoITLab/TeachAugment
ShakeResNeXt
false
7,984
[ "BSD-2-Clause" ]
20
66ec099a0afab99e18531c5437182cfe17dc30c8
https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.size(0)).uniform_() al...
FiLM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class FiLM(nn.Module): """ A Feature-wise Linear Modulation Layer from 'FiLM: Visual Reasoning with a General Conditioning Layer' """ def forward(self, x, gammas, betas): 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 import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed assert_size_stride = torch._C._dynamo....
Dou-Yiming/YouRefIt_ERU
FiLM
false
7,985
[ "MIT" ]
13
2a8e849380ed2d253c467b1af744a514bc171372
https://github.com/Dou-Yiming/YouRefIt_ERU/tree/2a8e849380ed2d253c467b1af744a514bc171372
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): """ A Feature-wise Linear Modulation Layer from 'FiLM: Visual Reasoning with a General Conditioning Layer' """ def forward(self, x, gammas, betas): re...
TransformerLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.onnx class TransformerLayer(nn.Module): def __init__(self, channels, num_heads): super().__init__() self.q = nn.Linear(channels, channels, bias=False) self.k = nn.Linear(channels, channels, bias=False) self.v = nn.Linear(channels, ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DDGRCF/YOLOX_OBB
TransformerLayer
false
7,986
[ "Apache-2.0" ]
39
27b80953306492b8bc83b86b1353d8cee01ef9b6
https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6
import torch import torch.nn as nn import torch.onnx class Model(nn.Module): def __init__(self, channels, num_heads): super().__init__() self.q = nn.Linear(channels, channels, bias=False) self.k = nn.Linear(channels, channels, bias=False) self.v = nn.Linear(channels, channels, bia...
QuadriLinearScore
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.utils.data.dataloader import torch.nn as nn import torch.nn class QuadriLinearScore(nn.Module): """ Outer product version of quadrilinear function for sequence labeling. """ def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std= 0.1545, w...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.utils.data.dataloader import torch.nn as nn import torc...
Dadmatech/DadmaTools
QuadriLinearScore
false
7,987
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import math import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class Model(nn.Module): """ Outer product version of quadrilinear function for sequence labeling. """ def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std= 0.1545, window_size=1...
GlobalAvgPool2dResNext
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class GlobalAvgPool2dResNext(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(Globa...
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 torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distr...
Alibaba-MIIL/ZS_SDL
GlobalAvgPool2dResNext
false
7,988
[ "MIT" ]
20
769fe4f57d2d458a7c4b5468a6395c9b296b1dad
https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super().__init__() def ...
MyUpsample2
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class MyUpsample2(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed assert_size_stride = torch._C._dynamo....
Dou-Yiming/YouRefIt_ERU
MyUpsample2
false
7,989
[ "MIT" ]
13
2a8e849380ed2d253c467b1af744a514bc171372
https://github.com/Dou-Yiming/YouRefIt_ERU/tree/2a8e849380ed2d253c467b1af744a514bc171372
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) def get...
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.utils.data.dataloader import torch.nn as nn import torch.nn class SharedDropout(nn.Module): def __init__(self, p=0.5, batch_first=True): super(SharedDropout, self).__init__() self.p = p self.batch_first = batch_first def extra_repr(self): s = f'p={se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data.dataloader import torch.nn as nn import torch.nn assert_...
Dadmatech/DadmaTools
MLP
false
7,990
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class SharedDropout(nn.Module): def __init__(self, p=0.5, batch_first=True): super().__init__() self.p = p self.batch_first = batch_first def extra_repr(self): s = f'p={self.p}' if s...
BiaffineAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data.dataloader from torch.nn import Parameter import torch.nn as nn import torch.nn from torch.nn.parameter import Parameter class BiaffineAttention(nn.Module): """ Adopted from NeuroNLP2: https://github.com/XuezheMax/NeuroNLP2/blob/master/neuronlp2/nn/modules/attentio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Dadmatech/DadmaTools
BiaffineAttention
false
7,991
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import torch import torch.utils.data.dataloader from torch.nn import Parameter import torch.nn as nn import torch.nn from torch.nn.parameter import Parameter class Model(nn.Module): """ Adopted from NeuroNLP2: https://github.com/XuezheMax/NeuroNLP2/blob/master/neuronlp2/nn/modules/attention.py Bi...
ShakeResNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.size(0)).uniform_() al...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
DensoITLab/TeachAugment
ShakeResNet
false
7,992
[ "BSD-2-Clause" ]
20
66ec099a0afab99e18531c5437182cfe17dc30c8
https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.size(0)).uniform_() al...
PT
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 numpy as np import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, in_features, out_features, dropout, bias=False): super(Linear, self).__init__() self.dropout = dropout self.in_features = in_features self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import numpy as n...
DongHande/PT_propagation_then_training
PT
false
7,993
[ "MIT" ]
21
3f346ff161d2a0b807e3c0269ad26a7266305cc3
https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, in_features, out_features, dropout, bias=False): super().__init__() self.dropout = dropout self.in_features = in_features self.out_features...
PoolReducer
# 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 PoolReducer(nn.Module): def __init__(self, groups, pool_operation='max'): super(PoolReducer, self).__init__() if pool_operation == 'max': self.pool = lambda x: x.max(2)[0] elif pool_operation == 'average': self.pool = lambda ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Dreem-Organization/RobustSleepNet
PoolReducer
false
7,994
[ "MIT" ]
16
c8ff3f6f857299eb2bf2e9400483084d5ecd4106
https://github.com/Dreem-Organization/RobustSleepNet/tree/c8ff3f6f857299eb2bf2e9400483084d5ecd4106
import torch from torch import nn class Model(nn.Module): def __init__(self, groups, pool_operation='max'): super().__init__() if pool_operation == 'max': self.pool = lambda x: x.max(2)[0] elif pool_operation == 'average': self.pool = lambda x: x.mean(2) el...
HyperSphereLoss
# 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 HyperSphereLoss(nn.Module): def forward(self, input): """ Calcuate distance between input and N(North Pole) using hypersphere metrics. Woo Park, Sung, and Junseok Kwon. "Sphere Generative Adversarial Network Based on Geometric Moment Match...
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_...
Dotori-HJ/SphereGAN-Pytorch-implementation
HyperSphereLoss
false
7,995
[ "MIT" ]
11
fe7843545388ecdae34f374e7f1c42300ab12689
https://github.com/Dotori-HJ/SphereGAN-Pytorch-implementation/tree/fe7843545388ecdae34f374e7f1c42300ab12689
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): """ Calcuate distance between input and N(North Pole) using hypersphere metrics. Woo Park, Sung, and Junseok Kwon. "Sphere Generative Adversarial Network Based on Geometric Moment Matching." ...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, in_features, out_features, dropout, bias=False): super(Linear, self).__init__() self.dropout = dropout self.in_features = in_features self.out_features = 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....
DongHande/PT_propagation_then_training
GCN
false
7,996
[ "MIT" ]
21
3f346ff161d2a0b807e3c0269ad26a7266305cc3
https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3
import math import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, in_features, out_features, dropout, bias=False): super().__init__() self.dropout = dropout self.in_features = in_features self.out_features = out_features ...
TransformerEncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerEncoderLayer(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Daetheys/Lazimpa
TransformerEncoderLayer
false
7,997
[ "MIT" ]
15
21f4f4ebcdfa8b6a775b64673dd3001763c91cf1
https://github.com/Daetheys/Lazimpa/tree/21f4f4ebcdfa8b6a775b64673dd3001763c91cf1
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class Model(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): super().__init_...
SelfAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SelfAttn(nn.Module): def __init__(self, denc, dropout=0, enc_trans=None, dec_trans=None): super().__init__() self.scorer = nn.Linear(denc, 1) self.dropout = nn.Dropout(dropout) self.enc_trans = enc_trans ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DreamerDeo/gazp
SelfAttn
false
7,998
[ "MIT" ]
18
5f823a447ffdf5176023a01516d2be7c383294d9
https://github.com/DreamerDeo/gazp/tree/5f823a447ffdf5176023a01516d2be7c383294d9
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, denc, dropout=0, enc_trans=None, dec_trans=None): super().__init__() self.scorer = nn.Linear(denc, 1) self.dropout = nn.Dropout(dropout) self.enc_trans = enc_trans or ...
SpatialAttentionGate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SpatialAttentionGate(nn.Module): def __init__(self, channel, reduction=16): super(SpatialAttentionGate, self).__init__() self.fc1 = nn.Conv2d(channel, reduction, kernel_size=1, padding=0) self.fc2 = nn.Conv2d(red...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Diyago/Automatic-salt-deposits-segmentation
SpatialAttentionGate
false
7,999
[ "MIT" ]
20
fedfc7f1d9878674382eeb16a820b5f16791f4ab
https://github.com/Diyago/Automatic-salt-deposits-segmentation/tree/fedfc7f1d9878674382eeb16a820b5f16791f4ab
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, channel, reduction=16): super().__init__() self.fc1 = nn.Conv2d(channel, reduction, kernel_size=1, padding=0) self.fc2 = nn.Conv2d(reduction, 1, kernel_size=1, padding=0) ...
Whitening2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from torch.cuda.amp import custom_fwd from torch.nn.functional import conv2d class Whitening2d(nn.Module): def __init__(self, output_dim: 'int', eps: 'float'=0.0): """Layer that computes hard whitening for W-MSE using the Cholesky decomposition. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
DonkeyShot21/cassle
Whitening2d
false
8,000
[ "MIT" ]
13
d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8
https://github.com/DonkeyShot21/cassle/tree/d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8
import torch from torch import nn from torch.cuda.amp import custom_fwd from torch.nn.functional import conv2d class Model(nn.Module): def __init__(self, output_dim: 'int', eps: 'float'=0.0): """Layer that computes hard whitening for W-MSE using the Cholesky decomposition. Args: outp...
GBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import functools import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter def l2_norm(v, eps=1e-10): """ L2 normalization :param v: :param eps: :return: """ return v / (v.norm() + eps) def pixel_norm(x, eps=1e-10): """ Pixel normalization ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Dong-Jie-Chen/GS-WGAN
GBlock
false
8,001
[ "MIT" ]
32
5f33f21249431e53f44167da3ae7587e0dc695d9
https://github.com/Dong-Jie-Chen/GS-WGAN/tree/5f33f21249431e53f44167da3ae7587e0dc695d9
import functools import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter def l2_norm(v, eps=1e-10): """ L2 normalization :param v: :param eps: :return: """ return v / (v.norm() + eps) def pixel_norm(x, eps=1e-10): """ Pixel normalization ...
HardSigmoid
# 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 HardSigmoid(nn.Module): def __init__(self, slope=0.1666667, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, input): return torch.where(input >= 3, torch.tensor(1.0, dtype=torch.float) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
DocYard-ai/UCR
HardSigmoid
false
8,002
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn class Model(nn.Module): def __init__(self, slope=0.1666667, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, input): return torch.where(input >= 3, torch.tensor(1.0, dtype=torch.float) .typ...
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): super().__init__() def forward(self, input): return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim= True) + 1e-08) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Dolorousrtur/style-people
PixelNorm
false
8,003
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input): return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim= True) + 1e-08) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inp...
MAECriterion
# 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 MAECriterion(torch.nn.Module): def __init__(self): super().__init__() def forward(self, pred, target): return torch.mean(torch.abs(pred - target)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Dolorousrtur/style-people
MAECriterion
false
8,004
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, pred, target): return torch.mean(torch.abs(pred - target)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
StackingNNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn import CrossEntropyLoss import torch.utils.data.distributed import torch.utils.data def gelu(x): return 0.5 * x * (1 + torch.tanh(np.sqrt(2.0 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) class StackingNNet(nn.Module): def __init__...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
ECNU-ICA/ECNU-SenseMaker
StackingNNet
false
8,005
[ "MIT" ]
16
24f829c3dfefccea5fecbbe75904858ec1fefffb
https://github.com/ECNU-ICA/ECNU-SenseMaker/tree/24f829c3dfefccea5fecbbe75904858ec1fefffb
import torch import numpy as np import torch.nn as nn from torch.nn import CrossEntropyLoss import torch.utils.data.distributed import torch.utils.data def gelu(x): return 0.5 * x * (1 + torch.tanh(np.sqrt(2.0 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Model(nn.Module): def __init__(self, ...
CosineSimilarityLoss
# 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 CosineSimilarityLoss(nn.Module): def __init__(self): super(CosineSimilarityLoss, self).__init__() def forward(self, x1, x2): return 0.5 - 0.5 * torch.cosine_similarity(x1, x2) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
DunZhang/KnowledgeDistillation
CosineSimilarityLoss
false
8,006
[ "MIT" ]
31
47a9dd0f51021001b53e3a76c9347eb3131f1f72
https://github.com/DunZhang/KnowledgeDistillation/tree/47a9dd0f51021001b53e3a76c9347eb3131f1f72
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x1, x2): return 0.5 - 0.5 * torch.cosine_similarity(x1, x2) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): retu...
SEModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class SEModule(nn.Module): def __init__(self, in_channels, reduction=4): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels= in_channels // reduction, kernel_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
DocYard-ai/UCR
SEModule
false
8,007
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn class Model(nn.Module): def __init__(self, in_channels, reduction=4): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels= in_channels // reduction, kernel_size=1, stride=1, p...
ModulatedConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) def make_kernel(k): k = torch.tensor(k, dtype=torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.autograd...
Dolorousrtur/style-people
ModulatedConv2d
false
8,008
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) def make_kernel(k): k = torch.tensor(k, dtype=torch...
HexaLinearScore
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.utils.data.dataloader import torch.nn as nn import torch.nn class HexaLinearScore(nn.Module): """ Outer product version of hexalinear function for sequence labeling. """ def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std= 0.1545, norma...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.utils.data.dataloader import torch.nn as nn import torc...
Dadmatech/DadmaTools
HexaLinearScore
false
8,009
[ "Apache-2.0" ]
25
c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2
import math import torch import torch.utils.data.dataloader import torch.nn as nn import torch.nn class Model(nn.Module): """ Outer product version of hexalinear function for sequence labeling. """ def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std= 0.1545, normalization=T...
FFN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class FFN(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super(FFN, self).__init__() self.dropout_rate = dropout_rate self.fc1 = nn.Linear(in_features=d_model, 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
DocYard-ai/UCR
FFN
false
8,010
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super().__init__() self.dropout_rate = dropout_rate self.fc1 = nn.Linear(in_features=d_model, out_feat...
AdaptiveConcatPool2d
# 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.optim class AdaptiveConcatPool2d(nn.Module): def __init__(self, sz=1): super().__init__() self.output_size = sz or 1 self.ap = nn.AdaptiveAvgPool2d(self.output_size) self.mp = nn.AdaptiveMaxPool2d(self.output_size) 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 from torch._inductor.runtime import triton_helpers from torch import nn import torch.optim assert_size_stride = torch._C._dynamo.guards.asse...
DrHB/PANDA-2nd-place-solution
AdaptiveConcatPool2d
false
8,011
[ "MIT" ]
17
44ab72780f9e3594811f2a7520456de7a9e677db
https://github.com/DrHB/PANDA-2nd-place-solution/tree/44ab72780f9e3594811f2a7520456de7a9e677db
import torch from torch import nn import torch.optim class Model(nn.Module): def __init__(self, sz=1): super().__init__() self.output_size = sz or 1 self.ap = nn.AdaptiveAvgPool2d(self.output_size) self.mp = nn.AdaptiveMaxPool2d(self.output_size) def forward(self, x): ...
StyledSiren
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import nn import torch.nn.functional as F 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): @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.triton_helpers import libdevice, math as tl_math fr...
Dolorousrtur/style-people
StyledSiren
false
8,012
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F 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): @s...
DotAttn
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from torch.nn import functional as F class DotAttn(nn.Module): def __init__(self, dropout=0, enc_trans=None, dec_trans=None): super().__init__() self.dropout = nn.Dropout(dropout) self.dec_trans = dec_trans or nn.Identity() self.enc_trans = enc_tr...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
DreamerDeo/gazp
DotAttn
false
8,013
[ "MIT" ]
18
5f823a447ffdf5176023a01516d2be7c383294d9
https://github.com/DreamerDeo/gazp/tree/5f823a447ffdf5176023a01516d2be7c383294d9
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, dropout=0, enc_trans=None, dec_trans=None): super().__init__() self.dropout = nn.Dropout(dropout) self.dec_trans = dec_trans or nn.Identity() self.enc_trans = enc_tran...
GeM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn.parameter import Parameter import torch.optim def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class GeM(nn.Module): def __init__(self, p=3, eps=1e-06): ...
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.functional a...
DrHB/PANDA-2nd-place-solution
GeM
false
8,014
[ "MIT" ]
17
44ab72780f9e3594811f2a7520456de7a9e677db
https://github.com/DrHB/PANDA-2nd-place-solution/tree/44ab72780f9e3594811f2a7520456de7a9e677db
import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter import torch.optim def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class Model(nn.Module): def __init__(self, p=3, eps=1e-06): ...
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 import nn import torch.nn.functional as F 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.nega...
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...
Dolorousrtur/style-people
ScaledLeakyReLU
false
8,015
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
import math import torch from torch import nn import torch.nn.functional as F 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_slope...
SinkhornKnopp
# 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.distributed as dist class SinkhornKnopp(torch.nn.Module): def __init__(self, num_iters: 'int'=3, epsilon: 'float'=0.05, world_size: 'int'=1): """Approximates optimal transport using the Sinkhorn-Knopp algorithm. A simple iterative method to approach the double 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 math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
DonkeyShot21/cassle
SinkhornKnopp
false
8,016
[ "MIT" ]
13
d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8
https://github.com/DonkeyShot21/cassle/tree/d25f9c7cb5e822660dc1ef03e7fac09a33d0b1a8
import torch import torch.distributed as dist class Model(torch.nn.Module): def __init__(self, num_iters: 'int'=3, epsilon: 'float'=0.05, world_size: 'int'=1): """Approximates optimal transport using the Sinkhorn-Knopp algorithm. A simple iterative method to approach the double stochasti...
HighwayLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.utils.data.distributed import torch.utils.checkpoint def my_xavier_init(m, gain=1): """Xavier initialization: weights initialization that tries to make variance of outputs of a layer equal to variance of its inputs. """ for p in m....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
CowherdChris/droidlet
HighwayLayer
false
8,017
[ "MIT" ]
26
8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1
https://github.com/CowherdChris/droidlet/tree/8d965c1ebc38eceb6f8083c52b1146c1bc17d5e1
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.utils.checkpoint def my_xavier_init(m, gain=1): """Xavier initialization: weights initialization that tries to make variance of outputs of a layer equal to variance of its inputs. """ for p in m....
PostGCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): """ adapted from : https://github.com/tkipf/gcn/blob/92600c39797c2bfb61a508e52b88fb554df30177/gcn/layers.py#L132 """ def __init__(self, in_features, out_features, bias=True, node...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn from torch.nn.parameter import Parameter asser...
Droliven/MSRGCN
PostGCN
false
8,018
[ "MIT" ]
28
5d8d8e3365d3b23ca2ac734ace7e84135a6e3a9e
https://github.com/Droliven/MSRGCN/tree/5d8d8e3365d3b23ca2ac734ace7e84135a6e3a9e
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): """ adapted from : https://github.com/tkipf/gcn/blob/92600c39797c2bfb61a508e52b88fb554df30177/gcn/layers.py#L132 """ def __init__(self, in_features, out_features, bias=True, node...
DiscountBlackLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data import torch.random import torch.nn.functional as F class DiscountBlackLoss(nn.Module): def __init__(self): super().__init__() def forward(self, source, target): """ Ignores pixels with all channels set to zero Proba...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch.random assert_size_stride = to...
DuaneNielsen/keypoints
DiscountBlackLoss
false
8,019
[ "MIT" ]
42
302fa02966d4372ac9b5aaa3d8dc24684be0b252
https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252
import torch import torch.nn as nn import torch.utils.data import torch.random import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, source, target): """ Ignores pixels with all channels set to zero Probably Not suit...
EqualConv2dSame
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn import torch.nn.functional as F class EqualConv2dSame(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...
Dolorousrtur/style-people
EqualConv2dSame
false
8,020
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
import math import torch from torch import nn import torch.nn.functional as F 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, ke...
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 import nn import torch.nn.functional as F 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): @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.autograd import Function import math from torch import nn assert_size...
Dolorousrtur/style-people
EqualLinear
false
8,021
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F 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): @s...
ModulatedSiren2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import nn import torch.nn.functional as F 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): @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.triton_helpers import libdevice from torch.autograd...
Dolorousrtur/style-people
ModulatedSiren2d
false
8,022
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F 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): @s...
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 math import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, in_features, out_features, dropout, bias=False): super(Linear, self).__init__() self.dropout = dropout self.in_features = in_features self.out_features = 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....
DongHande/PT_propagation_then_training
MLP
false
8,023
[ "MIT" ]
21
3f346ff161d2a0b807e3c0269ad26a7266305cc3
https://github.com/DongHande/PT_propagation_then_training/tree/3f346ff161d2a0b807e3c0269ad26a7266305cc3
import math import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, in_features, out_features, dropout, bias=False): super().__init__() self.dropout = dropout self.in_features = in_features self.out_features = out_features ...
SEModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class FastAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastAvgPool2d, self).__init__() self.flatten = flatten def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torchvision import datas...
Alibaba-MIIL/ZS_SDL
SEModule
false
8,024
[ "MIT" ]
20
769fe4f57d2d458a7c4b5468a6395c9b296b1dad
https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class FastAvgPool2d(nn.Module): def __init__(self, flatten=False): super().__init__() self.flatten = flatten def forward(self, x): ...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F from functools import partial class FFN(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super(FFN, self).__init__() self.dropout_rate = dropout_rate self.fc1 = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DocYard-ai/UCR
Encoder
false
8,025
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn import torch.nn.functional as F from functools import partial class FFN(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super().__init__() self.dropout_rate = dropout_rate self.fc1 = nn.Linear(i...
EncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F from functools import partial class FFN(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super(FFN, self).__init__() self.dropout_rate = dropout_rate self.fc1 = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DocYard-ai/UCR
EncoderLayer
false
8,026
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn import torch.nn.functional as F from functools import partial class FFN(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super().__init__() self.dropout_rate = dropout_rate self.fc1 = nn.Linear(i...
SpatialLogSoftmax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.random import torch.nn.functional as F def logprob_to_keypoints(prob, length): ruler = torch.log(torch.linspace(0, 1, length, device=prob.device) ).type_as(prob).expand(1, 1, -1) return torch.sum(torch.exp(prob + ruler), dim=2, keepdim=True).squeeze(2)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
DuaneNielsen/keypoints
SpatialLogSoftmax
false
8,027
[ "MIT" ]
42
302fa02966d4372ac9b5aaa3d8dc24684be0b252
https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252
import torch import torch.utils.data import torch.random import torch.nn.functional as F def logprob_to_keypoints(prob, length): ruler = torch.log(torch.linspace(0, 1, length, device=prob.device) ).type_as(prob).expand(1, 1, -1) return torch.sum(torch.exp(prob + ruler), dim=2, keepdim=True).squeeze(2)...
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 import nn import torch.nn.functional as F class EqualConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, replicate_pad=False): super().__init__() self.weight = nn.Parameter(torch.randn(out_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...
Dolorousrtur/style-people
EqualConv2d
false
8,028
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
import math import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, replicate_pad=False): super().__init__() self.weight = nn.Parameter(torch.randn(out_channel, in_ch...
AdaptiveAvgMaxPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data.distributed def adaptive_avgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_poo...
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 torchvision import datasets as datasets import torch.nn as nn import torch.nn.functi...
Alibaba-MIIL/ZS_SDL
AdaptiveAvgMaxPool2d
false
8,029
[ "MIT" ]
20
769fe4f57d2d458a7c4b5468a6395c9b296b1dad
https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data.distributed def adaptive_avgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_poo...
ClsHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class ClsHead(nn.Module): """ Class orientation Args: params(dict): super parameters for build Class network """ def __init__(self, in_channels, class_dim, **kwargs): super(ClsHead, self).__init__() self.p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DocYard-ai/UCR
ClsHead
false
8,030
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ Class orientation Args: params(dict): super parameters for build Class network """ def __init__(self, in_channels, class_dim, **kwargs): super().__init__() self.pool = nn.Adapti...
AdaIn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F 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): @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.triton_helpers import libdevice from torch.autograd...
Dolorousrtur/style-people
AdaIn
false
8,031
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F 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): @s...
SpatialSoftmax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.random import torch.nn.functional as F def marginal_softmax(heatmap, dim): marginal = torch.mean(heatmap, dim=dim) sm = F.softmax(marginal, dim=2) return sm def prob_to_keypoints(prob, length): ruler = torch.linspace(0, 1, length).type_as(prob).expan...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
DuaneNielsen/keypoints
SpatialSoftmax
false
8,032
[ "MIT" ]
42
302fa02966d4372ac9b5aaa3d8dc24684be0b252
https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252
import torch import torch.utils.data import torch.random import torch.nn.functional as F def marginal_softmax(heatmap, dim): marginal = torch.mean(heatmap, dim=dim) sm = F.softmax(marginal, dim=2) return sm def prob_to_keypoints(prob, length): ruler = torch.linspace(0, 1, length).type_as(prob).expan...
GRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.checkpoint class GRUCell(nn.Module): def __init__(self, x_dim, h_dim): super(GRUCell, self).__init__() self.r = nn.Linear(x_dim + h_dim, h_dim, True) self.z = nn.Linear(x_dim + h_dim, h_dim, True) self.c = nn.Linear(x_dim, h_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
DeepLearnXMU/IRSEG
GRUCell
false
8,033
[ "Apache-2.0" ]
14
6027c9601dbcb626d4adaf429c4bed07febb1034
https://github.com/DeepLearnXMU/IRSEG/tree/6027c9601dbcb626d4adaf429c4bed07febb1034
import torch import torch.nn as nn import torch.utils.checkpoint class Model(nn.Module): def __init__(self, x_dim, h_dim): super().__init__() self.r = nn.Linear(x_dim + h_dim, h_dim, True) self.z = nn.Linear(x_dim + h_dim, h_dim, True) self.c = nn.Linear(x_dim, h_dim, True) ...
GroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 GroupNorm(nn.Module): def __init__(self, c_num, group_num=16, eps=1e-10): """ The groupnorm layer from https://arxiv.org/abs/1803.08494 Args: c_num (int): Number of input channels group_num (int): Number of group by which to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
EKami/EzeeML
GroupNorm
false
8,034
[ "MIT" ]
35
21753a0ede7cc1dc675a2dcd09b6306cea2cad56
https://github.com/EKami/EzeeML/tree/21753a0ede7cc1dc675a2dcd09b6306cea2cad56
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, c_num, group_num=16, eps=1e-10): """ The groupnorm layer from https://arxiv.org/abs/1803.08494 Args: c_num (int): Number of input channels group_num (int): Number of group by which to div...
CTCHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CTCHead(nn.Module): def __init__(self, in_channels, out_channels, fc_decay=0.0004, **kwargs): super(CTCHead, self).__init__() self.fc = nn.Linear(in_channels, out_channels) self.softmax = nn.Softmax(dim=2) self.out_channels = out_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DocYard-ai/UCR
CTCHead
false
8,035
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
import torch from torch import nn class Model(nn.Module): def __init__(self, in_channels, out_channels, fc_decay=0.0004, **kwargs): super().__init__() self.fc = nn.Linear(in_channels, out_channels) self.softmax = nn.Softmax(dim=2) self.out_channels = out_channels def forward(...
FlowfieldDiscountedLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data import torch.random import torch.nn.functional as F class FlowfieldDiscountedLoss(nn.Module): def __init__(self): super().__init__() def forward(self, source, target, flowfield): loss = F.mse_loss(source, target, reduction='none') ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch.random assert_size_stride = to...
DuaneNielsen/keypoints
FlowfieldDiscountedLoss
false
8,036
[ "MIT" ]
42
302fa02966d4372ac9b5aaa3d8dc24684be0b252
https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252
import torch import torch.nn as nn import torch.utils.data import torch.random import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, source, target, flowfield): loss = F.mse_loss(source, target, reduction='none') bad_bits = f...
Coords
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data import torch.random class Coords(nn.Module): def __init__(self): super().__init__() def forward(self, x): """ adds 2 channels that carry co-ordinate information """ b, h, w = x.size(0), x.size(2), x.size(3) hm = torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.random assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_stri...
DuaneNielsen/keypoints
Coords
false
8,037
[ "MIT" ]
42
302fa02966d4372ac9b5aaa3d8dc24684be0b252
https://github.com/DuaneNielsen/keypoints/tree/302fa02966d4372ac9b5aaa3d8dc24684be0b252
import torch import torch.nn as nn import torch.utils.data import torch.random class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): """ adds 2 channels that carry co-ordinate information """ b, h, w = x.size(0), x.size(2), x.size(3) hm = torch....
ContrastiveLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F class ContrastiveLoss(nn.Module): """ Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise """ def __init__(self, margin): super(Contrast...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
EmmaW8/EISNet
ContrastiveLoss
false
8,038
[ "MIT" ]
40
97c420d6763c5f825e88ed732edee4e75f3b947e
https://github.com/EmmaW8/EISNet/tree/97c420d6763c5f825e88ed732edee4e75f3b947e
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """ Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise """ def __init__(self, margin): super().__init__() ...
GlobalAveragePool
# 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 GlobalAveragePool(nn.Module): """ Average pooling in an equivariant network """ def __init__(self): """ """ super().__init__() def forward(self, x): """ """ avg = torch.mean(x, dim=[-2, -1], keepdim=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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
ElisevanderPol/symmetrizer
GlobalAveragePool
false
8,039
[ "MIT" ]
16
8dae02bee2ba7132ae4fb07e07020767d280842c
https://github.com/ElisevanderPol/symmetrizer/tree/8dae02bee2ba7132ae4fb07e07020767d280842c
import torch from torch import nn class Model(nn.Module): """ Average pooling in an equivariant network """ def __init__(self): """ """ super().__init__() def forward(self, x): """ """ avg = torch.mean(x, dim=[-2, -1], keepdim=True) return ...
TripletLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F class TripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin): super(TripletLoss, self).__init__() self.margin = ma...
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...
EmmaW8/EISNet
TripletLoss
false
8,040
[ "MIT" ]
40
97c420d6763c5f825e88ed732edee4e75f3b947e
https://github.com/EmmaW8/EISNet/tree/97c420d6763c5f825e88ed732edee4e75f3b947e
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin): super().__init__() self.margin = margin def forward(s...
AdaptiveCatAvgMaxPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data.distributed def adaptive_catavgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torchvision import datasets as datasets import torch.nn as nn import torch.nn.functi...
Alibaba-MIIL/ZS_SDL
AdaptiveCatAvgMaxPool2d
false
8,041
[ "MIT" ]
20
769fe4f57d2d458a7c4b5468a6395c9b296b1dad
https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data.distributed def adaptive_catavgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, gamma=2): super().__init__() self.gamma = gamma def forward(self, logit, target): target = target.float() max_val = (-logit).clamp(min=0) loss = logit - l...
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...
EMUNES/Auto-Subtitle-File-Generation
FocalLoss
false
8,042
[ "Apache-2.0" ]
33
535a6351f450b1970da50bbbf4cc6d2f442ec335
https://github.com/EMUNES/Auto-Subtitle-File-Generation/tree/535a6351f450b1970da50bbbf4cc6d2f442ec335
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, gamma=2): super().__init__() self.gamma = gamma def forward(self, logit, target): target = target.float() max_val = (-logit).clamp(min=0) loss = logit - logit...
Conv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, NL ='relu', same_padding=False, bn=False, dilation=1): super(Conv2d, self).__init__() padding = int((kernel_size - 1) / 2) if same_padding else 0 self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Elin24/DCL-CrowdCounting
Conv2d
false
8,043
[ "MIT" ]
12
2f8e68a2d29a8599e795b502f21b4de778e6214c
https://github.com/Elin24/DCL-CrowdCounting/tree/2f8e68a2d29a8599e795b502f21b4de778e6214c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, NL ='relu', same_padding=False, bn=False, dilation=1): super().__init__() padding = int((kernel_size - 1) / 2) if same_padding else 0 self.conv = [] ...
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...
Dolorousrtur/style-people
NoiseInjection
false
8,044
[ "MIT" ]
15
c48b12b245cc50f8230c0654dffe40016f2a69f1
https://github.com/Dolorousrtur/style-people/tree/c48b12b245cc50f8230c0654dffe40016f2a69f1
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...
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): super(DiceLoss, self).__init__() pass def forward(self, input, target): input = input.contiguous().view(input.size()[0], -1) target = target.contiguous().view(target.size()[0], -1).float() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
EryiXie/PlaneRecNet
DiceLoss
false
8,045
[ "MIT" ]
34
534e23e6c5db2235ab1e5a9419fb4bfec3ffa943
https://github.com/EryiXie/PlaneRecNet/tree/534e23e6c5db2235ab1e5a9419fb4bfec3ffa943
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() pass def forward(self, input, target): input = input.contiguous().view(input.size()[0], -1) target = target.contiguous().view(target.size()[0], -1).float() a = torch.sum(...