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
LxmertSelfAttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch from torch import nn import torch.utils.checkpoint class LxmertAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise Value...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Clemens123/transformers
LxmertSelfAttentionLayer
false
11,815
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
from _paritybench_helpers import _mock_config import math import torch from torch import nn import torch.utils.checkpoint class LxmertAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise Value...
MegatronGelu
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn import torch.onnx class MegatronGelu(torch.nn.Module): def forward(self, x): return x * 0.5 * (torch.erf(x / 1.41421) + 1.0) 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 import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards....
RyanUnderhill/onnxruntime
MegatronGelu
false
11,816
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def forward(self, x): return x * 0.5 * (torch.erf(x / 1.41421) + 1.0) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Alignment
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 from torch.nn import Module import math import torch import torch.nn.functional as f import torch.nn as nn class Module(nn.Module): def __init__(self): super().__init__() self.summary = {} def add_summary(self, name, val): if self.trainin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IamHimon/re2
Alignment
false
11,817
[ "Apache-2.0" ]
0
d16b0ffc385f7b118a6160d035250da8d6320534
https://github.com/IamHimon/re2/tree/d16b0ffc385f7b118a6160d035250da8d6320534
from _paritybench_helpers import _mock_config from torch.nn import Module import math import torch import torch.nn.functional as f import torch.nn as nn class Module(nn.Module): def __init__(self): super().__init__() self.summary = {} def add_summary(self, name, val): if self.trainin...
DeepNN_v2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 DeepNN_v2(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v2_layer1 = nn.Linear(X_dim, 256, bias=True) self.v2_layer2 = nn.Linear(256, 256, bias=True) self.v2_layer3 = nn.Linear(256, 1, bias=Tr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SBIlab/NetBio
DeepNN_v2
false
11,818
[ "MIT" ]
0
7abd24b8989cea381147d912f76a72676750b9d2
https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v2_layer1 = nn.Linear(X_dim, 256, bias=True) self.v2_layer2 = nn.Linear(256, 256, bias=True) self.v2_layer3 = nn.Linear(256, 1, bias=True) ...
TransformerDecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 class MultiHeadAttention(nn.Module): """ A model layer which implements a simplified version of masked attention, as introduced by "Attention Is All You Need" (https://arxiv.org/abs/1706.03762). Usage: attn = MultiHeadAttention(embed_dim, num_heads...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Michellemingxuan/stanford_cs231n
TransformerDecoderLayer
false
11,819
[ "MIT" ]
0
b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143
https://github.com/Michellemingxuan/stanford_cs231n/tree/b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143
import math import torch import torch.nn as nn class MultiHeadAttention(nn.Module): """ A model layer which implements a simplified version of masked attention, as introduced by "Attention Is All You Need" (https://arxiv.org/abs/1706.03762). Usage: attn = MultiHeadAttention(embed_dim, num_heads...
Downsample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.hub class Downsample(nn.Module): def __init__(self, in_channels, with_conv): super().__init__() self.with_conv = with_conv if self.with_conv: self.conv = torch.nn.Conv2d(in_channels, in_channels, kernel_size=3, st...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.hub assert_size_stride = torch._C._dynamo.gua...
Rushi314/taming-transformers
Downsample
false
11,820
[ "MIT" ]
0
4c0309823f57be3ca2266c1244e3efce13aaee98
https://github.com/Rushi314/taming-transformers/tree/4c0309823f57be3ca2266c1244e3efce13aaee98
import torch import torch.nn as nn import torch.hub class Model(nn.Module): def __init__(self, in_channels, with_conv): super().__init__() self.with_conv = with_conv if self.with_conv: self.conv = torch.nn.Conv2d(in_channels, in_channels, kernel_size=3, stride=...
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): super(Net, self).__init__() self.fc1 = nn.Linear(32 * 32 * 3, 512) self.fc2 = nn.Linear(512, 128) self.fc3 = nn.Linear(128, 10) def forward(self, x): x = x.vie...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Rui-Chun/CNN-with-Numpy
Net
false
11,821
[ "MIT" ]
0
0bc73040c7ada2581d2db3d6e4b2396fa98a4bde
https://github.com/Rui-Chun/CNN-with-Numpy/tree/0bc73040c7ada2581d2db3d6e4b2396fa98a4bde
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(32 * 32 * 3, 512) self.fc2 = nn.Linear(512, 128) self.fc3 = nn.Linear(128, 10) def forward(self, x): x = x.view(-1, 3...
MetaLayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 re import torch import warnings import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ---...
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 re import warnings import torch.nn as nn from collections import Ordered...
SDivakarBhat/pytorch-meta
MetaLayerNorm
false
11,822
[ "MIT" ]
0
74cbc8ae625d85c6b954aad159ccb26b523b2240
https://github.com/SDivakarBhat/pytorch-meta/tree/74cbc8ae625d85c6b954aad159ccb26b523b2240
import re import torch import warnings import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ---...
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency , self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
RyanUnderhill/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
false
11,823
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.fc2 = torch.nn.Linear(input_size, hidden_size) self.softmax1 = to...
MegatronFastGelu
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn import torch.onnx class MegatronFastGelu(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards....
RyanUnderhill/onnxruntime
MegatronFastGelu
false
11,824
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
MaskedMSELoss
# 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 MaskedMSELoss(nn.Module): def __init__(self): super(MaskedMSELoss, self).__init__() self.loss = nn.MSELoss(reduction='sum') def forward(self, pred, target, mask): """ pred -> batch*seq_len target -> batch*seq_len mask -...
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...
RaleLee/conv-emotion
MaskedMSELoss
false
11,825
[ "MIT" ]
0
1b07223cbdfd52eb31e913e982d18ff1ed3daf08
https://github.com/RaleLee/conv-emotion/tree/1b07223cbdfd52eb31e913e982d18ff1ed3daf08
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.loss = nn.MSELoss(reduction='sum') def forward(self, pred, target, mask): """ pred -> batch*seq_len target -> batch*seq_len mask -> batch*seq_len """...
NeuralNetNonDifferentiableOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.onnx class NeuralNetNonDifferentiableOutput(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetNonDifferentiableOutput, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
RyanUnderhill/onnxruntime
NeuralNetNonDifferentiableOutput
false
11,826
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch.nn.ReLU() self.fc2 = torch.nn.Linear(hidden_size, num_cla...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn class MultiHeadAttention(nn.Module): """ A model layer which implements a simplified version of masked attention, as introduced by "Attention Is All You Need" (https://arxiv.org/abs/1706.03762). Usage: attn = MultiHeadAttention(embed_dim, num_heads...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Michellemingxuan/stanford_cs231n
MultiHeadAttention
false
11,827
[ "MIT" ]
0
b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143
https://github.com/Michellemingxuan/stanford_cs231n/tree/b1d0a5a4a3b2fe5d685e34a4ebd810cbc56ec143
import math import torch import torch.nn as nn class Model(nn.Module): """ A model layer which implements a simplified version of masked attention, as introduced by "Attention Is All You Need" (https://arxiv.org/abs/1706.03762). Usage: attn = MultiHeadAttention(embed_dim, num_heads=2) # ...
NeuralNetMultiplePositionalArgumentsVarKeyword
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.onnx class NeuralNetMultiplePositionalArgumentsVarKeyword(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsVarKeyword, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
RyanUnderhill/onnxruntime
NeuralNetMultiplePositionalArgumentsVarKeyword
false
11,828
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch.nn.ReLU() self.fc2 = torch.nn.Linear(hidden_size, num_cla...
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency(torch. nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency, self).__init__() s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
RyanUnderhill/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
false
11,829
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch. nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.softmax = torch.nn.Softmax(dim=1) self.fc2 = torch.nn.Linear(hidd...
MyCustomFunctionReluModel
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn import torch.onnx class MyCustomFunctionReluModel(torch.nn.Module): def __init__(self): super().__init__() class MyReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): ctx.save_for_backward(input) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_siz...
RyanUnderhill/onnxruntime
MyCustomFunctionReluModel
false
11,830
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self): super().__init__() class MyReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): ctx.save_for_backward(input) return input.cl...
DeepNN_v3
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 DeepNN_v3(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v3_layer1 = nn.Linear(X_dim, 128, bias=True) self.v3_layer2 = nn.Linear(128, 128, bias=True) self.v3_layer3 = nn.Linear(128, 128, bias=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SBIlab/NetBio
DeepNN_v3
false
11,831
[ "MIT" ]
0
7abd24b8989cea381147d912f76a72676750b9d2
https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v3_layer1 = nn.Linear(X_dim, 128, bias=True) self.v3_layer2 = nn.Linear(128, 128, bias=True) self.v3_layer3 = nn.Linear(128, 128, bias=True...
DDPGConvBody
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class DDPGConvBody(nn.Module): def __init__(self, in_channels=4): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Rajawat23/DeepRL
DDPGConvBody
false
11,832
[ "MIT" ]
0
9f77dfbc593f9c9055254c781f97983b9630dad2
https://github.com/Rajawat23/DeepRL/tree/9f77dfbc593f9c9055254c781f97983b9630dad2
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class Model(nn.Module): def __init__(self, in_channels=4): sup...
NeuralNetPartialNoGradModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.onnx class NeuralNetPartialNoGradModel(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetPartialNoGradModel, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size).requires_grad_( False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
RyanUnderhill/onnxruntime
NeuralNetPartialNoGradModel
false
11,833
[ "MIT" ]
0
6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
https://github.com/RyanUnderhill/onnxruntime/tree/6df4e293ffbb47d739d2dedfbb87fa6234b8c37c
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size).requires_grad_( False) self.relu = torch.nn.ReLU() self.fc2 = t...
DeepNN_v1
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 DeepNN_v1(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v1_layer1 = nn.Linear(X_dim, 512, bias=True) self.v1_layer2 = nn.Linear(512, 1, bias=True) self.i_dropout = nn.Dropout(i_dropout_rate) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SBIlab/NetBio
DeepNN_v1
false
11,834
[ "MIT" ]
0
7abd24b8989cea381147d912f76a72676750b9d2
https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v1_layer1 = nn.Linear(X_dim, 512, bias=True) self.v1_layer2 = nn.Linear(512, 1, bias=True) self.i_dropout = nn.Dropout(i_dropout_rate) ...
TwoLayerFCBodyWithAction
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class TwoLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
RaviTej310/mrpvf
TwoLayerFCBodyWithAction
false
11,835
[ "MIT" ]
0
f026b4704f26b85161de26ada5d6390ab549fbbd
https://github.com/RaviTej310/mrpvf/tree/f026b4704f26b85161de26ada5d6390ab549fbbd
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class Model(nn.Module): def __init__(self, state_dim, action_dim, hidd...
down
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class to create a UNet like NN architecture. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Remosy/v2e
down
false
11,836
[ "MIT" ]
0
efc81cbcc113ca55d1631603323150be5ef8eb30
https://github.com/Remosy/v2e/tree/efc81cbcc113ca55d1631603323150be5ef8eb30
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class to create a UNet like NN architecture. ...
_Transition
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torchvision.transforms import * class _Transition(nn.Module): def __init__(self, in_channels, args): super(_Transition, self).__init__() self.pool = nn.AvgPool2d(kernel_size=2, stride=2) def forward(self, x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torchvision.transforms import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
RobbieEarle/robustness
_Transition
false
11,837
[ "Apache-2.0" ]
0
2f4381900015bf7fcd9975d43b8104d2d14f8568
https://github.com/RobbieEarle/robustness/tree/2f4381900015bf7fcd9975d43b8104d2d14f8568
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torchvision.transforms import * class Model(nn.Module): def __init__(self, in_channels, args): super().__init__() self.pool = nn.AvgPool2d(kernel_size=2, stride=2) def forward(self, x): x = self.poo...
DeepNN_v4
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 DeepNN_v4(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v4_layer1 = nn.Linear(X_dim, 128, bias=True) self.v4_layer2 = nn.Linear(128, 128, bias=True) self.v4_layer3 = nn.Linear(128, 64, bias=T...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SBIlab/NetBio
DeepNN_v4
false
11,838
[ "MIT" ]
0
7abd24b8989cea381147d912f76a72676750b9d2
https://github.com/SBIlab/NetBio/tree/7abd24b8989cea381147d912f76a72676750b9d2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, X_dim, i_dropout_rate, h_dropout_rate): super().__init__() self.v4_layer1 = nn.Linear(X_dim, 128, bias=True) self.v4_layer2 = nn.Linear(128, 128, bias=True) self.v4_layer3 = nn.Linear(128, 64, bias=True)...
ProposalNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class ProposalNet(nn.Module): def __init__(self, in_features=2048): super(ProposalNet, self).__init__() self.down1 = nn.Conv2d(2048, 128, 3, 1, 1) self.down2 = nn.Conv2d(128, 128, 3, 2, 1) self.down3 = nn.Conv2d(128, 128, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Liuhongzhi2018/ClassNet
ProposalNet
false
11,839
[ "MIT" ]
0
7d427dc9b8c38abf0a4eedfdeb75c09c59aa7185
https://github.com/Liuhongzhi2018/ClassNet/tree/7d427dc9b8c38abf0a4eedfdeb75c09c59aa7185
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, in_features=2048): super().__init__() self.down1 = nn.Conv2d(2048, 128, 3, 1, 1) self.down2 = nn.Conv2d(128, 128, 3, 2, 1) self.down3 = nn.Conv2d(128, 128, 3, 2, 1) self.R...
ScaledDotProductAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from typing import Optional import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Overview: Implementation of dot product attentionn with scaling. """ def __init__(self, d_k: 'int', dropout: 'float'=0.0) ->None: super(Scaled...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
PaParaZz1/DI-engine
ScaledDotProductAttention
false
11,840
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch from typing import Optional import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ Overview: Implementation of dot product attentionn with scaling. """ def __init__(self, d_k: 'int', dropout: 'float'=0.0) ->None: super().__init__() self....
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 import torch.nn.functional as F class LSTM(nn.Module): def __init__(self, input_size, cell_size, hidden_size): """ cell_size is the size of cell_state. hidden_size is the size of hidden_state, or say the output_state of each step """ supe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SakastLord/STGAT
LSTM
false
11,841
[ "MIT" ]
0
664843b3a55ac55383de1d5400d731376476ea03
https://github.com/SakastLord/STGAT/tree/664843b3a55ac55383de1d5400d731376476ea03
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, cell_size, hidden_size): """ cell_size is the size of cell_state. hidden_size is the size of hidden_state, or say the output_state of each step """ sup...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=kernel_size // 2, bias=bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
PaParaZz1/DI-engine
Encoder
false
11,842
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=kernel_size // 2, bias=bias...
TimeBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 TimeBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3): """ :param in_channels: Number of input features at each node in each time step. :param out_channels: Desired number of outp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
SakastLord/STGAT
TimeBlock
false
11,843
[ "MIT" ]
0
664843b3a55ac55383de1d5400d731376476ea03
https://github.com/SakastLord/STGAT/tree/664843b3a55ac55383de1d5400d731376476ea03
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3): """ :param in_channels: Number of input features at each node in each time step. :param out_channels: Desired number of output c...
PixBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 PixBlock(nn.Module): def __init__(self, in_size, out_size=3, scale=2, norm=None): super(PixBlock, self).__init__() self.conv1 = nn.Conv2d(in_size, out_size * 2 ** scale, 1, 1) self.up = nn.PixelShuffle(scale) def forward(self, x): x = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
MohamadHMousavi/demo_wsi_superres
PixBlock
false
11,844
[ "MIT" ]
0
7e846470aa228affa62ea77c38c138dde087a0de
https://github.com/MohamadHMousavi/demo_wsi_superres/tree/7e846470aa228affa62ea77c38c138dde087a0de
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_size, out_size=3, scale=2, norm=None): super().__init__() self.conv1 = nn.Conv2d(in_size, out_size * 2 ** scale, 1, 1) self.up = nn.PixelShuffle(scale) def forward(self, x): x = self.conv1(x) ...
MultiheadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter class MultiheadAttention(nn.Module): def __init__(self, embed_dim, num_heads, attn_dropout=0.0, bias=True, add_bias_kv=False, add_zero_attn=False): """ Multi-headed attention. This module can...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SCUT-IEL/CMAA
MultiheadAttention
false
11,845
[ "MIT" ]
0
1af9e7a7a75e754a7208e361d8128ef58b716941
https://github.com/SCUT-IEL/CMAA/tree/1af9e7a7a75e754a7208e361d8128ef58b716941
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter class Model(nn.Module): def __init__(self, embed_dim, num_heads, attn_dropout=0.0, bias=True, add_bias_kv=False, add_zero_attn=False): """ Multi-headed attention. This module can use the MULT...
TokenEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import Tensor import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class TokenEmbedding(nn.Module): def __init__(self, vocab_size: 'int', emb_...
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.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import to...
LeeSHa00/PyTorch-tutorials-kr
TokenEmbedding
false
11,846
[ "BSD-3-Clause" ]
0
6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
import math import torch from torch import Tensor import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Model(nn.Module): def __init__(self, vocab_size: 'int', emb_size): ...
GLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 GLU(nn.Module): """ Overview: Gating Linear Unit. This class does a thing like this: .. code::python # Inputs: input, context, output_size # The gate value is a learnt function of the input. gate = sigmoid(l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
PaParaZz1/DI-engine
GLU
false
11,847
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn as nn class Model(nn.Module): """ Overview: Gating Linear Unit. This class does a thing like this: .. code::python # Inputs: input, context, output_size # The gate value is a learnt function of the input. gate = sigmoid...
LabelSmoothCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn def one_hot(val: 'torch.LongTensor', num: 'int', num_first: 'bool'=False ) ->torch.FloatTensor: """ Overview: Convert a ``torch.LongTensor`` to one hot encoding. This implementation can be slightly faster than ``torch.nn.fu...
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 ...
PaParaZz1/DI-engine
LabelSmoothCELoss
false
11,848
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn.functional as F import torch.nn as nn def one_hot(val: 'torch.LongTensor', num: 'int', num_first: 'bool'=False ) ->torch.FloatTensor: """ Overview: Convert a ``torch.LongTensor`` to one hot encoding. This implementation can be slightly faster than ``torch.nn.fu...
TracedModule
# 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.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class TracedModule(torch.nn.Module): def forward(self, x): x = x.type(torch.float32) return torch.floor(torch.sqrt(x) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.quantization import torch.onnx import torch.nn.parallel import tor...
LeeSHa00/PyTorch-tutorials-kr
TracedModule
false
11,849
[ "BSD-3-Clause" ]
0
6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
import torch import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Model(torch.nn.Module): def forward(self, x): x = x.type(torch.float32) return torch.floor(torch.sqrt(x) / 5.0) ...
SENet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 SENet(nn.Module): """support estimation network""" def __init__(self, input_size: 'int', hidden_size: 'int', output_dims: 'int') ->None: super(SENet, self).__init__() self.l_1 = nn.Linear(input_size, hidden_size) self.l_2 = nn.Linear(hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
PaParaZz1/DI-engine
SENet
false
11,850
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn as nn class Model(nn.Module): """support estimation network""" def __init__(self, input_size: 'int', hidden_size: 'int', output_dims: 'int') ->None: super().__init__() self.l_1 = nn.Linear(input_size, hidden_size) self.l_2 = nn.Linear(hidden_size, ...
Critic
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ outputs the limits for the values in the hidden layer for initialisation""" fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl
Critic
false
11,851
[ "MIT" ]
0
f3e811a3ae3eb603173c2475bbfe1de91074ecdc
https://github.com/SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl/tree/f3e811a3ae3eb603173c2475bbfe1de91074ecdc
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ outputs the limits for the values in the hidden layer for initialisation""" fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): ...
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 import torch.nn as nn class ResidualBlock(nn.Module): def __init__(self, in_channels, out_channels, activation='relu'): super().__init__() self.in_channels, self.out_channels, self.activation = (in_channels, out_channels, activation) self.blocks = nn.Identity() ...
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...
PaParaZz1/DI-engine
ResidualBlock
false
11,852
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, activation='relu'): super().__init__() self.in_channels, self.out_channels, self.activation = (in_channels, out_channels, activation) self.blocks = nn.Identity() se...
Conv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Conv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding='same'): """ inputs: [N, T, C_in] outputs: [N, T, C_out] """ super().__init__() if paddi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Sala7efelninja/GST-Tacotron
Conv1d
false
11,853
[ "MIT" ]
0
e69a5663832a2c3639d4afbb85092a35be621380
https://github.com/Sala7efelninja/GST-Tacotron/tree/e69a5663832a2c3639d4afbb85092a35be621380
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding='same'): """ inputs: [N, T, C_in] outputs: [N, T, C_out] """ super().__init__() if paddin...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_dim, num_units, num_heads): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Sala7efelninja/GST-Tacotron
MultiHeadAttention
false
11,854
[ "MIT" ]
0
e69a5663832a2c3639d4afbb85092a35be621380
https://github.com/Sala7efelninja/GST-Tacotron/tree/e69a5663832a2c3639d4afbb85092a35be621380
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_dim, num_units, num_heads): super...
ATOCAttentionUnit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Union from typing import Dict import torch.nn as nn class ATOCAttentionUnit(nn.Module): """ Overview: the attention unit of the atoc network. We now implement it as two-layer MLP, same as the original paper Interface: __init__, forward .. note:: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
PaParaZz1/DI-engine
ATOCAttentionUnit
false
11,855
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch from typing import Union from typing import Dict import torch.nn as nn class Model(nn.Module): """ Overview: the attention unit of the atoc network. We now implement it as two-layer MLP, same as the original paper Interface: __init__, forward .. note:: "ATOC pap...
Head
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=kernel_size // 2, bias=bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
PaParaZz1/DI-engine
Head
false
11,856
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=kernel_size // 2, bias=bias...
FeatureEmbedder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn from torch.utils import tensorboard as tensorboard class FeatureEmbedder(nn.Module): def __init__(self, d_feat, d_model): super(FeatureEmbedder, self).__init__() self.d_model = d_model self.embedder = nn.Linear(d_feat, d_model) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
Harbar-Inbound/BMT
FeatureEmbedder
false
11,857
[ "MIT" ]
0
ec8826f0633db754c7ea8d206672aa0b6b6048fd
https://github.com/Harbar-Inbound/BMT/tree/ec8826f0633db754c7ea8d206672aa0b6b6048fd
import torch import numpy as np import torch.nn as nn from torch.utils import tensorboard as tensorboard class Model(nn.Module): def __init__(self, d_feat, d_model): super().__init__() self.d_model = d_model self.embedder = nn.Linear(d_feat, d_model) self.activation = nn.ReLU() ...
BinaryCrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class BinaryCrossEntropyLoss(nn.Module): """Cross entropy loss with label smoothing regularizer. Reference: Szegedy et al. Rethinking the Inception Architecture for Computer Vision. CVPR 2016. With label smoothing, the label :math:`y` for a class is computed by...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
RndmVariableQ/deep-person-reid
BinaryCrossEntropyLoss
false
11,858
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
import torch import torch.nn as nn class Model(nn.Module): """Cross entropy loss with label smoothing regularizer. Reference: Szegedy et al. Rethinking the Inception Architecture for Computer Vision. CVPR 2016. With label smoothing, the label :math:`y` for a class is computed by .. math:: ...
Skew
# 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.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Skew(nn.Module): def forward(self, X): A = X.triu(1) return A - A.transpose(-1, -2) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import to...
LeeSHa00/PyTorch-tutorials-kr
Skew
false
11,859
[ "BSD-3-Clause" ]
0
6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
import torch import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Model(nn.Module): def forward(self, X): A = X.triu(1) return A - A.transpose(-1, -2) ...
MetaBilinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 re import torch import warnings import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ---...
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 re import warnings import torch.nn as nn from collections import OrderedDict assert_size_stride = torch._C._dynamo.guards.assert_size...
SDivakarBhat/pytorch-meta
MetaBilinear
false
11,860
[ "MIT" ]
0
74cbc8ae625d85c6b954aad159ccb26b523b2240
https://github.com/SDivakarBhat/pytorch-meta/tree/74cbc8ae625d85c6b954aad159ccb26b523b2240
import re import torch import warnings import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ---...
BridgeConnection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.utils import tensorboard as tensorboard class BridgeConnection(nn.Module): def __init__(self, in_dim, out_dim, dout_p): super(BridgeConnection, self).__init__() self.norm = nn.LayerNorm(in_dim) self.linear = nn.Linear(in_dim, out_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Harbar-Inbound/BMT
BridgeConnection
false
11,861
[ "MIT" ]
0
ec8826f0633db754c7ea8d206672aa0b6b6048fd
https://github.com/Harbar-Inbound/BMT/tree/ec8826f0633db754c7ea8d206672aa0b6b6048fd
import torch import torch.nn as nn from torch.utils import tensorboard as tensorboard class Model(nn.Module): def __init__(self, in_dim, out_dim, dout_p): super().__init__() self.norm = nn.LayerNorm(in_dim) self.linear = nn.Linear(in_dim, out_dim) self.dropout = nn.Dropout(dout_p)...
OutputTransition
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 OutputTransition(nn.Module): def __init__(self, inChans, n_labels): super(OutputTransition, self).__init__() self.final_conv = nn.Conv3d(inChans, n_labels, kernel_size=1) self.sigmoid = nn.Sigmoid() def forward(self, x): out = self.sigm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
SeanDeloddere/ModelsGenesis
OutputTransition
false
11,862
[ "MIT" ]
0
1c4d1439626b42906311a38aa5f8d4fbd7a2517a
https://github.com/SeanDeloddere/ModelsGenesis/tree/1c4d1439626b42906311a38aa5f8d4fbd7a2517a
import torch from torch import nn class Model(nn.Module): def __init__(self, inChans, n_labels): super().__init__() self.final_conv = nn.Conv3d(inChans, n_labels, kernel_size=1) self.sigmoid = nn.Sigmoid() def forward(self, x): out = self.sigmoid(self.final_conv(x)) r...
MultiheadedAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from torch.utils import tensorboard as tensorboard def attention(Q, K, V, mask, dropout=None): d_k = Q.size(-1) QKt = Q.matmul(K.transpose(-1, -2)) sm_input = QKt / np.sqrt(d_k) if mask is not None: sm_input ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Harbar-Inbound/BMT
MultiheadedAttention
false
11,863
[ "MIT" ]
0
ec8826f0633db754c7ea8d206672aa0b6b6048fd
https://github.com/Harbar-Inbound/BMT/tree/ec8826f0633db754c7ea8d206672aa0b6b6048fd
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from torch.utils import tensorboard as tensorboard def attention(Q, K, V, mask, dropout=None): d_k = Q.size(-1) QKt = Q.matmul(K.transpose(-1, -2)) sm_input = QKt / np.sqrt(d_k) if mask is not None: sm_input ...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, in_dim, out_dim, out_heads, relation_dim=0, residual =False, projection=True, layer_norm=True): super().__init__() self.in_dim = in_dim self.out_dim = out_dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
PaParaZz1/DI-engine
MultiHeadAttention
false
11,864
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim, out_dim, out_heads, relation_dim=0, residual =False, projection=True, layer_norm=True): super().__init__() self.in_dim = in_dim self.out_dim = out_dim self...
RewardModelNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 RewardModelNetwork(nn.Module): def __init__(self, input_size: 'int', hidden_size: 'int', output_size: 'int') ->None: super(RewardModelNetwork, self).__init__() self.l1 = nn.Linear(input_size, hidden_size) self.l2 = nn.Linear(hidden_size, ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
PaParaZz1/DI-engine
RewardModelNetwork
false
11,865
[ "Apache-2.0" ]
0
b38144117c1ebc6eb860d8637ec8866dfbcdf2de
https://github.com/PaParaZz1/DI-engine/tree/b38144117c1ebc6eb860d8637ec8866dfbcdf2de
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size: 'int', hidden_size: 'int', output_size: 'int') ->None: super().__init__() self.l1 = nn.Linear(input_size, hidden_size) self.l2 = nn.Linear(hidden_size, output_size) self.a1 = nn.Tanh(...
AvgPoolPad
# 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 AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=False) def forwa...
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...
RndmVariableQ/deep-person-reid
AvgPoolPad
false
11,866
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, stride=2, padding=1): super().__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=False) def forward(self, x): ...
Log_Cosh_Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class Log_Cosh_Loss(torch.nn.Module): def forward(self, logits, labels): return torch.mean(torch.log(torch.cosh(labels - logits))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
ShengboWang1/wave-u-net-DEMAND28
Log_Cosh_Loss
false
11,867
[ "MIT" ]
0
fe8b57220d885d5fdad33b303c0565f2286ba549
https://github.com/ShengboWang1/wave-u-net-DEMAND28/tree/fe8b57220d885d5fdad33b303c0565f2286ba549
import torch class Model(torch.nn.Module): def forward(self, logits, labels): return torch.mean(torch.log(torch.cosh(labels - logits))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Simplified_Pose_Model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from collections import OrderedDict import torch.nn as nn def make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from collections import Order...
Schwartz-Zha/My_Pose_Estimation
Simplified_Pose_Model
false
11,868
[ "MIT" ]
0
0ccaccf58498b2200842c155b735e1103c28c5ba
https://github.com/Schwartz-Zha/My_Pose_Estimation/tree/0ccaccf58498b2200842c155b735e1103c28c5ba
import torch from collections import OrderedDict import torch.nn as nn def make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, l...
HardAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn import functional as F import torch.nn as nn class HardAttn(nn.Module): """Hard Attention (Sec. 3.1.II)""" def __init__(self, in_channels): super(HardAttn, self).__init__() self.fc = nn.Linear(in_channels, 4 * 2) self.init_params() def init_params(self)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
RndmVariableQ/deep-person-reid
HardAttn
false
11,869
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
import torch from torch.nn import functional as F import torch.nn as nn class Model(nn.Module): """Hard Attention (Sec. 3.1.II)""" def __init__(self, in_channels): super().__init__() self.fc = nn.Linear(in_channels, 4 * 2) self.init_params() def init_params(self): self.fc...
FocalLossSigmoid
# 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 math import sqrt as sqrt from itertools import product as product class FocalLossSigmoid(nn.Module): """ sigmoid version focal loss """ def __init__(self, alpha=0.25, gamma=2, size_average=False): super(FocalLossSigmoid, self).__init__() self.al...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Shi-Yuyao/SSD_Pytorch
FocalLossSigmoid
false
11,870
[ "MIT" ]
0
870732682935a8523b5232fac3bdb080c5a59cf9
https://github.com/Shi-Yuyao/SSD_Pytorch/tree/870732682935a8523b5232fac3bdb080c5a59cf9
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class Model(nn.Module): """ sigmoid version focal loss """ def __init__(self, alpha=0.25, gamma=2, size_average=False): super().__init__() self.alpha = alpha self.gamma = ...
MaxPoolPad
# 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 MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) x = self.pool(x) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
RndmVariableQ/deep-person-reid
MaxPoolPad
false
11,871
[ "MIT" ]
0
9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
https://github.com/RndmVariableQ/deep-person-reid/tree/9ab8343b2fc2ac130aeca5bc2bd1ae808e9ce1b9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) x = self.pool(x) x = x[:, :, 1:, 1:]....
VAE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 VAE(nn.Module): def __init__(self, n_features): super(VAE, self).__init__() self.fc1 = nn.Linear(n_features, 1000) self.fc2 = nn.Linear(1000, n_features) def encode(self, x): h1 = F.relu(self.fc1(x)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
ShengquanChen/stPlus
VAE
false
11,872
[ "MIT" ]
0
b2af43a4fe78230ddf95cab75c114e25527800e1
https://github.com/ShengquanChen/stPlus/tree/b2af43a4fe78230ddf95cab75c114e25527800e1
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_features): super().__init__() self.fc1 = nn.Linear(n_features, 1000) self.fc2 = nn.Linear(1000, n_features) def encode(self, x): h1 = F.relu(self.fc1(x)) ret...
ContinousRotReprDecoder
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class ContinousRotReprDecoder(nn.Module): def __init__(self): super(ContinousRotReprDecoder, self).__init__() def forward(self, module_input): reshaped_input = module_input.view(-1, 3, 2) b1 = F.normalize(reshaped_inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
ShivamDuggal4/human_body_prior
ContinousRotReprDecoder
false
11,873
[ "Xnet", "X11" ]
0
e5544560e98ff3bb6d2492b2b32660dd3defed92
https://github.com/ShivamDuggal4/human_body_prior/tree/e5544560e98ff3bb6d2492b2b32660dd3defed92
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, module_input): reshaped_input = module_input.view(-1, 3, 2) b1 = F.normalize(reshaped_input[:, :, 0], dim=1) dot_prod = torch.su...
ScaleNorm
# 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 ScaleNorm(nn.Module): """ScaleNorm""" def __init__(self, scale, eps=1e-05): super(ScaleNorm, self).__init__() self.scale = scale self.eps = eps def forward(self, x): norm = self.scale / torch.norm(x, dim=1, keepdim=True).clamp(min=...
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...
Siujohnjai/MS-G3D
ScaleNorm
false
11,874
[ "MIT" ]
0
615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
https://github.com/Siujohnjai/MS-G3D/tree/615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
import torch import torch.nn as nn class Model(nn.Module): """ScaleNorm""" def __init__(self, scale, eps=1e-05): super().__init__() self.scale = scale self.eps = eps def forward(self, x): norm = self.scale / torch.norm(x, dim=1, keepdim=True).clamp(min= self.e...
Charbonnier
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.model_zoo class Charbonnier(nn.Module): def __init__(self): super(Charbonnier, self).__init__() self.eps = 1e-06 def forward(self, X, Y): diff = torch.add(X, -Y) error = torch.sqrt(diff * diff + self.eps) loss = to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
SimoneDutto/EDSR
Charbonnier
false
11,875
[ "MIT" ]
0
a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
https://github.com/SimoneDutto/EDSR/tree/a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
import torch import torch.nn as nn import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.eps = 1e-06 def forward(self, X, Y): diff = torch.add(X, -Y) error = torch.sqrt(diff * diff + self.eps) loss = torch.sum(error) ...
UnfoldTemporalWindows
# 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 UnfoldTemporalWindows(nn.Module): def __init__(self, window_size, window_stride, window_dilation=1): super().__init__() self.window_size = window_size self.window_stride = window_stride self.window_dilation = window_dilation self.pa...
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...
Siujohnjai/MS-G3D
UnfoldTemporalWindows
false
11,876
[ "MIT" ]
0
615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
https://github.com/Siujohnjai/MS-G3D/tree/615b1002ba1780f6d1fc4f7b93c9525c07aeed6a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, window_size, window_stride, window_dilation=1): super().__init__() self.window_size = window_size self.window_stride = window_stride self.window_dilation = window_dilation self.padding = (window_...
Policy
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False) self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4) self.size = 9 * 9...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ShirelJosef/deep-reinforcement-learning
Policy
false
11,877
[ "MIT" ]
0
63979b975c71e730c9d4c66e39efac210260dd18
https://github.com/ShirelJosef/deep-reinforcement-learning/tree/63979b975c71e730c9d4c66e39efac210260dd18
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False) self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4) self.size = 9 * 9 * 16 ...
FeatureResizer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.nn import torch.optim import torch.utils from torch import nn import torch.distributed class FeatureResizer(nn.Module): """ This class takes as input a set of embeddings of dimension C1 and outputs a set of embedding of dimension C2, after a l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
ShoufaChen/mdetr-1
FeatureResizer
false
11,878
[ "Apache-2.0" ]
0
3d9e40891ffdd39d6a5bf56730d468ace142752f
https://github.com/ShoufaChen/mdetr-1/tree/3d9e40891ffdd39d6a5bf56730d468ace142752f
import torch import torch.utils.data import torch import torch.nn import torch.optim import torch.utils from torch import nn import torch.distributed class Model(nn.Module): """ This class takes as input a set of embeddings of dimension C1 and outputs a set of embedding of dimension C2, after a linear tra...
Cauchy
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.model_zoo class Cauchy(nn.Module): def __init__(self): super(Cauchy, self).__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = 0.5 * self.c ** 2 * torch.log(1 + (ra / sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
SimoneDutto/EDSR
Cauchy
false
11,879
[ "MIT" ]
0
a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
https://github.com/SimoneDutto/EDSR/tree/a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
import torch import torch.nn as nn import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = 0.5 * self.c ** 2 * torch.log(1 + (ra / self.c) ** 2) ...
StableBCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class StableBCELoss(torch.nn.modules.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Song-Jingyu/Cylinder3D
StableBCELoss
false
11,880
[ "Apache-2.0" ]
0
36b59db5b45850b9657a9606e39c084dd650d750
https://github.com/Song-Jingyu/Cylinder3D/tree/36b59db5b45850b9657a9606e39c084dd650d750
import torch class Model(torch.nn.modules.Module): def __init__(self): super().__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() def get_inputs(): return [torch.r...
BCEAfterSigmoidLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from torch.nn import functional import torch.autograd class Loss(nn.Module): """A loss function.""" class PointwiseLoss(Loss): """Pointwise loss functions compute an independent loss term for each triple-label pair.""" class BCEAfterSigmoidLoss(PointwiseLoss): """A lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Sina-Baharlou/pykeen
BCEAfterSigmoidLoss
false
11,881
[ "MIT" ]
0
89984e0f7a490f3c0f0d936564b7744097130d15
https://github.com/Sina-Baharlou/pykeen/tree/89984e0f7a490f3c0f0d936564b7744097130d15
import torch from torch import nn from torch.nn import functional import torch.autograd class Loss(nn.Module): """A loss function.""" class PointwiseLoss(Loss): """Pointwise loss functions compute an independent loss term for each triple-label pair.""" class Model(PointwiseLoss): """A loss function wh...
Fair
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.model_zoo class Fair(nn.Module): def __init__(self): super(Fair, self).__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = self.c ** 2 * (ra / self.c - torch.log(1 + ra /...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
SimoneDutto/EDSR
Fair
false
11,882
[ "MIT" ]
0
a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
https://github.com/SimoneDutto/EDSR/tree/a13fd4e4950649f9a33aa2089c6db4e3920ea4d2
import torch import torch.nn as nn import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.c = 1.0 def forward(self, X, Y): r = torch.add(X, -Y) ra = torch.abs(r) error = self.c ** 2 * (ra / self.c - torch.log(1 + ra / self.c))...
OneLayerFCBodyWithAction
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class OneLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
RaviTej310/mrpvf
OneLayerFCBodyWithAction
false
11,883
[ "MIT" ]
0
f026b4704f26b85161de26ada5d6390ab549fbbd
https://github.com/RaviTej310/mrpvf/tree/f026b4704f26b85161de26ada5d6390ab549fbbd
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class Model(nn.Module): def __init__(self, state_dim, action_dim, hidd...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ShirelJosef/deep-reinforcement-learning
Actor
false
11,884
[ "MIT" ]
0
63979b975c71e730c9d4c66e39efac210260dd18
https://github.com/ShirelJosef/deep-reinforcement-learning/tree/63979b975c71e730c9d4c66e39efac210260dd18
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class Encoder(nn.Module): def __init__(self, channel=512, out_class=1, is_dis=True): super(Encoder, self).__init__() self.is_dis = is_dis self.channel = channel n_class = out_class self.conv1 = nn.Conv3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ShadowTwin41/alpha-WGAN-SigmaRat
Encoder
false
11,885
[ "MIT" ]
0
051bb8c5d7b8248e9c724d3de87c0fd771d7070f
https://github.com/ShadowTwin41/alpha-WGAN-SigmaRat/tree/051bb8c5d7b8248e9c724d3de87c0fd771d7070f
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, channel=512, out_class=1, is_dis=True): super().__init__() self.is_dis = is_dis self.channel = channel n_class = out_class self.conv1 = nn.Conv3d(1, channel //...
Critic
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
ShirelJosef/deep-reinforcement-learning
Critic
false
11,886
[ "MIT" ]
0
63979b975c71e730c9d4c66e39efac210260dd18
https://github.com/ShirelJosef/deep-reinforcement-learning/tree/63979b975c71e730c9d4c66e39efac210260dd18
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, f...
RegressorNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch import optim from torch import relu def weighted_mse_loss(inputs, target, sample_weight): if sample_weight is not None: return (sample_weight * (inputs - target) ** 2).mean() else: return ((inputs - target) ** 2).mean() class Re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 torch...
SirPopiel/IWDA
RegressorNet
false
11,887
[ "MIT" ]
0
5693b0704f1abf9f69f92fba243599c5f4056a3c
https://github.com/SirPopiel/IWDA/tree/5693b0704f1abf9f69f92fba243599c5f4056a3c
import torch import numpy as np from torch import nn from torch import optim from torch import relu def weighted_mse_loss(inputs, target, sample_weight): if sample_weight is not None: return (sample_weight * (inputs - target) ** 2).mean() else: return ((inputs - target) ** 2).mean() class Mo...
MultiAttributeLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F class MultiAttributeLoss(torch.nn.Module): def __init__(self): super(MultiAttributeLoss, self).__init__() def forward(self, input, target): product = 1 count = len(input) for i in range(count): attribute_loss = F.cross_...
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...
Spandan-Madan/generalization_biased_category_pose
MultiAttributeLoss
false
11,888
[ "MIT" ]
0
c7c289c9a75544782d5240af2286cfdd03c4b35e
https://github.com/Spandan-Madan/generalization_biased_category_pose/tree/c7c289c9a75544782d5240af2286cfdd03c4b35e
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, input, target): product = 1 count = len(input) for i in range(count): attribute_loss = F.cross_entropy(input[i], target[i]) ...
TorchJaccardLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class TorchJaccardLoss(torch.nn.modules.Module): def __init__(self): super(TorchJaccardLoss, self).__init__() def forward(self, outputs, targets): eps = 1e-15 jaccard_target = (targets == 1).float() jaccard_output = torch.sigmoid(outputs) intersection = (...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Spiruel/solaris
TorchJaccardLoss
false
11,889
[ "Apache-2.0" ]
0
eb2ce05265a462d69b01ee2b621a85a3e9082402
https://github.com/Spiruel/solaris/tree/eb2ce05265a462d69b01ee2b621a85a3e9082402
import torch class Model(torch.nn.modules.Module): def __init__(self): super().__init__() def forward(self, outputs, targets): eps = 1e-15 jaccard_target = (targets == 1).float() jaccard_output = torch.sigmoid(outputs) intersection = (jaccard_output * jaccard_target)....
h_swish
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn import functional as F import torch.nn as nn class h_swish(nn.Module): def __init__(self, inplace=True): super(h_swish, self).__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3.0, self.inplace) / 6.0 return out * x def get...
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...
SpikeKing/MobileNetV3-Classification-PyTorch
h_swish
false
11,890
[ "MIT" ]
0
ab8d64c27ace7c70bfd1611bd8452947218d9b21
https://github.com/SpikeKing/MobileNetV3-Classification-PyTorch/tree/ab8d64c27ace7c70bfd1611bd8452947218d9b21
import torch from torch.nn import functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, inplace=True): super().__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3.0, self.inplace) / 6.0 return out * x def get_inputs(): ...
TFSamepaddingLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TFSamepaddingLayer(nn.Module): """To align with tf `same` padding. Putting this before any conv layer that need padding Assuming kernel has Height == Width for simplicity """ def __init__(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Srijay-lab/hover_net
TFSamepaddingLayer
false
11,891
[ "MIT" ]
0
3f28f97bc1ed892bbe00b75a06be4334743d47d5
https://github.com/Srijay-lab/hover_net/tree/3f28f97bc1ed892bbe00b75a06be4334743d47d5
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """To align with tf `same` padding. Putting this before any conv layer that need padding Assuming kernel has Height == Width for simplicity """ def __init__(self, ksize, stride...
FreqEncoder
# 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 FreqEncoder(nn.Module): def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True, include_input=True, periodic_fns=(torch.sin, torch.cos)): super().__init__() self.input_dim = input_dim self.include_input = include_input ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
StanfordMSL/torch-ngp
FreqEncoder
false
11,892
[ "MIT" ]
0
fc5c70bd5739ce39f7f9765e2ac73ecab86bc64a
https://github.com/StanfordMSL/torch-ngp/tree/fc5c70bd5739ce39f7f9765e2ac73ecab86bc64a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True, include_input=True, periodic_fns=(torch.sin, torch.cos)): super().__init__() self.input_dim = input_dim self.include_input = include_input se...
DepthL1Loss
# 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 DepthL1Loss(nn.Module): def __init__(self, eps=1e-05): super(DepthL1Loss, self).__init__() self.eps = eps def forward(self, pred, gt): bs = pred.size()[0] img1 = torch.zeros_like(pred) img2 = torch.zeros_like(gt) img1 =...
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 ...
StannisZhou/FFB6D
DepthL1Loss
false
11,893
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-05): super().__init__() self.eps = eps def forward(self, pred, gt): bs = pred.size()[0] img1 = torch.zeros_like(pred) img2 = torch.zeros_like(gt) img1 = img1.copy_(pred) ...
OFLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss def of_l1_loss(pred_ofsts, kp_targ_ofst, labels, sigma=1.0, normalize=True, reduce=False): """ :param pred_ofsts: [bs, n_kpts, n_pts, c] :param kp_targ_ofst: [bs, n_pts, n_kpts, c] :param labels: [bs, n_pts, 1] """ w = (...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dy...
StannisZhou/FFB6D
OFLoss
false
11,894
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
import torch from torch.nn.modules.loss import _Loss def of_l1_loss(pred_ofsts, kp_targ_ofst, labels, sigma=1.0, normalize=True, reduce=False): """ :param pred_ofsts: [bs, n_kpts, n_pts, c] :param kp_targ_ofst: [bs, n_pts, n_kpts, c] :param labels: [bs, n_pts, 1] """ w = (...
TorchFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch import nn class TorchFocalLoss(nn.Module): """Implementation of Focal Loss[1]_ modified from Catalyst [2]_ . Arguments --------- gamma : :class:`int` or :class:`float` Focusing parameter. See [1]_ . alpha : :class:`int` or :class:`fl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Spiruel/solaris
TorchFocalLoss
false
11,895
[ "Apache-2.0" ]
0
eb2ce05265a462d69b01ee2b621a85a3e9082402
https://github.com/Spiruel/solaris/tree/eb2ce05265a462d69b01ee2b621a85a3e9082402
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): """Implementation of Focal Loss[1]_ modified from Catalyst [2]_ . Arguments --------- gamma : :class:`int` or :class:`float` Focusing parameter. See [1]_ . alpha : :class:`int` or :class:`float` ...
CosLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss class CosLoss(_Loss): def __init__(self, eps=1e-05): super(CosLoss, self).__init__(True) self.eps = eps def forward(self, pred_ofsts, kp_targ_ofst, labels, normalize=True): """ :param pred_ofsts: [bs, n_kpts, n_pts, c]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.g...
StannisZhou/FFB6D
CosLoss
false
11,896
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
import torch from torch.nn.modules.loss import _Loss class Model(_Loss): def __init__(self, eps=1e-05): super().__init__(True) self.eps = eps def forward(self, pred_ofsts, kp_targ_ofst, labels, normalize=True): """ :param pred_ofsts: [bs, n_kpts, n_pts, c] :param...
Critic
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, full_state_size, full_action_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 libdevice import numpy as np ...
SriramPingali/P3_collaborate_complete
Critic
false
11,897
[ "MIT" ]
0
66df22c9eb7577b15adcaa7bbc1796dbd333af2e
https://github.com/SriramPingali/P3_collaborate_complete/tree/66df22c9eb7577b15adcaa7bbc1796dbd333af2e
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): """Critic (Value) Model.""" def __init__(self, full_state_size, full_action_siz...
OfstMapL1Loss
# 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 OfstMapL1Loss(nn.Module): def __init__(self, eps=1e-05): super().__init__() self.eps = eps def forward(self, rgb_labels, pred, gt, normalize=True, reduce=True): wgt = (rgb_labels > 1e-08).float() bs, n_kpts, c, h, w = pred.size() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
StannisZhou/FFB6D
OfstMapL1Loss
false
11,898
[ "MIT" ]
0
5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
https://github.com/StannisZhou/FFB6D/tree/5e7534805cd2e397427886d9a2a8ecfbb4f6cdfe
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-05): super().__init__() self.eps = eps def forward(self, rgb_labels, pred, gt, normalize=True, reduce=True): wgt = (rgb_labels > 1e-08).float() bs, n_kpts, c, h, w = pred.size() wgt =...
Envelope
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class Envelope(torch.nn.Module): def __init__(self, exponent): super(Envelope, self).__init__() self.p = exponent + 1 self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
THinnerichs/pytorch_geometric
Envelope
false
11,899
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, exponent): super().__init__() self.p = exponent + 1 self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 def forward(self, x):...
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 import torch.nn.functional as F def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, fc1_uni...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SriramPingali/P3_collaborate_complete
Actor
false
11,900
[ "MIT" ]
0
66df22c9eb7577b15adcaa7bbc1796dbd333af2e
https://github.com/SriramPingali/P3_collaborate_complete/tree/66df22c9eb7577b15adcaa7bbc1796dbd333af2e
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, fc1_uni...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ outputs the limits for the values in the hidden layer for initialisation""" fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl
Actor
false
11,901
[ "MIT" ]
0
f3e811a3ae3eb603173c2475bbfe1de91074ecdc
https://github.com/SHIVOH/DeepReinforcementLearning-DDPG-for-RoboticsControl/tree/f3e811a3ae3eb603173c2475bbfe1de91074ecdc
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): """ outputs the limits for the values in the hidden layer for initialisation""" fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): ...
Conv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pair def keep_variance_fn(x): return x + 0.001 class Conv2d(_ConvNd): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pa...
THAKAORI/SalsaNext
Conv2d
false
11,902
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import torch.nn.functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pair def keep_variance_fn(x): return x + 0.001 class Model(_ConvNd): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=...
Symmetric
# 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.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Symmetric(nn.Module): def forward(self, X): return X.triu() + X.triu(1).transpose(-1, -2) def ge...
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.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import to...
LeeSHa00/PyTorch-tutorials-kr
Symmetric
false
11,903
[ "BSD-3-Clause" ]
0
6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
https://github.com/LeeSHa00/PyTorch-tutorials-kr/tree/6a25b48b1a6cc96ea4edebeede2e419ef73b96fc
import torch import torch.nn as nn import torch.quantization import torch.onnx import torch.nn.parallel import torch.utils.data import torch.fx import torch.nn import torch.optim import torch.profiler class Model(nn.Module): def forward(self, X): return X.triu() + X.triu(1).transpose(-1, -2) def get_in...
Softmax
# 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 keep_variance_fn(x): return x + 0.001 class Softmax(nn.Module): def __init__(self, dim=1, keep_variance_fn=None): super(Softmax, self).__init__() self.dim = dim self._keep_variance_fn = keep_variance_fn def forward(self, features_mean, fea...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
THAKAORI/SalsaNext
Softmax
false
11,904
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import torch.nn as nn def keep_variance_fn(x): return x + 0.001 class Model(nn.Module): def __init__(self, dim=1, keep_variance_fn=None): super().__init__() self.dim = dim self._keep_variance_fn = keep_variance_fn def forward(self, features_mean, features_variance,...
APL
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn.parameter import Parameter class APL(nn.Module): """ Implementation of APL (ADAPTIVE PIECEWISE LINEAR UNITS) unit: .. math:: APL(x_i) = max(0,x) + \\sum_{s=1}^{S}{a_i^s * max(0, -x + b_i^s)} with trainable parameters a and b, parameter...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from torch.nn.parameter import Parameter assert_size_stride = torch....
THEFASHIONGEEK/Echo
APL
false
11,905
[ "MIT" ]
0
8dcf279ca528f2bfd255f79de07c1a221512c6a0
https://github.com/THEFASHIONGEEK/Echo/tree/8dcf279ca528f2bfd255f79de07c1a221512c6a0
import torch from torch import nn from torch.nn.parameter import Parameter class Model(nn.Module): """ Implementation of APL (ADAPTIVE PIECEWISE LINEAR UNITS) unit: .. math:: APL(x_i) = max(0,x) + \\sum_{s=1}^{S}{a_i^s * max(0, -x + b_i^s)} with trainable parameters a and b, paramet...
SimpleNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class SimpleNet(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): """Defines layers of a neural network. :param input_dim: Number of input features :param hidden_dim: Size of ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Stas-Medvedev/ML-Case-Studies
SimpleNet
false
11,906
[ "MIT" ]
0
88aa33334245cd028cf3adfba4ba3eecaef32708
https://github.com/Stas-Medvedev/ML-Case-Studies/tree/88aa33334245cd028cf3adfba4ba3eecaef32708
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): """Defines layers of a neural network. :param input_dim: Number of input features :param hidden_dim: Size of hidd...
BeitAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch from typing import List from typing import Tuple from torch import nn from typing import Set import torch.utils.checkpoint def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int', head_size: 'int', already_pruned_heads: 'Set[in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Clemens123/transformers
BeitAttention
false
11,907
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
from _paritybench_helpers import _mock_config import math import torch from typing import List from typing import Tuple from torch import nn from typing import Set import torch.utils.checkpoint def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int', head_size: 'int', already_pruned_heads: 'Set[in...
BertOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(BertLayerNorm, self).__ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
Stephen0808/WebQA
BertOutput
false
11,908
[ "Apache-2.0" ]
0
b9758932a9d0d75167ec837bb6ee8bc571c64681
https://github.com/Stephen0808/WebQA/tree/b9758932a9d0d75167ec837bb6ee8bc571c64681
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super().__init__() self....
MaxPool2d
# 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 from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0)))...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
THAKAORI/SalsaNext
MaxPool2d
false
11,909
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0)))...
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 torch.nn.functional as F import torch.utils.data class ShiftedSoftplus(torch.nn.Module): def __init__(self): super(ShiftedSoftplus, self).__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_...
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.utils.data assert_size_stride = torch._C._dynamo....
THinnerichs/pytorch_geometric
ShiftedSoftplus
false
11,910
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
import torch import torch.nn.functional as F import torch.utils.data class Model(torch.nn.Module): def __init__(self): super().__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_inputs(): return [torch.ran...
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 from torch import nn from torch.nn.parameter import Parameter class SReLU(nn.Module): """ SReLU (S-shaped Rectified Linear Activation Unit): a combination of three linear functions, which perform mapping R → R with the following formulation: .. math:: h(x_i) = \\left\\{\\begin{matri...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_...
THEFASHIONGEEK/Echo
SReLU
false
11,911
[ "MIT" ]
0
8dcf279ca528f2bfd255f79de07c1a221512c6a0
https://github.com/THEFASHIONGEEK/Echo/tree/8dcf279ca528f2bfd255f79de07c1a221512c6a0
import torch from torch import nn from torch.nn.parameter import Parameter class Model(nn.Module): """ SReLU (S-shaped Rectified Linear Activation Unit): a combination of three linear functions, which perform mapping R → R with the following formulation: .. math:: h(x_i) = \\left\\{\\begin{matri...
RPN_Up
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 RPN_Up(nn.Module): """ For SiamRPN """ def __init__(self, anchor_nums=5, inchannels=256, outchannels=256, cls_type='thicker'): super(RPN_Up, self).__init__() self.anchor_nums = anchor_nums self.in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
Re3write/siamdw
RPN_Up
false
11,912
[ "MIT" ]
0
f5d7d4bda36cb8c14e93b460fbc77bb225aa8572
https://github.com/Re3write/siamdw/tree/f5d7d4bda36cb8c14e93b460fbc77bb225aa8572
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ For SiamRPN """ def __init__(self, anchor_nums=5, inchannels=256, outchannels=256, cls_type='thicker'): super().__init__() self.anchor_nums = anchor_nums self.inchannels = in...
IdentityMessage
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class IdentityMessage(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super(IdentityMessage, self).__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src, z_dst, raw_msg...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
THinnerichs/pytorch_geometric
IdentityMessage
false
11,913
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super().__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src, z_dst, raw_msg, t_enc): return torch....
InnerProductDecoder
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class InnerProductDecoder(torch.nn.Module): """The inner product decoder from the `"Variational Graph Auto-Encoders" <https://arxiv.org/abs/1611.07308>`_ paper .. math:: \\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top}) where :math:`\\mathbf{Z} \\in \\mathbb{R}^{N ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
THinnerichs/pytorch_geometric
InnerProductDecoder
false
11,914
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
import torch import torch.utils.data class Model(torch.nn.Module): """The inner product decoder from the `"Variational Graph Auto-Encoders" <https://arxiv.org/abs/1611.07308>`_ paper .. math:: \\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top}) where :math:`\\mathbf{Z} \\in \\mathbb{R}^{N \\times d}` de...