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
GlobalpoolFC
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 GlobalpoolFC(nn.Module): def __init__(self, num_in, num_class): super(GlobalpoolFC, self).__init__() self.pool = nn.AdaptiveAvgPool2d(output_size=1) self.fc = nn.Linear(num_in, num_class) def forward(self, x): rep = self.pool(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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
blackcow/Fair-AT
GlobalpoolFC
false
1,550
[ "Apache-2.0" ]
0
62fc269fedd4b63c4b48ae390d494b3832e65fa8
https://github.com/blackcow/Fair-AT/tree/62fc269fedd4b63c4b48ae390d494b3832e65fa8
import torch from torch import nn class Model(nn.Module): def __init__(self, num_in, num_class): super().__init__() self.pool = nn.AdaptiveAvgPool2d(output_size=1) self.fc = nn.Linear(num_in, num_class) def forward(self, x): rep = self.pool(x) y = rep.reshape(rep.shap...
FairLoss
# 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 FairLoss(nn.Module): def __init__(self, lamda): super(FairLoss, self).__init__() self.lamda = lamda def forward(self, rep): logits = torch.mm(rep, torch.transpose(rep, 0, 1)) logits = logits - torch.diag_embed(torch.diag(logits)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
blackcow/Fair-AT
FairLoss
false
1,551
[ "Apache-2.0" ]
0
62fc269fedd4b63c4b48ae390d494b3832e65fa8
https://github.com/blackcow/Fair-AT/tree/62fc269fedd4b63c4b48ae390d494b3832e65fa8
import torch from torch import nn class Model(nn.Module): def __init__(self, lamda): super().__init__() self.lamda = lamda def forward(self, rep): logits = torch.mm(rep, torch.transpose(rep, 0, 1)) logits = logits - torch.diag_embed(torch.diag(logits)) logits = logits...
MockOpposite
# 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 MockOpposite(nn.Module): def __init__(self): """Initialize the model""" super(MockOpposite, self).__init__() def forward(self, input): """A single forward pass of the model. Returns input - 1. Args: input: The input to the...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
blagojce95/ai-research-mamo-framework
MockOpposite
false
1,552
[ "Apache-2.0" ]
0
7f3b5a5a9fb8b19c9eef453b81b03b6046a33bf2
https://github.com/blagojce95/ai-research-mamo-framework/tree/7f3b5a5a9fb8b19c9eef453b81b03b6046a33bf2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): """Initialize the model""" super().__init__() def forward(self, input): """A single forward pass of the model. Returns input - 1. Args: input: The input to the model as a tensor of ...
PatchMerging
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt from torch import optim as optim class PatchMerging(nn.Module): """Patch Merging Layer. Args: input_resolution (tuple[int]): Resolution of input feature. dim (int): Number of input channels. norm_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
billpsomas/ibot
PatchMerging
false
1,553
[ "Apache-2.0" ]
0
c6fbce7e2a59780f39ad7304ed9a8b1acf038d2d
https://github.com/billpsomas/ibot/tree/c6fbce7e2a59780f39ad7304ed9a8b1acf038d2d
import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt from torch import optim as optim class Model(nn.Module): """Patch Merging Layer. Args: input_resolution (tuple[int]): Resolution of input feature. dim (int): Number of input channels. norm_layer (...
MyModel
# 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 MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() def forward(self, x): return x + 1 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...
blagojce95/ai-research-mamo-framework
MyModel
false
1,554
[ "Apache-2.0" ]
0
7f3b5a5a9fb8b19c9eef453b81b03b6046a33bf2
https://github.com/blagojce95/ai-research-mamo-framework/tree/7f3b5a5a9fb8b19c9eef453b81b03b6046a33bf2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x + 1 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GreedyTop1
# 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 typing import Optional import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors class GreedyTop1(pt.nn.Module): """ Implements picking the highest scoring next word with support for vocabulary selection and target factors. """ def forward(s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors assert_size_stride = torch._C._dynamo.gu...
blchu/sockeye
GreedyTop1
false
1,555
[ "Apache-2.0" ]
0
28044a44ee409c9b3df1711c0b16bdebdd463b2e
https://github.com/blchu/sockeye/tree/28044a44ee409c9b3df1711c0b16bdebdd463b2e
import torch from typing import Optional import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors class Model(pt.nn.Module): """ Implements picking the highest scoring next word with support for vocabulary selection and target factors. """ def forward(self, ...
PyTorchLHUC
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors class PyTorchLHUC(pt.nn.Module): """ Learning Hidden Unit Contribution David Vilar. "Learning Hidden Unit Contribution for Adapting Neural Machine Translation Models" NAACL 2018 :para...
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 as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors assert_size_stride = torch._C._dynamo.gu...
blchu/sockeye
PyTorchLHUC
false
1,556
[ "Apache-2.0" ]
0
28044a44ee409c9b3df1711c0b16bdebdd463b2e
https://github.com/blchu/sockeye/tree/28044a44ee409c9b3df1711c0b16bdebdd463b2e
import torch import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors class Model(pt.nn.Module): """ Learning Hidden Unit Contribution David Vilar. "Learning Hidden Unit Contribution for Adapting Neural Machine Translation Models" NAACL 2018 :param num_...
SE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 itertools import chain as chain import torch.utils.data import torch.nn as nn class SwishEfficient(torch.autograd.Function): """Swish activation function: x * sigmoid(x).""" @staticmethod def forward(ctx, x): result = x * torch.sigmoid(x) ctx.save_for_backward(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 itertools import chain a...
billcai/SlowFast
SE
false
1,557
[ "Apache-2.0" ]
0
778888e63351e55861801996b37c7ff9a3746587
https://github.com/billcai/SlowFast/tree/778888e63351e55861801996b37c7ff9a3746587
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class SwishEfficient(torch.autograd.Function): """Swish activation function: x * sigmoid(x).""" @staticmethod def forward(ctx, x): result = x * torch.sigmoid(x) ctx.save_for_backward(x) ...
SimpleNormLayer
# 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 SimpleNormLayer(nn.Module): """Simple normalization layer that divides the output of a preceding layer by a specified number Parameters ---------- normalization_strength: float The number with which input is normalized/dived by """ def __i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
bokutotu/cgnet
SimpleNormLayer
false
1,558
[ "BSD-3-Clause" ]
0
a35170001d969d51548dd01522b1ab93e43741b4
https://github.com/bokutotu/cgnet/tree/a35170001d969d51548dd01522b1ab93e43741b4
import torch import torch.nn as nn class Model(nn.Module): """Simple normalization layer that divides the output of a preceding layer by a specified number Parameters ---------- normalization_strength: float The number with which input is normalized/dived by """ def __init__(self...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, feature_num): super(Net, self).__init__() self.layer_1 = nn.Linear(feature_num, 500) self.layer_2 = nn.Linear(500, 20) def forward(self, x): x = F.relu(self.layer_1(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_...
bm2-lab/MDML
Net
false
1,559
[ "MIT" ]
0
222fb22b2ee53dd3c1a6f2e99a88f71e9635e3a0
https://github.com/bm2-lab/MDML/tree/222fb22b2ee53dd3c1a6f2e99a88f71e9635e3a0
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, feature_num): super().__init__() self.layer_1 = nn.Linear(feature_num, 500) self.layer_2 = nn.Linear(500, 20) def forward(self, x): x = F.relu(self.layer_1(x)) ...
PyTorchSSRU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from typing import Tuple from abc import abstractmethod import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors class AutoregressiveLayer(pt.nn.Module): @property @abstractmethod def num_state_tensors(self) ->int: """ Number of state tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from typing import Tuple from...
blchu/sockeye
PyTorchSSRU
false
1,560
[ "Apache-2.0" ]
0
28044a44ee409c9b3df1711c0b16bdebdd463b2e
https://github.com/blchu/sockeye/tree/28044a44ee409c9b3df1711c0b16bdebdd463b2e
import torch from typing import Tuple from abc import abstractmethod import torch as pt import torch.distributed import torch.distributed.elastic.multiprocessing.errors class AutoregressiveLayer(pt.nn.Module): @property @abstractmethod def num_state_tensors(self) ->int: """ Number of state tensor...
ShiftedSoftplus
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class ShiftedSoftplus(nn.Module): """ Shifted softplus (SSP) activation function SSP originates from the softplus function: y = \\ln\\left(1 + e^{-x}\\right) Schütt et al. (2018) introduced a shifting factor to the function in order to e...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
bokutotu/cgnet
ShiftedSoftplus
false
1,561
[ "BSD-3-Clause" ]
0
a35170001d969d51548dd01522b1ab93e43741b4
https://github.com/bokutotu/cgnet/tree/a35170001d969d51548dd01522b1ab93e43741b4
import torch import numpy as np import torch.nn as nn class Model(nn.Module): """ Shifted softplus (SSP) activation function SSP originates from the softplus function: y = \\ln\\left(1 + e^{-x}\\right) Schütt et al. (2018) introduced a shifting factor to the function in order to ensure that...
PatchEmbed
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 itertools import chain as chain import torch.utils.data import torch.nn as nn class PatchEmbed(nn.Module): """ PatchEmbed. """ def __init__(self, dim_in=3, dim_out=768, kernel=(1, 16, 16), stride=(1, 4, 4), padding=(1, 7, 7), conv_2d=False): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from itertools import chain as chain import torch.utils.data import torch.nn as ...
billcai/SlowFast
PatchEmbed
false
1,562
[ "Apache-2.0" ]
0
778888e63351e55861801996b37c7ff9a3746587
https://github.com/billcai/SlowFast/tree/778888e63351e55861801996b37c7ff9a3746587
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class Model(nn.Module): """ PatchEmbed. """ def __init__(self, dim_in=3, dim_out=768, kernel=(1, 16, 16), stride=(1, 4, 4), padding=(1, 7, 7), conv_2d=False): super().__init__() if ...
NeighborNormLayer
# 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 NeighborNormLayer(nn.Module): """Normalization layer that divides the output of a preceding layer by the number of neighbor features. Unlike the SimpleNormLayer, this layer allows for dynamically changing number of neighbors during training. """ def __...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
bokutotu/cgnet
NeighborNormLayer
false
1,563
[ "BSD-3-Clause" ]
0
a35170001d969d51548dd01522b1ab93e43741b4
https://github.com/bokutotu/cgnet/tree/a35170001d969d51548dd01522b1ab93e43741b4
import torch import torch.nn as nn class Model(nn.Module): """Normalization layer that divides the output of a preceding layer by the number of neighbor features. Unlike the SimpleNormLayer, this layer allows for dynamically changing number of neighbors during training. """ def __init__(self)...
MultiheadSimilarity
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn class MultiheadSimilarity(nn.Module): def __init__(self, d_model, num_head, seq_len, in_proj=True): super().__init__() self.num_head = num_head self.seq_len = seq_len self.d_head = d_model // num_head self.in_proj =...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import nn assert_size_stride = torch._C._dyna...
bladewaltz1/clipvid-tmp
MultiheadSimilarity
false
1,564
[ "MIT" ]
0
8a4a990c318fdfbf6dac443abd3bc16637abba3d
https://github.com/bladewaltz1/clipvid-tmp/tree/8a4a990c318fdfbf6dac443abd3bc16637abba3d
import torch import torch.utils.data from torch import nn class Model(nn.Module): def __init__(self, d_model, num_head, seq_len, in_proj=True): super().__init__() self.num_head = num_head self.seq_len = seq_len self.d_head = d_model // num_head self.in_proj = in_proj ...
ResidualBlock
# 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 ResidualBlock(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.in_channels, self.out_channels = in_channels, out_channels self.blocks = nn.Identity() self.shortcut = nn.Identity() self.should_apply_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_poi_fused_add_0(in_ptr0, out_p...
boxiXia/pytorch_sac
ResidualBlock
false
1,565
[ "MIT" ]
0
ad570845c482498769217b398c22fafaff2ff2f1
https://github.com/boxiXia/pytorch_sac/tree/ad570845c482498769217b398c22fafaff2ff2f1
import torch from torch import nn class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.in_channels, self.out_channels = in_channels, out_channels self.blocks = nn.Identity() self.shortcut = nn.Identity() self.should_apply_shortcut ...
ChannelAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ChannelAttention(nn.Module): def __init__(self, in_planes=96, ratio=16): super(ChannelAttention, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.max_pool = nn.AdaptiveMaxPool2d(1) self.fc1 = nn.Conv2d(in_planes, in_planes // r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
biolee3/SAMDNet
ChannelAttention
false
1,566
[ "MIT" ]
0
9a0d70f976e22d512046b4aa5727dd26422d0aff
https://github.com/biolee3/SAMDNet/tree/9a0d70f976e22d512046b4aa5727dd26422d0aff
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_planes=96, ratio=16): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.max_pool = nn.AdaptiveMaxPool2d(1) self.fc1 = nn.Conv2d(in_planes, in_planes // ratio, 1, bias=False) self...
MiniBatchStddevLayer
# 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.distributed as dist import torch.autograd as autograd import torch.utils.cpp_extension class AllGatherLayer(autograd.Function): """All gather layer with backward propagation path. Indeed, this module is to make ``dist.all_gather()`` in the backward graph. S...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.distributed as dist import torch.autograd as...
bladesaber/mmgeneration
MiniBatchStddevLayer
false
1,567
[ "Apache-2.0" ]
0
158b49f7efd8028f231f6e9ca758ae0e20dd72ae
https://github.com/bladesaber/mmgeneration/tree/158b49f7efd8028f231f6e9ca758ae0e20dd72ae
import torch import torch.nn as nn import torch.distributed as dist import torch.autograd as autograd import torch.utils.cpp_extension class AllGatherLayer(autograd.Function): """All gather layer with backward propagation path. Indeed, this module is to make ``dist.all_gather()`` in the backward graph. S...
SigmoidFocalLoss
# 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 def sigmoid_focal_loss(inputs: 'torch.Tensor', targets: 'torch.Tensor', alpha: 'float'=-1, gamma: 'float'=2, reduction: 'str'='none' ) ->torch.Tensor: """ Loss used in RetinaNet for dense detection: https://arxiv.org/abs/1708.0200...
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...
botkop/lark
SigmoidFocalLoss
false
1,568
[ "Apache-2.0" ]
0
edb2defdb514213fc121418578b0d9006a55f3a0
https://github.com/botkop/lark/tree/edb2defdb514213fc121418578b0d9006a55f3a0
import torch import torch.nn as nn from torch.nn import functional as F def sigmoid_focal_loss(inputs: 'torch.Tensor', targets: 'torch.Tensor', alpha: 'float'=-1, gamma: 'float'=2, reduction: 'str'='none' ) ->torch.Tensor: """ Loss used in RetinaNet for dense detection: https://arxiv.org/abs/1708.0200...
LSTM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LSTM(nn.Module): def __init__(self, seq_length, input_dim, num_hidden, num_classes, batch_size, device='cpu'): super(LSTM, self).__init__() self.seq_length = seq_length self.h_init = nn.Parameter(torch.zeros(num_hidden, 1), requ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
askliar/deep_learning
LSTM
false
1,569
[ "MIT" ]
0
e61b2391a3258d18719bf12d9ed1404620ce6c02
https://github.com/askliar/deep_learning/tree/e61b2391a3258d18719bf12d9ed1404620ce6c02
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, seq_length, input_dim, num_hidden, num_classes, batch_size, device='cpu'): super().__init__() self.seq_length = seq_length self.h_init = nn.Parameter(torch.zeros(num_hidden, 1), requires_grad...
PatchEmbed
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch import optim as optim class PatchEmbed(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch import optim as optim assert_size_stride = torc...
billpsomas/ibot
PatchEmbed
false
1,570
[ "Apache-2.0" ]
0
c6fbce7e2a59780f39ad7304ed9a8b1acf038d2d
https://github.com/billpsomas/ibot/tree/c6fbce7e2a59780f39ad7304ed9a8b1acf038d2d
import torch import torch.nn as nn from torch import optim as optim class Model(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) ...
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, alpha: 'float'=0.25, gamma: 'float'=2.0, reduction: 'str'='mean'): super().__init__() self.bce = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha self.gamma = gamma if reduct...
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...
botkop/lark
FocalLoss
false
1,571
[ "Apache-2.0" ]
0
edb2defdb514213fc121418578b0d9006a55f3a0
https://github.com/botkop/lark/tree/edb2defdb514213fc121418578b0d9006a55f3a0
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, alpha: 'float'=0.25, gamma: 'float'=2.0, reduction: 'str'='mean'): super().__init__() self.bce = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha self.gamma = gamma if reduction ...
SReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SReLU(nn.Module): """Shifted ReLU""" def __init__(self, nc): super(SReLU, self).__init__() self.srelu_bias = nn.Parameter(torch.Tensor(1, nc, 1, 1)) self.srelu_relu = nn.ReLU(inplace=True) nn.init.constant_(self.srelu_bias, -1.0) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
bpicnbnk/ISONet
SReLU
false
1,572
[ "MIT" ]
0
993150fa215dbc92460142ade59a3a5ec4a0efd9
https://github.com/bpicnbnk/ISONet/tree/993150fa215dbc92460142ade59a3a5ec4a0efd9
import torch import torch.nn as nn class Model(nn.Module): """Shifted ReLU""" def __init__(self, nc): super().__init__() self.srelu_bias = nn.Parameter(torch.Tensor(1, nc, 1, 1)) self.srelu_relu = nn.ReLU(inplace=True) nn.init.constant_(self.srelu_bias, -1.0) def forward(...
AdaptiveInstanceNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.init import _calculate_correct_fan import torch.utils.cpp_extension def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in', lr_mul=1.0): """Equalized Learning Rate. This trick is proposed in: Progressive Growing of GANs for Improved Quali...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bladesaber/mmgeneration
AdaptiveInstanceNorm
false
1,573
[ "Apache-2.0" ]
0
158b49f7efd8028f231f6e9ca758ae0e20dd72ae
https://github.com/bladesaber/mmgeneration/tree/158b49f7efd8028f231f6e9ca758ae0e20dd72ae
import torch import torch.nn as nn from torch.nn.init import _calculate_correct_fan import torch.utils.cpp_extension def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in', lr_mul=1.0): """Equalized Learning Rate. This trick is proposed in: Progressive Growing of GANs for Improved Quali...
PANNsLoss
# 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 PANNsLoss(nn.Module): def __init__(self): super().__init__() @staticmethod def stabilize_input(cwo): cwo = torch.where(torch.isnan(cwo), torch.zeros_like(cwo), cwo) cwo = torch.where(torch.isinf(cwo), t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
botkop/lark
PANNsLoss
false
1,574
[ "Apache-2.0" ]
0
edb2defdb514213fc121418578b0d9006a55f3a0
https://github.com/botkop/lark/tree/edb2defdb514213fc121418578b0d9006a55f3a0
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self): super().__init__() @staticmethod def stabilize_input(cwo): cwo = torch.where(torch.isnan(cwo), torch.zeros_like(cwo), cwo) cwo = torch.where(torch.isinf(cwo), torch...
SigmoidFocalLossStar
# 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 def sigmoid_focal_loss_star(inputs: 'torch.Tensor', targets: 'torch.Tensor', alpha: 'float'=-1, gamma: 'float'=1, reduction: 'str'='none' ) ->torch.Tensor: """ FL* described in RetinaNet paper Appendix: https://arxiv.org/abs/1708....
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...
botkop/lark
SigmoidFocalLossStar
false
1,575
[ "Apache-2.0" ]
0
edb2defdb514213fc121418578b0d9006a55f3a0
https://github.com/botkop/lark/tree/edb2defdb514213fc121418578b0d9006a55f3a0
import torch import torch.nn as nn from torch.nn import functional as F def sigmoid_focal_loss_star(inputs: 'torch.Tensor', targets: 'torch.Tensor', alpha: 'float'=-1, gamma: 'float'=1, reduction: 'str'='none' ) ->torch.Tensor: """ FL* described in RetinaNet paper Appendix: https://arxiv.org/abs/1708....
ModMBStddevLayer
# 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.distributed as dist import torch.autograd as autograd import torch.utils.cpp_extension class AllGatherLayer(autograd.Function): """All gather layer with backward propagation path. Indeed, this module is to make ``dist.all_gather()`` in the backward graph. S...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.distributed as dist import torch.autograd as...
bladesaber/mmgeneration
ModMBStddevLayer
false
1,576
[ "Apache-2.0" ]
0
158b49f7efd8028f231f6e9ca758ae0e20dd72ae
https://github.com/bladesaber/mmgeneration/tree/158b49f7efd8028f231f6e9ca758ae0e20dd72ae
import torch import torch.nn as nn import torch.distributed as dist import torch.autograd as autograd import torch.utils.cpp_extension class AllGatherLayer(autograd.Function): """All gather layer with backward propagation path. Indeed, this module is to make ``dist.all_gather()`` in the backward graph. S...
CriticArchitecture
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from abc import ABC import torch.nn.functional as F from torch import nn from torch.nn import init def fan_in_init(tensor): fan_in = tensor.size(1) v = 1.0 / np.sqrt(fan_in) init.uniform_(tensor, -v, v) class Architecture(nn.Module, ABC): def __init__(self): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np from abc i...
bootml/agent
CriticArchitecture
false
1,577
[ "Apache-2.0" ]
0
84235db931d6e4ef956962961c619994898ebdd5
https://github.com/bootml/agent/tree/84235db931d6e4ef956962961c619994898ebdd5
import torch import numpy as np from abc import ABC import torch.nn.functional as F from torch import nn from torch.nn import init def fan_in_init(tensor): fan_in = tensor.size(1) v = 1.0 / np.sqrt(fan_in) init.uniform_(tensor, -v, v) class Architecture(nn.Module, ABC): def __init__(self): ...
SelfGating
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch as th import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class SelfGating(nn.Module): def __init__(self, input_dim): super(SelfGating, self).__init__() self.fc = nn.Linear(input_dim, input_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch.nn.parallel import to...
bryant1410/MIL-NCE_HowTo100M
SelfGating
false
1,578
[ "Apache-2.0" ]
0
9ba876bd67160e24a5ce379a07d18a8036be0d36
https://github.com/bryant1410/MIL-NCE_HowTo100M/tree/9ba876bd67160e24a5ce379a07d18a8036be0d36
import torch import torch.utils.data import torch as th import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def __init__(self, input_dim): super().__init__() self.fc = nn.Linear(input_dim, input_dim) def forward(self, ...
LearnedPositionalEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LearnedPositionalEmbedding(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting based on padding_idx or by setting padding_idx to None and ensuring t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
boxiangliu/esm
LearnedPositionalEmbedding
false
1,579
[ "MIT" ]
0
3c143d99103e0ea38a9455f30a73cd9c87376606
https://github.com/boxiangliu/esm/tree/3c143d99103e0ea38a9455f30a73cd9c87376606
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting based on padding_idx or by setting padding_idx to None and ensuring that the appropriate ...
simple_mlp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class simple_mlp(nn.Module): def __init__(self, feature_dim, layer, hidden): super(simple_mlp, self).__init__() self.layer = layer self.linear1 = nn.Linear(feature_dim, hidden) if layer == 2: self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
broadinstitute/TCRP
simple_mlp
false
1,580
[ "MIT" ]
0
9e580dbf0c9d0ec5e5b1a949087df5a3724fa35b
https://github.com/broadinstitute/TCRP/tree/9e580dbf0c9d0ec5e5b1a949087df5a3724fa35b
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, feature_dim, layer, hidden): super().__init__() self.layer = layer self.linear1 = nn.Linear(feature_dim, hidden) if layer == 2: self.linear2 = nn.Linear(h...
MaskedInstanceNorm1d
# 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.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim class MaskedInstanceNorm1d(nn.Module): """Instance norm + masking.""" MAX_CNT = 100000.0 def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine: 'bool'=False): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.cuda from torch...
bugface/NeMo
MaskedInstanceNorm1d
false
1,581
[ "Apache-2.0" ]
0
431c561380a120e9e164a4c9deed8f1ca9acace5
https://github.com/bugface/NeMo/tree/431c561380a120e9e164a4c9deed8f1ca9acace5
import torch import torch.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim class Model(nn.Module): """Instance norm + masking.""" MAX_CNT = 100000.0 def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine: 'bool'=False): super().__in...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, d_model, eps=1e-12): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) self.eps = eps def forward(self, x): m...
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...
bsgiovanini/transformer
LayerNorm
false
1,582
[ "Apache-2.0" ]
0
e128fa862f1b3d17d7b92df169a2bbee3f08366f
https://github.com/bsgiovanini/transformer/tree/e128fa862f1b3d17d7b92df169a2bbee3f08366f
import torch from torch import nn class Model(nn.Module): def __init__(self, d_model, eps=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) self.eps = eps def forward(self, x): mean = x.mean(-1, ke...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class Actor(nn.Module): def __init__(self, s_dim, a_dim): super(Actor, self).__init__() self.forward1 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
brooky56/DeepRL-UR-motion-planning
Actor
false
1,583
[ "MIT" ]
0
0cc523da6d8a55896773f1f57feed1f0c77fea78
https://github.com/brooky56/DeepRL-UR-motion-planning/tree/0cc523da6d8a55896773f1f57feed1f0c77fea78
import torch import numpy as np import torch.nn as nn def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class Model(nn.Module): def __init__(self, s_dim, a_dim): super().__init__() self.forward1 = nn.Linear(...
ScaleDotProductAttention
# 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 class ScaleDotProductAttention(nn.Module): """ compute scale dot product attention Query : given sentence that we focused on (decoder) Key : every sentence to check relationship with Qeury(encoder) Value : every sentence same with Key (encoder) ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bsgiovanini/transformer
ScaleDotProductAttention
false
1,584
[ "Apache-2.0" ]
0
e128fa862f1b3d17d7b92df169a2bbee3f08366f
https://github.com/bsgiovanini/transformer/tree/e128fa862f1b3d17d7b92df169a2bbee3f08366f
import math import torch from torch import nn class Model(nn.Module): """ compute scale dot product attention Query : given sentence that we focused on (decoder) Key : every sentence to check relationship with Qeury(encoder) Value : every sentence same with Key (encoder) """ def __init__...
EqualLinearActModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from copy import deepcopy from functools import partial from torch.nn.init import _calculate_correct_fan import torch.utils.cpp_extension def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in', lr_mul=1.0): """Equalized Learning Rate. This trick is propose...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from copy import deepcopy from functools import partial fr...
bladesaber/mmgeneration
EqualLinearActModule
false
1,585
[ "Apache-2.0" ]
0
158b49f7efd8028f231f6e9ca758ae0e20dd72ae
https://github.com/bladesaber/mmgeneration/tree/158b49f7efd8028f231f6e9ca758ae0e20dd72ae
import torch import torch.nn as nn from copy import deepcopy from functools import partial from torch.nn.init import _calculate_correct_fan import torch.utils.cpp_extension def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in', lr_mul=1.0): """Equalized Learning Rate. This trick is propose...
NPairLoss
# 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 NPairLoss(torch.nn.Module): def __init__(self, l2=0.05): """ Basic N-Pair Loss as proposed in 'Improved Deep Metric Learning with Multi-class N-pair Loss Objective' Args: l2: float, weighting parameter for weight penality due to embeddings not being normaliz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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_s...
bm2-lab/MDML
NPairLoss
false
1,586
[ "MIT" ]
0
222fb22b2ee53dd3c1a6f2e99a88f71e9635e3a0
https://github.com/bm2-lab/MDML/tree/222fb22b2ee53dd3c1a6f2e99a88f71e9635e3a0
import torch class Model(torch.nn.Module): def __init__(self, l2=0.05): """ Basic N-Pair Loss as proposed in 'Improved Deep Metric Learning with Multi-class N-pair Loss Objective' Args: l2: float, weighting parameter for weight penality due to embeddings not being normalized. ...
FunctionalRelu6
# 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 FunctionalRelu6(torch.nn.Module): def forward(self, x): return torch.nn.functional.relu6(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
FunctionalRelu6
false
1,587
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x): return torch.nn.functional.relu6(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
MaxElementwise
# 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 MaxElementwise(torch.nn.Module): def forward(self, x, y): return torch.max(x, y) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
MaxElementwise
false
1,588
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x, y): return torch.max(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn class ScaleDotProductAttention(nn.Module): """ compute scale dot product attention Query : given sentence that we focused on (decoder) Key : every sentence to check relationship with Qeury(encoder) Value : every sentence same with Key (encoder) ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bsgiovanini/transformer
MultiHeadAttention
false
1,589
[ "Apache-2.0" ]
0
e128fa862f1b3d17d7b92df169a2bbee3f08366f
https://github.com/bsgiovanini/transformer/tree/e128fa862f1b3d17d7b92df169a2bbee3f08366f
import math import torch from torch import nn class ScaleDotProductAttention(nn.Module): """ compute scale dot product attention Query : given sentence that we focused on (decoder) Key : every sentence to check relationship with Qeury(encoder) Value : every sentence same with Key (encoder) ""...
WaveNetLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 typing as T class WaveNetLayer(torch.nn.Module): """a single gated residual wavenet layer""" def __init__(self, channels: 'int', kernel_size: 'int', dilation: 'int'): super().__init__() self._conv = torch.nn.Conv1d(in_channels=channels, out_channels= 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.triton_helpers import libdevice assert_size_stride ...
brentspell/hifi-gan-bwe
WaveNetLayer
false
1,590
[ "MIT" ]
0
63579ac8055c63fc0e5a20ae90e2a86575fc8e12
https://github.com/brentspell/hifi-gan-bwe/tree/63579ac8055c63fc0e5a20ae90e2a86575fc8e12
import torch import typing as T class Model(torch.nn.Module): """a single gated residual wavenet layer""" def __init__(self, channels: 'int', kernel_size: 'int', dilation: 'int'): super().__init__() self._conv = torch.nn.Conv1d(in_channels=channels, out_channels= channels, kernel_...
IDiv
# 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 IDiv(torch.nn.Module): def __init__(self): super(IDiv, self).__init__() def forward(self, x, y): x /= y return x 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_poi_fused_div_0(in_ptr0, in_ptr1, out_ptr1, xnumel,...
bunderhi/torch2trt
IDiv
false
1,591
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): x /= y return x def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Mul
# 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 Mul(torch.nn.Module): def __init__(self): super(Mul, self).__init__() def forward(self, x, y): return x * y 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
Mul
false
1,592
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return x * y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
EQ
# 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 EQ(torch.nn.Module): def __init__(self): super(EQ, self).__init__() def forward(self, x, y): return x == y 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
EQ
false
1,593
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return x == y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GT
# 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 GT(torch.nn.Module): def __init__(self): super(GT, self).__init__() def forward(self, x, y): return x > y 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
GT
false
1,594
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return x > y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RAddFloat
# 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 RAddFloat(torch.nn.Module): def __init__(self): super(RAddFloat, self).__init__() def forward(self, x): return 1.0 + x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RAddFloat
false
1,595
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 1.0 + x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
ISub
# 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 ISub(torch.nn.Module): def __init__(self): super(ISub, self).__init__() def forward(self, x, y): x -= y return x 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_poi_fused_sub_0(in_ptr0, in_ptr1, out_ptr1, xnumel,...
bunderhi/torch2trt
ISub
false
1,596
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): x -= y return x def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
IAdd
# 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 IAdd(torch.nn.Module): def __init__(self): super(IAdd, self).__init__() def forward(self, x, y): x += y return x 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_poi_fused_add_0(in_ptr0, in_ptr1, out_ptr1, xnumel,...
bunderhi/torch2trt
IAdd
false
1,597
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): x += y return x def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
MinElementwise
# 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 MinElementwise(torch.nn.Module): def forward(self, x, y): return torch.min(x, y) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
MinElementwise
false
1,598
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x, y): return torch.min(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
IMul
# 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 IMul(torch.nn.Module): def __init__(self): super(IMul, self).__init__() def forward(self, x, y): x *= y return x 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_poi_fused_mul_0(in_ptr0, in_ptr1, out_ptr1, xnumel,...
bunderhi/torch2trt
IMul
false
1,599
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): x *= y return x def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
LT
# 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 LT(torch.nn.Module): def __init__(self): super(LT, self).__init__() def forward(self, x, y): return x < y 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
LT
false
1,600
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return x < y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Pow
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class Pow(torch.nn.Module): def __init__(self): super(Pow, self).__init__() def forward(self, x, y): return x ** y 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.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
bunderhi/torch2trt
Pow
false
1,601
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return x ** y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RDivFloat
# 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 RDivFloat(torch.nn.Module): def __init__(self): super(RDivFloat, self).__init__() def forward(self, x): return 100.0 / x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RDivFloat
false
1,602
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 100.0 / x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TensorClamp
# 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 TensorClamp(torch.nn.Module): def forward(self, x): return x.clamp(-0.1, 0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
TensorClamp
false
1,603
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x): return x.clamp(-0.1, 0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RSubInt
# 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 RSubInt(torch.nn.Module): def __init__(self): super(RSubInt, self).__init__() def forward(self, x): return 1 - 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RSubInt
false
1,604
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 1 - x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RMulInt
# 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 RMulInt(torch.nn.Module): def __init__(self): super(RMulInt, self).__init__() def forward(self, x): return 10 * 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RMulInt
false
1,605
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 10 * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RMulFloat
# 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 RMulFloat(torch.nn.Module): def __init__(self): super(RMulFloat, self).__init__() def forward(self, x): return 10.0 * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RMulFloat
false
1,606
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 10.0 * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TensorClampOptionMax
# 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 TensorClampOptionMax(torch.nn.Module): def forward(self, x): return x.clamp(max=0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
TensorClampOptionMax
false
1,607
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x): return x.clamp(max=0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RDivInt
# 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 RDivInt(torch.nn.Module): def __init__(self): super(RDivInt, self).__init__() def forward(self, x): return 100 / 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RDivInt
false
1,608
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 100 / x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TorchSub
# 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 TorchSub(torch.nn.Module): def __init__(self): super(TorchSub, self).__init__() def forward(self, x, y): return torch.sub(x, y) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
TorchSub
false
1,609
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return torch.sub(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Sub
# 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 Sub(torch.nn.Module): def __init__(self): super(Sub, self).__init__() def forward(self, x, y): return x - y 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
Sub
false
1,610
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return x - y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TorchClampMin
# 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 TorchClampMin(torch.nn.Module): def forward(self, x): return torch.clamp_min(x, -0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
TorchClampMin
false
1,611
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x): return torch.clamp_min(x, -0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TorchDiv
# 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 TorchDiv(torch.nn.Module): def __init__(self): super(TorchDiv, self).__init__() def forward(self, x, y): return torch.div(x, y) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
TorchDiv
false
1,612
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return torch.div(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RSubFloat
# 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 RSubFloat(torch.nn.Module): def __init__(self): super(RSubFloat, self).__init__() def forward(self, x): return 1.0 - x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bunderhi/torch2trt
RSubFloat
false
1,613
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 1.0 - x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TensorClampMax
# 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 TensorClampMax(torch.nn.Module): def forward(self, x): return x.clamp_max(0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
bunderhi/torch2trt
TensorClampMax
false
1,614
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def forward(self, x): return x.clamp_max(0.1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RpowFloat
# 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 RpowFloat(torch.nn.Module): def __init__(self): super(RpowFloat, self).__init__() def forward(self, x): return 2.0 ** x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
bunderhi/torch2trt
RpowFloat
false
1,615
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return 2.0 ** x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TorchPow
# 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 TorchPow(torch.nn.Module): def __init__(self): super(TorchPow, self).__init__() def forward(self, x, y): return torch.pow(x, y) 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.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
bunderhi/torch2trt
TorchPow
false
1,616
[ "MIT" ]
0
fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
https://github.com/bunderhi/torch2trt/tree/fa5e31e742a0f0c9a9ee38909a6fa56bb07ba96d
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): return torch.pow(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TransformerEncoderLayerWithConv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 TransformerEncoderLayerWithConv1d(nn.Module): """ Input and output shape: seqlen x batch_size x dim """ def __init__(self, dim_model, nheads, dim_feedforward, dropout, kernel_size, stride): super(TransformerEnc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bliunlpr/pykaldi2
TransformerEncoderLayerWithConv1d
false
1,617
[ "MIT" ]
0
f6020b5dd9900f97ab69c97442a91196a03dd93b
https://github.com/bliunlpr/pykaldi2/tree/f6020b5dd9900f97ab69c97442a91196a03dd93b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Input and output shape: seqlen x batch_size x dim """ def __init__(self, dim_model, nheads, dim_feedforward, dropout, kernel_size, stride): super().__init__() self.encoder_layer = ...
EncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, d_model, eps=1e-12): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) self.eps = eps 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....
bsgiovanini/transformer
EncoderLayer
false
1,618
[ "Apache-2.0" ]
0
e128fa862f1b3d17d7b92df169a2bbee3f08366f
https://github.com/bsgiovanini/transformer/tree/e128fa862f1b3d17d7b92df169a2bbee3f08366f
import math import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, d_model, eps=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) self.eps = eps def forward(self, x): mean...
DecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, d_model, eps=1e-12): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) self.eps = eps 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....
bsgiovanini/transformer
DecoderLayer
false
1,619
[ "Apache-2.0" ]
0
e128fa862f1b3d17d7b92df169a2bbee3f08366f
https://github.com/bsgiovanini/transformer/tree/e128fa862f1b3d17d7b92df169a2bbee3f08366f
import math import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, d_model, eps=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) self.eps = eps def forward(self, x): mean...
CrossEntropyWithLogSoftmax
# 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 CrossEntropyWithLogSoftmax(nn.Module): def forward(self, y_hat, y): return -(y_hat * y).mean() 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...
cadurosar/graph_kd_dense_cifar100
CrossEntropyWithLogSoftmax
false
1,620
[ "MIT" ]
0
84054ab4f8f61c9db3460993661ba7bf1d951b36
https://github.com/cadurosar/graph_kd_dense_cifar100/tree/84054ab4f8f61c9db3460993661ba7bf1d951b36
import torch import torch.nn as nn class Model(nn.Module): def forward(self, y_hat, y): return -(y_hat * y).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
KlLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def kl_div(p: 'torch.Tensor', q: 'torch.Tensor') ->torch.Tensor: x = p * torch.log(p / q) return x.abs().mean() class KlLoss(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, inputs: 'torch.Tensor', targets: 'torch.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._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
by-liu/RetinalApp
KlLoss
false
1,621
[ "MIT" ]
0
53173b2b20dfcf613a3a22d6caa5178771d14225
https://github.com/by-liu/RetinalApp/tree/53173b2b20dfcf613a3a22d6caa5178771d14225
import torch import torch.nn as nn def kl_div(p: 'torch.Tensor', q: 'torch.Tensor') ->torch.Tensor: x = p * torch.log(p / q) return x.abs().mean() class Model(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, inputs: 'torch.Tensor', targets: 'torch.Tensor'): ...
BatchMeanCrossEntropyWithLogSoftmax
# 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 BatchMeanCrossEntropyWithLogSoftmax(nn.Module): def forward(self, y_hat, y): return -(y_hat * y).sum(dim=1).mean(dim=0) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
cadurosar/graph_kd_dense_cifar100
BatchMeanCrossEntropyWithLogSoftmax
false
1,622
[ "MIT" ]
0
84054ab4f8f61c9db3460993661ba7bf1d951b36
https://github.com/cadurosar/graph_kd_dense_cifar100/tree/84054ab4f8f61c9db3460993661ba7bf1d951b36
import torch import torch.nn as nn class Model(nn.Module): def forward(self, y_hat, y): return -(y_hat * y).sum(dim=1).mean(dim=0) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GAT
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 GraphAttentionLayer(nn.Module): """ https://github.com/Diego999/pyGAT/blob/master/layers.py Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, batch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bpilseo/VLP_GAT
GAT
false
1,623
[ "MIT" ]
0
ca8a2594036ab8fe4a180e5ced87f59f8984e54f
https://github.com/bpilseo/VLP_GAT/tree/ca8a2594036ab8fe4a180e5ced87f59f8984e54f
import torch from torch import nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ https://github.com/Diego999/pyGAT/blob/master/layers.py Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, batch...
RemoveChannelMeanStd
# 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 RemoveChannelMeanStd(torch.nn.Module): def forward(self, x): x2 = x.view(x.size(0), x.size(1), -1) mean = x2.mean(dim=2).view(x.size(0), x.size(1), 1, 1) std = x2.std(dim=2).view(x.size(0), x.size(1), 1, 1) return (x - mean) / std def get_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.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
cadurosar/graph_kd_dense_cifar100
RemoveChannelMeanStd
false
1,624
[ "MIT" ]
0
84054ab4f8f61c9db3460993661ba7bf1d951b36
https://github.com/cadurosar/graph_kd_dense_cifar100/tree/84054ab4f8f61c9db3460993661ba7bf1d951b36
import torch class Model(torch.nn.Module): def forward(self, x): x2 = x.view(x.size(0), x.size(1), -1) mean = x2.mean(dim=2).view(x.size(0), x.size(1), 1, 1) std = x2.std(dim=2).view(x.size(0), x.size(1), 1, 1) return (x - mean) / std def get_inputs(): return [torch.rand([4,...
BERTEmbedding2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class LearnedPositionalEmbedding2(nn.Module): def __init__(self, d_model, max_len=512): super().__init__() pe = torch.zeros(max_len, d_model...
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 from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.op...
byeongjokim/LateTemporalModeling3DCNN_for_sign
BERTEmbedding2
false
1,625
[ "MIT" ]
0
e3a802fcf91dc3930aea782464ee34d9b747d3ab
https://github.com/byeongjokim/LateTemporalModeling3DCNN_for_sign/tree/e3a802fcf91dc3930aea782464ee34d9b747d3ab
import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class LearnedPositionalEmbedding2(nn.Module): def __init__(self, d_model, max_len=512): super().__init__() pe = torch.zeros(max_len, d_model...
PositionwiseFeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU """ 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.triton_helpers import libdevice import math import ...
byeongjokim/LateTemporalModeling3DCNN_for_sign
PositionwiseFeedForward
false
1,626
[ "MIT" ]
0
e3a802fcf91dc3930aea782464ee34d9b747d3ab
https://github.com/byeongjokim/LateTemporalModeling3DCNN_for_sign/tree/e3a802fcf91dc3930aea782464ee34d9b747d3ab
import math import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU """ def forward(self, x)...
Evidential_layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Evidential_layer(nn.Module): def __init__(self, in_dim, num_classes): super(Evidential_layer, self).__init__() self.num_classes = num_classes self.fc1 = nn.Linear(in_dim, 2 * self.num_classes) self.relu = torch.nn.ReLU() def forward(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 import torch.nn as nn assert_...
caisr-hh/DEED
Evidential_layer
false
1,627
[ "MIT" ]
0
2a9edb1df31d99c1e8da177dec696d7c90c2e7de
https://github.com/caisr-hh/DEED/tree/2a9edb1df31d99c1e8da177dec696d7c90c2e7de
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim, num_classes): super().__init__() self.num_classes = num_classes self.fc1 = nn.Linear(in_dim, 2 * self.num_classes) self.relu = torch.nn.ReLU() def forward(self, x): x = self.fc1(x) ...
NextSentencePrediction
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class NextSentencePrediction(nn.Module): """ 2-class classification model : is_next, is_not_next """ def __init__(self, hidden): """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
byeongjokim/LateTemporalModeling3DCNN_for_sign
NextSentencePrediction
false
1,628
[ "MIT" ]
0
e3a802fcf91dc3930aea782464ee34d9b747d3ab
https://github.com/byeongjokim/LateTemporalModeling3DCNN_for_sign/tree/e3a802fcf91dc3930aea782464ee34d9b747d3ab
import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class Model(nn.Module): """ 2-class classification model : is_next, is_not_next """ def __init__(self, hidden): """ :param hidde...
BatchMeanKLDivWithLogSoftmax
# 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 BatchMeanKLDivWithLogSoftmax(nn.Module): def forward(self, p, log_q, log_p): return (p * log_p - p * log_q).sum(dim=1).mean(dim=0) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
cadurosar/graph_kd_dense_cifar100
BatchMeanKLDivWithLogSoftmax
false
1,629
[ "MIT" ]
0
84054ab4f8f61c9db3460993661ba7bf1d951b36
https://github.com/cadurosar/graph_kd_dense_cifar100/tree/84054ab4f8f61c9db3460993661ba7bf1d951b36
import torch import torch.nn as nn class Model(nn.Module): def forward(self, p, log_q, log_p): return (p * log_p - p * log_q).sum(dim=1).mean(dim=0) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand( [4, 4, 4, 4])] def get_init_inputs(): return [...
BWCEWLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from typing import Optional from torch import nn class BWCEWLoss(nn.Module): """ Binary weighted cross entropy loss. """ def __init__(self, positive_class_weight: 'Optional[Tensor]'=None, robust_lambda: 'int'=0, confidence_penalty: 'int'=0, **kwargs): sup...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
carlogrisetti/ludwig
BWCEWLoss
false
1,630
[ "Apache-2.0" ]
0
5c0887f14867e1577e0ddc3806c5cf7a781fb665
https://github.com/carlogrisetti/ludwig/tree/5c0887f14867e1577e0ddc3806c5cf7a781fb665
import torch from torch import Tensor from typing import Optional from torch import nn class Model(nn.Module): """ Binary weighted cross entropy loss. """ def __init__(self, positive_class_weight: 'Optional[Tensor]'=None, robust_lambda: 'int'=0, confidence_penalty: 'int'=0, **kwargs): super()...
ConvLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class ConvLayer(torch.nn.Module): def __init__(self, in_features, out_features, kernel_size=1, stride=1): super().__init__() padding = kernel_size // 2 self.refpadding = torch.nn.ReflectionPad2d(padding) self.conv = torch.nn.Conv2d(in_features, out_features, 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.triton_helpers import math as tl_math assert_size_s...
bruchano/GTAVSelfDriving
ConvLayer
false
1,631
[ "MIT" ]
0
c5f929f793b48e47725dbdb8f0991e04e3c43eba
https://github.com/bruchano/GTAVSelfDriving/tree/c5f929f793b48e47725dbdb8f0991e04e3c43eba
import torch class Model(torch.nn.Module): def __init__(self, in_features, out_features, kernel_size=1, stride=1): super().__init__() padding = kernel_size // 2 self.refpadding = torch.nn.ReflectionPad2d(padding) self.conv = torch.nn.Conv2d(in_features, out_features, kernel_size, ...
ReduceMax
# 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 ReduceMax(torch.nn.Module): def forward(self, inputs, mask=None): return torch.amax(inputs, dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
carlogrisetti/ludwig
ReduceMax
false
1,632
[ "Apache-2.0" ]
0
5c0887f14867e1577e0ddc3806c5cf7a781fb665
https://github.com/carlogrisetti/ludwig/tree/5c0887f14867e1577e0ddc3806c5cf7a781fb665
import torch class Model(torch.nn.Module): def forward(self, inputs, mask=None): return torch.amax(inputs, dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SingleLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SingleLayer(nn.Module): def __init__(self, nChannels, growthRate): super(SingleLayer, self).__init__() self.bn1 = nn.GroupNorm(nChannels, nChannels, affine=True) self.conv1 = nn.Conv2d(nChannels, growthRate, kernel_size=3, padding=1, bi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cadurosar/graph_kd_dense_cifar100
SingleLayer
false
1,633
[ "MIT" ]
0
84054ab4f8f61c9db3460993661ba7bf1d951b36
https://github.com/cadurosar/graph_kd_dense_cifar100/tree/84054ab4f8f61c9db3460993661ba7bf1d951b36
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nChannels, growthRate): super().__init__() self.bn1 = nn.GroupNorm(nChannels, nChannels, affine=True) self.conv1 = nn.Conv2d(nChannels, growthRate, kernel_size=3, padding=1, bias=False) self....
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 math import torch import uuid from torch import Tensor import torch.nn as nn from typing import Tuple import torch.nn.functional as F from typing import Optional from typing import Dict from torch.nn import Parameter def gelu(x): """Implementation of the gelu activation function. For information: Open...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
boxiangliu/esm
TransformerLayer
false
1,634
[ "MIT" ]
0
3c143d99103e0ea38a9455f30a73cd9c87376606
https://github.com/boxiangliu/esm/tree/3c143d99103e0ea38a9455f30a73cd9c87376606
import math import torch import uuid from torch import Tensor import torch.nn as nn from typing import Tuple import torch.nn.functional as F from typing import Optional from typing import Dict from torch.nn import Parameter def gelu(x): """Implementation of the gelu activation function. For information: Open...
my_Hingeloss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class my_Hingeloss(nn.Module): def __init__(self): super(my_Hingeloss, self).__init__() def forward(self, output, target): pos = torch.sum(output * target, 2) neg = torch.max((1 - target) * output, 2) loss = neg[0] - pos + 1 loss[los...
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...
carsault/chord_sequence_prediction
my_Hingeloss
false
1,635
[ "MIT" ]
0
6eb539a963ca6350bcf0c88b8d8756775ad7c488
https://github.com/carsault/chord_sequence_prediction/tree/6eb539a963ca6350bcf0c88b8d8756775ad7c488
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, output, target): pos = torch.sum(output * target, 2) neg = torch.max((1 - target) * output, 2) loss = neg[0] - pos + 1 loss[loss < 0] = 0 loss =...
SigmoidCrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from typing import List from typing import Optional from typing import Union from torch import nn class SigmoidCrossEntropyLoss(nn.Module): def __init__(self, class_weights: 'Optional[Union[Tensor, List]]'=None, **kwargs): """ Params: clas...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
carlogrisetti/ludwig
SigmoidCrossEntropyLoss
false
1,636
[ "Apache-2.0" ]
0
5c0887f14867e1577e0ddc3806c5cf7a781fb665
https://github.com/carlogrisetti/ludwig/tree/5c0887f14867e1577e0ddc3806c5cf7a781fb665
import torch from torch import Tensor from typing import List from typing import Optional from typing import Union from torch import nn class Model(nn.Module): def __init__(self, class_weights: 'Optional[Union[Tensor, List]]'=None, **kwargs): """ Params: class_weights: List or...
Explorer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 def init(module, weight_init, bias_init, gain=1): weight_init(module.weight.data, gain=gain) bias_init(module.bias.data) return module class Explorer(nn.Module): def __init__(self, state_dim, max_action, exp_regularization): super(Explor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
baturaysaglam/DISCOVER
Explorer
false
1,637
[ "MIT" ]
0
423158c84a5935ca5755ccad06ea5fe20fb57d76
https://github.com/baturaysaglam/DISCOVER/tree/423158c84a5935ca5755ccad06ea5fe20fb57d76
import torch import numpy as np import torch.nn as nn def init(module, weight_init, bias_init, gain=1): weight_init(module.weight.data, gain=gain) bias_init(module.bias.data) return module class Model(nn.Module): def __init__(self, state_dim, max_action, exp_regularization): super().__init_...
ReduceLast
# 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 def sequence_length_3D(sequence: 'torch.Tensor') ->torch.Tensor: used = torch.sign(torch.amax(torch.abs(sequence), dim=2)) length = torch.sum(used, 1) length = length.int() return length class ReduceLast(torch.nn.Module): def forward(self, inputs, mask=None): batch_size = i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
carlogrisetti/ludwig
ReduceLast
false
1,638
[ "Apache-2.0" ]
0
5c0887f14867e1577e0ddc3806c5cf7a781fb665
https://github.com/carlogrisetti/ludwig/tree/5c0887f14867e1577e0ddc3806c5cf7a781fb665
import torch def sequence_length_3D(sequence: 'torch.Tensor') ->torch.Tensor: used = torch.sign(torch.amax(torch.abs(sequence), dim=2)) length = torch.sum(used, 1) length = length.int() return length class Model(torch.nn.Module): def forward(self, inputs, mask=None): batch_size = inputs...
Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class RemoveChannelMeanStd(torch.nn.Module): def forward(self, x): x2 = x.view(x.size(0), x.size(1), -1) mean = x2.mean(dim=2).view(x.size(0), x.size(1), 1, 1) std = x2.std(dim=2).view(x.size(0), x.size(1), 1, 1) r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
cadurosar/graph_kd_dense_cifar100
Block
false
1,639
[ "MIT" ]
0
84054ab4f8f61c9db3460993661ba7bf1d951b36
https://github.com/cadurosar/graph_kd_dense_cifar100/tree/84054ab4f8f61c9db3460993661ba7bf1d951b36
import torch import torch.nn as nn import torch.nn.functional as F class RemoveChannelMeanStd(torch.nn.Module): def forward(self, x): x2 = x.view(x.size(0), x.size(1), -1) mean = x2.mean(dim=2).view(x.size(0), x.size(1), 1, 1) std = x2.std(dim=2).view(x.size(0), x.size(1), 1, 1) r...
NPairsLoss
# 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 NPairsLoss(nn.Module): def __init__(self, name): super(NPairsLoss, self).__init__() self.name = name def forward(self, r1, r2): """ Computes the N-Pairs Loss between the r1 and r2 representations. :param r1: Tensor of shape (bat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
celsofranssa/PAWS
NPairsLoss
false
1,640
[ "MIT" ]
0
3171c8a22990059f5d4c0e7e81cc0299a716efb2
https://github.com/celsofranssa/PAWS/tree/3171c8a22990059f5d4c0e7e81cc0299a716efb2
import torch from torch import nn class Model(nn.Module): def __init__(self, name): super().__init__() self.name = name def forward(self, r1, r2): """ Computes the N-Pairs Loss between the r1 and r2 representations. :param r1: Tensor of shape (batch_size, representati...
CNNCifar
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.nn.functional as F class CNNCifar(nn.Module): def __init__(self, args): super(CNNCifar, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Joey61Liuyi/Federated-Learning-PyTorch
CNNCifar
false
1,641
[ "MIT" ]
0
e95f096b18c5a1bf30fc0485acd5a15c84327f2e
https://github.com/Joey61Liuyi/Federated-Learning-PyTorch/tree/e95f096b18c5a1bf30fc0485acd5a15c84327f2e
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, args): super().__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) ...
RMSELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class RMSELoss(nn.Module): def __init__(self, eps=1e-08): super(RMSELoss, self).__init__() self.mse = nn.MSELoss() self.eps = eps def forward(self, y_hat, y): return torch.sqrt(self.mse(y_hat, y) + self.eps) def get_inputs(): return [t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
cerisara/weibull-knowledge-informed-ml
RMSELoss
false
1,642
[ "MIT" ]
0
19017817f5324fb1fffd8322d2d3567a6271948c
https://github.com/cerisara/weibull-knowledge-informed-ml/tree/19017817f5324fb1fffd8322d2d3567a6271948c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-08): super().__init__() self.mse = nn.MSELoss() self.eps = eps def forward(self, y_hat, y): return torch.sqrt(self.mse(y_hat, y) + self.eps) def get_inputs(): return [torch.rand([4, 4, ...
MAPELoss
# 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 MAPELoss(nn.Module): def __init__(self, eps=1e-08): super(MAPELoss, self).__init__() self.eps = eps def forward(self, y_hat, y): return torch.mean(torch.abs(y - y_hat) / torch.abs(y + self.eps)) * 100 def get_inputs(): return [torch.rand...
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 ...
cerisara/weibull-knowledge-informed-ml
MAPELoss
false
1,643
[ "MIT" ]
0
19017817f5324fb1fffd8322d2d3567a6271948c
https://github.com/cerisara/weibull-knowledge-informed-ml/tree/19017817f5324fb1fffd8322d2d3567a6271948c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-08): super().__init__() self.eps = eps def forward(self, y_hat, y): return torch.mean(torch.abs(y - y_hat) / torch.abs(y + self.eps)) * 100 def get_inputs(): return [torch.rand([4, 4, 4, 4]), t...
MY_NGM_FFNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import random import torch import torch.nn as nn from collections import defaultdict import torch.nn.functional as F import torch.optim as optim class MY_NGM_FFNN(nn.Module): def __init__(self, alpha, input_dim, hidden1_dim, hidden2_dim, output_dim, device=torch.device('cpu')): super(MY_NGM_FFNN,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
calpoly-bioinf/knowledge_driven_modeling
MY_NGM_FFNN
false
1,644
[ "MIT" ]
0
dbe55d5bb07f7c5a1834a21fde8833f295e3ac96
https://github.com/calpoly-bioinf/knowledge_driven_modeling/tree/dbe55d5bb07f7c5a1834a21fde8833f295e3ac96
import random import torch import torch.nn as nn from collections import defaultdict import torch.nn.functional as F import torch.optim as optim class Model(nn.Module): def __init__(self, alpha, input_dim, hidden1_dim, hidden2_dim, output_dim, device=torch.device('cpu')): super().__init__() ...
Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Discriminator(nn.Module): def __init__(self, n_layersDecod, hidden_size, output_size=2): super(Discriminator, self).__init__() self.map1 = nn.Linear(n_layersDecod * hidden_size, hidden_size) self.map2 = nn.Linear(hid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carsault/chord_sequence_prediction
Discriminator
false
1,645
[ "MIT" ]
0
6eb539a963ca6350bcf0c88b8d8756775ad7c488
https://github.com/carsault/chord_sequence_prediction/tree/6eb539a963ca6350bcf0c88b8d8756775ad7c488
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_layersDecod, hidden_size, output_size=2): super().__init__() self.map1 = nn.Linear(n_layersDecod * hidden_size, hidden_size) self.map2 = nn.Linear(hidden_size, hidden_size) ...
NeuralNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class NeuralNet(torch.nn.Module): def __init__(self, input_size, output_size, hidden_size, lr=0.0001): super(NeuralNet, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.output_size = output_size self.HiddenLayer = torch.nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
bva-bme/Constrained_Policy_Gradient
NeuralNet
false
1,646
[ "MIT" ]
0
2331f55ff3bf06e2276662517c34cc45d5a51da8
https://github.com/bva-bme/Constrained_Policy_Gradient/tree/2331f55ff3bf06e2276662517c34cc45d5a51da8
import torch class Model(torch.nn.Module): def __init__(self, input_size, output_size, hidden_size, lr=0.0001): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.output_size = output_size self.HiddenLayer = torch.nn.Linear(self.input_size,...
RMSLELoss
# 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 RMSLELoss(nn.Module): def __init__(self, eps=1e-08): super(RMSLELoss, self).__init__() self.mse = nn.MSELoss() self.eps = eps def forward(self, y_hat, y): return torch.sqrt(self.mse(torch.log(y_hat + 1), torch.log(y + 1)) + ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
cerisara/weibull-knowledge-informed-ml
RMSLELoss
false
1,647
[ "MIT" ]
0
19017817f5324fb1fffd8322d2d3567a6271948c
https://github.com/cerisara/weibull-knowledge-informed-ml/tree/19017817f5324fb1fffd8322d2d3567a6271948c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-08): super().__init__() self.mse = nn.MSELoss() self.eps = eps def forward(self, y_hat, y): return torch.sqrt(self.mse(torch.log(y_hat + 1), torch.log(y + 1)) + self.eps) def ge...
BERTEmbedding4
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class LearnedPositionalEmbedding3(nn.Module): def __init__(self, d_model, max_len=512): super().__init__() pe = torch.zeros(max_len, d_model...
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 from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.op...
byeongjokim/LateTemporalModeling3DCNN_for_sign
BERTEmbedding4
false
1,648
[ "MIT" ]
0
e3a802fcf91dc3930aea782464ee34d9b747d3ab
https://github.com/byeongjokim/LateTemporalModeling3DCNN_for_sign/tree/e3a802fcf91dc3930aea782464ee34d9b747d3ab
import torch import torch.nn as nn from itertools import chain as chain import torch.utils.data import torch.hub import torch.nn.parallel import torch.optim class LearnedPositionalEmbedding3(nn.Module): def __init__(self, d_model, max_len=512): super().__init__() pe = torch.zeros(max_len, d_model...
SpaceToBatch
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class SpaceToDim(nn.Module): def __init__(self, scale_factor, dims=(-2, -1), dim=0): super(SpaceToDim, self).__init__() self.scale_factor = scale_factor self.dims = dims self.dim = dim def forward(self, x): _s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
cestcedric/TSSR-GAN
SpaceToBatch
false
1,649
[ "BSD-2-Clause", "MIT" ]
0
d6e1b50409e0f0591660552993e6d5b70d41e766
https://github.com/cestcedric/TSSR-GAN/tree/d6e1b50409e0f0591660552993e6d5b70d41e766
import torch import torch.nn as nn import torch.utils.data class SpaceToDim(nn.Module): def __init__(self, scale_factor, dims=(-2, -1), dim=0): super().__init__() self.scale_factor = scale_factor self.dims = dims self.dim = dim def forward(self, x): _shape = list(x.sh...