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
NasPathBranch
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def conv1x1(in_channels, out_channels, stride=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int...
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.utils.data assert_size_stride = torch._C._dyn...
earhian/imgclsmob
NasPathBranch
false
6,628
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
import torch import torch.nn as nn import torch.utils.data def conv1x1(in_channels, out_channels, stride=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int...
IBNbResInitBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def ibnb_conv7x7_block(in_channels, out_channels, stride=1, padding=3, bias =False, activate=True): """ 7x7 version of the IBN(b)-ResNet specific convolution block. Parameters: ---------- in_channels : int Number of input chan...
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....
earhian/imgclsmob
IBNbResInitBlock
false
6,629
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
import torch import torch.nn as nn import torch.utils.data def ibnb_conv7x7_block(in_channels, out_channels, stride=1, padding=3, bias =False, activate=True): """ 7x7 version of the IBN(b)-ResNet specific convolution block. Parameters: ---------- in_channels : int Number of input chan...
BCEFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class BCEFocalLoss(nn.Module): """Implementation of Focal Loss for Binary Classification Problems. Focal loss was proposed in [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002). """ def __init__(self, gamma=0, eps=1e-07, reduction='mean'): ...
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...
earlbabson/torchflare
BCEFocalLoss
false
6,630
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
import torch import torch.nn as nn class Model(nn.Module): """Implementation of Focal Loss for Binary Classification Problems. Focal loss was proposed in [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002). """ def __init__(self, gamma=0, eps=1e-07, reduction='mean'): "...
LeNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 LeNet(nn.Module): def __init__(self): super().__init__() self.conv_1 = nn.Conv2d(3, 6, kernel_size=5, padding=2) self.sigmoid = nn.Sigmoid() self.avgpool = nn.AvgPool2d(kernel_size=5, stride=2) self.conv_2 = nn.Conv2d(6, 16, kernel_...
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...
ducnguyenhuynh/via-trafficsign-classification
LeNet
false
6,631
[ "MIT" ]
1
e65fccc1ee377603334453eacfc3f65619dc0714
https://github.com/ducnguyenhuynh/via-trafficsign-classification/tree/e65fccc1ee377603334453eacfc3f65619dc0714
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv_1 = nn.Conv2d(3, 6, kernel_size=5, padding=2) self.sigmoid = nn.Sigmoid() self.avgpool = nn.AvgPool2d(kernel_size=5, stride=2) self.conv_2 = nn.Conv2d(6, 16, kernel_...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class FocalLoss(nn.Module): """Implementation of Focal Loss. Focal loss was proposed in [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002). """ def __init__(self, gamma=0, eps=1e-07, reduction='mean'): """Constructor Method for FocalL...
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 ...
earlbabson/torchflare
FocalLoss
false
6,632
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
import torch import torch.nn as nn class Model(nn.Module): """Implementation of Focal Loss. Focal loss was proposed in [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002). """ def __init__(self, gamma=0, eps=1e-07, reduction='mean'): """Constructor Method for FocalLoss ...
EncoderUnit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Layer Attributes ---------- softmax : nn.Functional softmax function applied at the last dimension """ def __init__(self, dropout=0.1): super(ScaledD...
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....
dugusword/transformer
EncoderUnit
false
6,633
[ "MIT" ]
1
7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
https://github.com/dugusword/transformer/tree/7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
import math import torch from torch import nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Layer Attributes ---------- softmax : nn.Functional softmax function applied at the last dimension """ def __init__(self, dropout=0.1): super().__ini...
SqueezeInitBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 SqueezeInitBlock(nn.Module): """ SqueezeNet specific initial block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int or tuple/...
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 ...
earhian/imgclsmob
SqueezeInitBlock
false
6,634
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """ SqueezeNet specific initial block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int or tuple/list of 2 i...
WRNBottleneck
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def wrn_conv1x1(in_channels, out_channels, stride, activate): """ 1x1 version of the WRN specific convolution block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of outpu...
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 ...
earhian/imgclsmob
WRNBottleneck
false
6,635
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
import torch import torch.nn as nn import torch.utils.data def wrn_conv1x1(in_channels, out_channels, stride, activate): """ 1x1 version of the WRN specific convolution block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of outpu...
SSE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 SSE(nn.Module): """SSE : Channel Squeeze and Spatial Excitation block. Paper : <https://arxiv.org/abs/1803.02579> Adapted from <https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178> """ def __init__(self, in_channels): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
earlbabson/torchflare
SSE
false
6,636
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
import torch import torch.nn as nn class Model(nn.Module): """SSE : Channel Squeeze and Spatial Excitation block. Paper : <https://arxiv.org/abs/1803.02579> Adapted from <https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178> """ def __init__(self, in_channels): ...
WRNInitBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 WRNConv(nn.Module): """ WRN specific convolution block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int or tuple/list of 2 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 import torch.nn as nn import ...
earhian/imgclsmob
WRNInitBlock
false
6,637
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
import torch import torch.nn as nn import torch.utils.data class WRNConv(nn.Module): """ WRN specific convolution block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int or tuple/list of 2 in...
TripletLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn def cosine_dist(x, y): """Computes Cosine Distance.""" x = F.normalize(x, dim=1) y = F.normalize(y, dim=1) dist = 2 - 2 * torch.mm(x, y.t()) return dist def euclidean_dist(x, y): """Computes Euclidean distance.""" m, n = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
earlbabson/torchflare
TripletLoss
false
6,638
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
import torch import torch.nn.functional as F import torch.nn as nn def cosine_dist(x, y): """Computes Cosine Distance.""" x = F.normalize(x, dim=1) y = F.normalize(y, dim=1) dist = 2 - 2 * torch.mm(x, y.t()) return dist def euclidean_dist(x, y): """Computes Euclidean distance.""" m, n = ...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def calculate_segmentation_statistics(outputs: 'torch.Tensor', targets: 'torch.Tensor', class_dim: 'int'=1, threshold=None): """Compute calculate segmentation statistics. Args: outputs: torch.Tensor. targets: torch.Tensor. threshold: threshold fo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
earlbabson/torchflare
DiceLoss
false
6,639
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
import torch import torch.nn as nn def calculate_segmentation_statistics(outputs: 'torch.Tensor', targets: 'torch.Tensor', class_dim: 'int'=1, threshold=None): """Compute calculate segmentation statistics. Args: outputs: torch.Tensor. targets: torch.Tensor. threshold: threshold fo...
Classifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Classifier(nn.Module): def __init__(self, z_dim, hidden_dim, class_dim): super().__init__() self.fc1 = nn.Linear(z_dim, hidden_dim) self.fc2 = nn.Linear(hidden_dim, class_dim) self.softplus = nn.Softplus() self.softmax = nn.Softmax(...
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....
einbandi/samplednn
Classifier
false
6,640
[ "MIT" ]
1
3525e46ab5096a569dde40e5a10d6ee05128ec7d
https://github.com/einbandi/samplednn/tree/3525e46ab5096a569dde40e5a10d6ee05128ec7d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, z_dim, hidden_dim, class_dim): super().__init__() self.fc1 = nn.Linear(z_dim, hidden_dim) self.fc2 = nn.Linear(hidden_dim, class_dim) self.softplus = nn.Softplus() self.softmax = nn.Softmax(dim=1...
IOULoss
# 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 calculate_segmentation_statistics(outputs: 'torch.Tensor', targets: 'torch.Tensor', class_dim: 'int'=1, threshold=None): """Compute calculate segmentation statistics. Args: outputs: torch.Tensor. targets: torch.Tensor. threshold: threshold fo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
earlbabson/torchflare
IOULoss
false
6,641
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
import torch import torch.nn as nn def calculate_segmentation_statistics(outputs: 'torch.Tensor', targets: 'torch.Tensor', class_dim: 'int'=1, threshold=None): """Compute calculate segmentation statistics. Args: outputs: torch.Tensor. targets: torch.Tensor. threshold: threshold fo...
MeshEdgeEmbeddingLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 from torch import nn class MeshEdgeEmbeddingLayer(nn.Module): """ Very important - who said that a-c is meaningfull at first layer... """ def __init__(self, input_size, embedding_size, bias=True): super(MeshEdgeEmbeddingLayer, self).__init__()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch from torch import nn assert_size_stride = t...
eldadp100/The-Mesh-Transformer
MeshEdgeEmbeddingLayer
false
6,642
[ "MIT" ]
1
b3ab18f774251feff1093040dfdcf7b836a43505
https://github.com/eldadp100/The-Mesh-Transformer/tree/b3ab18f774251feff1093040dfdcf7b836a43505
import torch import torch.utils.data import torch from torch import nn class Model(nn.Module): """ Very important - who said that a-c is meaningfull at first layer... """ def __init__(self, input_size, embedding_size, bias=True): super().__init__() self.lin = nn.Linear(input_size, emb...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Decoder(nn.Module): def __init__(self, z_dim, hidden_dim, input_dim): super().__init__() self.fc1 = nn.Linear(z_dim, hidden_dim) self.fc21 = nn.Linear(hidden_dim, input_dim) self.softplus = nn.Softplus() self.sigmoid = nn.Sigmoid() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
einbandi/samplednn
Decoder
false
6,643
[ "MIT" ]
1
3525e46ab5096a569dde40e5a10d6ee05128ec7d
https://github.com/einbandi/samplednn/tree/3525e46ab5096a569dde40e5a10d6ee05128ec7d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, z_dim, hidden_dim, input_dim): super().__init__() self.fc1 = nn.Linear(z_dim, hidden_dim) self.fc21 = nn.Linear(hidden_dim, input_dim) self.softplus = nn.Softplus() self.sigmoid = nn.Sigmoid() ...
AuxiliaryConvolutions
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data class AuxiliaryConvolutions(nn.Module): """ Additional convolutions to produce higher-level feature maps. """ def __init__(self): super(Auxilia...
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 from ite...
dee-walia20/SSD-Implementation-using-Pytorch
AuxiliaryConvolutions
false
6,644
[ "MIT" ]
1
2a7dcdcea2787f4bffd45f335819f08af2b525dd
https://github.com/dee-walia20/SSD-Implementation-using-Pytorch/tree/2a7dcdcea2787f4bffd45f335819f08af2b525dd
import torch from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data class Model(nn.Module): """ Additional convolutions to produce higher-level feature maps. """ def __init__(self): super().__init__() se...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GELU(nn.Module): def forward(self, x): return torch.sigmoid(1.702 * 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
endaaman/augmix
GELU
false
6,645
[ "Apache-2.0" ]
1
11c86a126c7b261ca178a715763763ca22b20b81
https://github.com/endaaman/augmix/tree/11c86a126c7b261ca178a715763763ca22b20b81
import torch import torch.nn as nn class Model(nn.Module): def forward(self, x): return torch.sigmoid(1.702 * x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Noise_injector
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def truncated_normal_(tensor, mean=0, std=1): size = tensor.shape tmp = tensor.new_empty(size + (4,)).normal_() valid = (tmp < 2) & (tmp > -2) ind = valid.max(-1, keepdim=True)[1] tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1)) tensor.data.mul_(std).add_(m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
dkgupta90/CARMSS
Noise_injector
false
6,646
[ "Apache-2.0" ]
1
1f397caa39b9f504951285eff150857f7d86a7c3
https://github.com/dkgupta90/CARMSS/tree/1f397caa39b9f504951285eff150857f7d86a7c3
import torch import torch.nn as nn def truncated_normal_(tensor, mean=0, std=1): size = tensor.shape tmp = tensor.new_empty(size + (4,)).normal_() valid = (tmp < 2) & (tmp > -2) ind = valid.max(-1, keepdim=True)[1] tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1)) tensor.data.mul_(std).add_(m...
VoxelFeatureExtractor
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class VoxelFeatureExtractor(nn.Module): """Computes mean of non-zero points within voxel.""" def forward(self, feature, occupancy): """ :feature FloatTensor of shape (N, K, C) :return FloatTensor of shape (N, C) """ denominator = occup...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
eraofelix/PV-RCNN
VoxelFeatureExtractor
false
6,647
[ "MIT" ]
1
6361ec99cc1c92120263ef56b2c2b003c2cd7264
https://github.com/eraofelix/PV-RCNN/tree/6361ec99cc1c92120263ef56b2c2b003c2cd7264
import torch from torch import nn class Model(nn.Module): """Computes mean of non-zero points within voxel.""" def forward(self, feature, occupancy): """ :feature FloatTensor of shape (N, K, C) :return FloatTensor of shape (N, C) """ denominator = occupancy.type_as(fea...
QModReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.fx class QModReLU(torch.nn.Module): """ Quaternion ModeReLU """ def __init__(self, bias=0): super().__init__() self.bias = torch.nn.Parameter(torch.Tensor([bias])) def forward(self, x): norm = x.norm() retu...
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.fx assert_size_...
eleGAN23/HI2I
QModReLU
false
6,648
[ "MIT" ]
1
7730ee0963614290099b011c113048ef6d1b149c
https://github.com/eleGAN23/HI2I/tree/7730ee0963614290099b011c113048ef6d1b149c
import torch import torch.nn.functional as F import torch.fx class Model(torch.nn.Module): """ Quaternion ModeReLU """ def __init__(self, bias=0): super().__init__() self.bias = torch.nn.Parameter(torch.Tensor([bias])) def forward(self, x): norm = x.norm() return ...
DecoderNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 DecoderNet(nn.Module): """ The decoder takes an interpolated feature vector and turn it into the output signal. This net is intended to be very lightweight, it has only one hidden layer. """ def __init__(self, feature_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
eliemichel/ReACORN
DecoderNet
false
6,649
[ "MIT" ]
1
74501551ecb387352271674efb2ed6240d234df6
https://github.com/eliemichel/ReACORN/tree/74501551ecb387352271674efb2ed6240d234df6
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ The decoder takes an interpolated feature vector and turn it into the output signal. This net is intended to be very lightweight, it has only one hidden layer. """ def __init__(self, feature_size, s...
AlexOutputBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 AlexDense(nn.Module): """ AlexNet specific dense block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. """ def __init__(self, in_channels...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
AlexOutputBlock
false
6,650
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
import torch import torch.nn as nn import torch.utils.data class AlexDense(nn.Module): """ AlexNet specific dense block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. """ def __init__(self, in_channels...
SelfAttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class SelfAttentionLayer(nn.Module): def __init__(self, elem_size, embd_size): super(SelfAttentionLayer, self).__init__() self.embd_size = embd_size self.query_lin = nn.Linea...
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....
eldadp100/The-Mesh-Transformer
SelfAttentionLayer
false
6,651
[ "MIT" ]
1
b3ab18f774251feff1093040dfdcf7b836a43505
https://github.com/eldadp100/The-Mesh-Transformer/tree/b3ab18f774251feff1093040dfdcf7b836a43505
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, elem_size, embd_size): super().__init__() self.embd_size = embd_size self.query_lin = nn.Linear(elem_size, embd_size) self....
BatchNorm2D_noparam
# 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 BatchNorm2D_noparam(nn.Module): def __init__(self, eps=1e-08): super(BatchNorm2D_noparam, self).__init__() self.eps = eps def forward(self, x): _bs, _c, _h, _w = x.shape mean = torch.mean(x, (0, 2, 3), keepdim=True) var = torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ericlearning/General-I2I
BatchNorm2D_noparam
false
6,652
[ "MIT" ]
1
ba7c5d6a582bdf2e7b53c0e20c31e9097b1883a9
https://github.com/ericlearning/General-I2I/tree/ba7c5d6a582bdf2e7b53c0e20c31e9097b1883a9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-08): super().__init__() self.eps = eps def forward(self, x): _bs, _c, _h, _w = x.shape mean = torch.mean(x, (0, 2, 3), keepdim=True) var = torch.var(x, (0, 2, 3), keepdim=True) ...
CReLU
# 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 CReLU(nn.ReLU): def __init__(self): super(CReLU, self).__init__() def forward(self, input): return torch.cat((F.relu(input, self.inplace), F.relu(-input, self. inplace)), 1) def get_inputs(): return [t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ethancaballero/multi-agent-reinforcement-learning-for-emergent-communication
CReLU
false
6,653
[ "MIT" ]
1
426edaa1ee58b467dfc0f46fe1f83ceea26f2ed7
https://github.com/ethancaballero/multi-agent-reinforcement-learning-for-emergent-communication/tree/426edaa1ee58b467dfc0f46fe1f83ceea26f2ed7
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.ReLU): def __init__(self): super().__init__() def forward(self, input): return torch.cat((F.relu(input, self.inplace), F.relu(-input, self. inplace)), 1) def get_inputs(): return [torch.rand([...
LigthSpeechLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data class LigthSpeechLoss(nn.Module): """ LigthSpeech Loss """ def __init__(self): super(LigthSpeechLoss, self).__init__() def forward(self, mel, padd_predicted, cemb_out, mel_tac2_target, D, cemb): mel_loss = nn.MSELoss()(mel, mel_ta...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
entn-at/LightSpeech
LigthSpeechLoss
false
6,654
[ "MIT" ]
1
48250fbcede4b258ba13ab17e3e83afc5fe85a01
https://github.com/entn-at/LightSpeech/tree/48250fbcede4b258ba13ab17e3e83afc5fe85a01
import torch from torch import nn import torch.utils.data class Model(nn.Module): """ LigthSpeech Loss """ def __init__(self): super().__init__() def forward(self, mel, padd_predicted, cemb_out, mel_tac2_target, D, cemb): mel_loss = nn.MSELoss()(mel, mel_tac2_target) similarity_l...
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 from torch import nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=10, kernel_size= (7, 3)) self.pool = nn.MaxPool2d(kernel_size=(1, 3)) self.conv2 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
elliottwaissbluth/tensor-hero
Net
false
6,655
[ "MIT" ]
1
be99ca4380a5ec59c0826e5fc8a87ec0f8956201
https://github.com/elliottwaissbluth/tensor-hero/tree/be99ca4380a5ec59c0826e5fc8a87ec0f8956201
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=10, kernel_size= (7, 3)) self.pool = nn.MaxPool2d(kernel_size=(1, 3)) self.conv2 = nn.Con...
GaussianSample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Stochastic(nn.Module): """ Base stochastic layer that uses the reparametrization trick [Kingma 2013] to draw a sample from a distribution parametrised by mu and log_var. """ def reparametrize(self, mu, logvar): epsilon = torch.randn(mu.size...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math...
ericli0419/SCALEX
GaussianSample
false
6,656
[ "MIT" ]
1
2fedbe4c3287cf86de7b786c98122fe45707416e
https://github.com/ericli0419/SCALEX/tree/2fedbe4c3287cf86de7b786c98122fe45707416e
import torch import torch.nn as nn class Stochastic(nn.Module): """ Base stochastic layer that uses the reparametrization trick [Kingma 2013] to draw a sample from a distribution parametrised by mu and log_var. """ def reparametrize(self, mu, logvar): epsilon = torch.randn(mu.size...
PatchedSelfAttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class SelfAttentionLayer(nn.Module): def __init__(self, elem_size, embd_size): super(SelfAttentionLayer, self).__init__() self.embd_size = embd_size self.query_lin = nn.Linea...
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....
eldadp100/The-Mesh-Transformer
PatchedSelfAttentionLayer
false
6,657
[ "MIT" ]
1
b3ab18f774251feff1093040dfdcf7b836a43505
https://github.com/eldadp100/The-Mesh-Transformer/tree/b3ab18f774251feff1093040dfdcf7b836a43505
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class SelfAttentionLayer(nn.Module): def __init__(self, elem_size, embd_size): super().__init__() self.embd_size = embd_size self.query_lin = nn.Linear(elem_size, embd_size) ...
SpatialAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv1d(2, 1, kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
esbgkannan/GT-CNN
SpatialAttention
false
6,658
[ "MIT" ]
1
4f3828d7ed8f6c3ed796fa4e2e166ef5c16cb3d9
https://github.com/esbgkannan/GT-CNN/tree/4f3828d7ed8f6c3ed796fa4e2e166ef5c16cb3d9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, kernel_size=7): super().__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv1d(2, 1, kernel_size, padding=padding, bias=False)...
MyLinear
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from torch.nn import functional as F class MyLinear(nn.Module): def __init__(self, in_units, units): super().__init__() self.weight = nn.Parameter(torch.randn(in_units, units)) self.bias = nn.Parameter(torch.randn(units)) def forward(self, X): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
eunice012716/Intern-Training
MyLinear
false
6,659
[ "MIT" ]
1
c3bbf42448a0b41e96d88569b6cfd57d78338716
https://github.com/eunice012716/Intern-Training/tree/c3bbf42448a0b41e96d88569b6cfd57d78338716
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_units, units): super().__init__() self.weight = nn.Parameter(torch.randn(in_units, units)) self.bias = nn.Parameter(torch.randn(units)) def forward(self, X): l...
BCE_Dice
# 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 IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=1): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
evilidol/kaggle-Steel-Defect-Detection
BCE_Dice
false
6,660
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=1): ...
PrimaryCaps
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class PrimaryCaps(nn.Module): """Creates a primary convolutional capsule layer that outputs a pose matrix and an activation. Note that for computation convenience, pose matrix are stored in first part while the activations are stored in the second part. Arg...
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...
esdrascosta/Matrix-Capsules
PrimaryCaps
false
6,661
[ "MIT" ]
1
ddf35dfa1acfb51a11a3ec27e15fe863a2ff6fa4
https://github.com/esdrascosta/Matrix-Capsules/tree/ddf35dfa1acfb51a11a3ec27e15fe863a2ff6fa4
import torch import torch.nn as nn class Model(nn.Module): """Creates a primary convolutional capsule layer that outputs a pose matrix and an activation. Note that for computation convenience, pose matrix are stored in first part while the activations are stored in the second part. Args: ...
Highway
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils import torch.onnx class Highway(nn.Module): def __init__(self, e_word): super(Highway, self).__init__() self.embed_size = e_word self.w_proj = nn.Linear(self.embed_size, self.embed_size, bias=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
evazhang612/honygenerator
Highway
false
6,662
[ "MIT" ]
1
cafcf1736faba978ecaed624b949ebc1498477ee
https://github.com/evazhang612/honygenerator/tree/cafcf1736faba978ecaed624b949ebc1498477ee
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils import torch.onnx class Model(nn.Module): def __init__(self, e_word): super().__init__() self.embed_size = e_word self.w_proj = nn.Linear(self.embed_size, self.embed_size, bias=True) self.w_ga...
P2SActivationLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch_nn from torch.nn import Parameter import torch.utils class P2SActivationLayer(torch_nn.Module): """ Output layer that produces cos heta between activation vector x and class vector w_j in_dim: dimension of input feature vectors output_dim: dimension of output ...
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....
eurecom-asp/raw-pc-darts-anti-spoofing
P2SActivationLayer
false
6,663
[ "MIT" ]
1
f2dcb5a8fc0cb811328a341a9bd90ffb292adaa1
https://github.com/eurecom-asp/raw-pc-darts-anti-spoofing/tree/f2dcb5a8fc0cb811328a341a9bd90ffb292adaa1
import torch import torch.nn as torch_nn from torch.nn import Parameter import torch.utils class Model(torch_nn.Module): """ Output layer that produces cos heta between activation vector x and class vector w_j in_dim: dimension of input feature vectors output_dim: dimension of output feature vecto...
ChannelGate2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 ChannelGate2d(nn.Module): def __init__(self, channels, reduction=2): super(ChannelGate2d, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, padding=0) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
evilidol/kaggle-Steel-Defect-Detection
ChannelGate2d
false
6,664
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, channels, reduction=2): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, padding=0) self.relu = nn.ReLU(inplace=...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 import torch.nn as nn from torch.nn import functional as F class SelfAttention(nn.Module): def __init__(self, config): super().__init__() assert config.n_embd % config.n_head == 0 self.qkv = nn.Linear(config.n_embd, co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
evelynmitchell/rasp
SelfAttention
false
6,665
[ "MIT" ]
1
9b33bbf911e6c4ff018c9883c39eb698c0abe803
https://github.com/evelynmitchell/rasp/tree/9b33bbf911e6c4ff018c9883c39eb698c0abe803
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, config): super().__init__() assert config.n_embd % config.n_head == 0 self.qkv = nn.Linear(config.n_embd, config.n_e...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=1): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
evilidol/kaggle-Steel-Defect-Detection
DiceLoss
false
6,666
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class Model(nn.Module): def __init__(self, smooth=1): ...
HorizontalMaxPool2d
# 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 HorizontalMaxPool2d(nn.Module): def __init__(self): super(HorizontalMaxPool2d, self).__init__() def forward(self, x): inp_size = x.size() return nn.functional.max_pool2d(input=x, kernel_size=(1, inp_size[3])) def get_inputs(): return [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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
existentmember7/TEMP_monitor
HorizontalMaxPool2d
false
6,667
[ "MIT" ]
1
b8116f4c134793c4caa22eda78f90dd24d0cad30
https://github.com/existentmember7/TEMP_monitor/tree/b8116f4c134793c4caa22eda78f90dd24d0cad30
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): inp_size = x.size() return nn.functional.max_pool2d(input=x, kernel_size=(1, inp_size[3])) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
SpatialGate2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 SpatialGate2d(nn.Module): def __init__(self, in_channels): super(SpatialGate2d, self).__init__() self.conv1 = nn.Conv2d(in_channels, 1, kernel_size=1, stride=1) self.sigmoid = nn.Sigmoid() def forward(self, x): cal = self.conv1(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...
evilidol/kaggle-Steel-Defect-Detection
SpatialGate2d
false
6,668
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels): super().__init__() self.conv1 = nn.Conv2d(in_channels, 1, kernel_size=1, stride=1) self.sigmoid = nn.Sigmoid() def forward(self, x): cal = self.conv1(x) cal = self.sigmoid(cal)...
DiceCELoss
# 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 warnings from typing import Callable from typing import Union from typing import Optional from enum import Enum import torch.nn as nn from torch.nn.modules.loss import _Loss import torch.multiprocessing class LossReduction(Enum): """ See also: - :py:class:`monai.losses.dice.DiceLos...
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 warnings from t...
elitap/classimbalance
DiceCELoss
false
6,669
[ "Apache-2.0" ]
1
ae807ec533da5eef18f4180b29383399bc57696a
https://github.com/elitap/classimbalance/tree/ae807ec533da5eef18f4180b29383399bc57696a
import torch import warnings from typing import Callable from typing import Union from typing import Optional from enum import Enum import torch.nn as nn from torch.nn.modules.loss import _Loss import torch.multiprocessing class LossReduction(Enum): """ See also: - :py:class:`monai.losses.dice.DiceLos...
BiasConvFc2Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 BiasConvFc2Net(nn.Module): def __init__(self, in_channels, groups, n_segment, kernel_size=3, padding=1 ): super(BiasConvFc2Net, self).__init__() self.conv = nn.Conv1d(in_channels, 1, kernel_size, padding=padding) self.fc = nn.Linear(n_segme...
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_...
eynaij/X-Temporal_catdim
BiasConvFc2Net
false
6,670
[ "MIT" ]
1
6a2efba407c09c83ca061c8467c1373b6ed0c7eb
https://github.com/eynaij/X-Temporal_catdim/tree/6a2efba407c09c83ca061c8467c1373b6ed0c7eb
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, groups, n_segment, kernel_size=3, padding=1 ): super().__init__() self.conv = nn.Conv1d(in_channels, 1, kernel_size, padding=padding) self.fc = nn.Linear(n_segment, n_segment) self.r...
SCse
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 GAB(nn.Module): def __init__(self, input_dim, reduction=4): super(GAB, self).__init__() self.global_avgpool = nn.AdaptiveAvgPool2d(1) self.conv1 = nn.Conv2d(input_dim, input_dim // reduction, kernel_size=1, stride=1) self.conv2 ...
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_...
evilidol/kaggle-Steel-Defect-Detection
SCse
false
6,671
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
import torch import torch.nn as nn class GAB(nn.Module): def __init__(self, input_dim, reduction=4): super().__init__() self.global_avgpool = nn.AdaptiveAvgPool2d(1) self.conv1 = nn.Conv2d(input_dim, input_dim // reduction, kernel_size=1, stride=1) self.conv2 = nn.Conv...
BertAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, config, variance_epsilon=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, self)....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
BLimmie/pytorch-pretrained-BERT
BertAttention
false
6,672
[ "Apache-2.0" ]
1
2ac4b29641e569020ed2acc28016f481f617052b
https://github.com/BLimmie/pytorch-pretrained-BERT/tree/2ac4b29641e569020ed2acc28016f481f617052b
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, config, variance_epsilon=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super().__init__() ...
WeightConvNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 WeightConvNet(nn.Module): def __init__(self, in_channels, groups, n_segment): super(WeightConvNet, self).__init__() self.lastlayer = nn.Conv1d(in_channels, groups, 3, padding=1) self.groups = groups def forward(self, x): N, _C, T = x.s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
eynaij/X-Temporal_catdim
WeightConvNet
false
6,673
[ "MIT" ]
1
6a2efba407c09c83ca061c8467c1373b6ed0c7eb
https://github.com/eynaij/X-Temporal_catdim/tree/6a2efba407c09c83ca061c8467c1373b6ed0c7eb
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, groups, n_segment): super().__init__() self.lastlayer = nn.Conv1d(in_channels, groups, 3, padding=1) self.groups = groups def forward(self, x): N, _C, T = x.shape x = self.lastl...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1e-06): super(DiceLoss, self).__init__() self.smooth = smooth def forward(self, y_pred, y_true): assert y_pred.size() == y_true.size() y_pred = y_pred.contiguous().view(y_pred.shape[0], -1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
fadamsyah/pytorch-brain-mri-segmentation
DiceLoss
false
6,674
[ "MIT" ]
1
bdb310ecacbddfce2cef20d50cf0b638dd1bc7b1
https://github.com/fadamsyah/pytorch-brain-mri-segmentation/tree/bdb310ecacbddfce2cef20d50cf0b638dd1bc7b1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, smooth=1e-06): super().__init__() self.smooth = smooth def forward(self, y_pred, y_true): assert y_pred.size() == y_true.size() y_pred = y_pred.contiguous().view(y_pred.shape[0], -1) y_true ...
CircleLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from torch import nn class CircleLoss(nn.Module): def __init__(self, m: 'float', gamma: 'float') ->None: super(CircleLoss, self).__init__() self.m = m self.gamma = gamma self.soft_plus = nn.Softplus() def forward(self, sp: 'Tensor', sn: '...
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 ...
fabiozappo/Person_reID_tensorrt
CircleLoss
false
6,675
[ "Apache-2.0" ]
1
164441f35777698274e7664a9aefcc8d54467dc3
https://github.com/fabiozappo/Person_reID_tensorrt/tree/164441f35777698274e7664a9aefcc8d54467dc3
import torch from torch import Tensor from torch import nn class Model(nn.Module): def __init__(self, m: 'float', gamma: 'float') ->None: super().__init__() self.m = m self.gamma = gamma self.soft_plus = nn.Softplus() def forward(self, sp: 'Tensor', sn: 'Tensor') ->Tensor: ...
Aggregation
# 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 * class Aggregation(nn.Module): """ Aggregation layer for the Dueling architecture. https://arxiv.org/abs/1511.06581 This layer computes a Q function by combining an estimate of V with an estimate of the advantage. The advantage is normal...
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 import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._d...
ezelikman/autonomous-learning-library
Aggregation
false
6,676
[ "MIT" ]
1
b32d059ca8b191afe0b310102d0754796f391aff
https://github.com/ezelikman/autonomous-learning-library/tree/b32d059ca8b191afe0b310102d0754796f391aff
import torch from torch import nn from torch.nn import * class Model(nn.Module): """ Aggregation layer for the Dueling architecture. https://arxiv.org/abs/1511.06581 This layer computes a Q function by combining an estimate of V with an estimate of the advantage. The advantage is normalized b...
Entropy
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class Entropy(nn.Module): def __init__(self): super(Entropy, self).__init__() def forward(self, x): plogp = x * torch.log(x) plogp[plogp != plogp] = 0 return -torch.sum(plogp, dim=-1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
fallcat/synst
Entropy
false
6,677
[ "BSD-3-Clause" ]
1
0fa4adffa825af4a62b6e739b59c4125a7b6698e
https://github.com/fallcat/synst/tree/0fa4adffa825af4a62b6e739b59c4125a7b6698e
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): plogp = x * torch.log(x) plogp[plogp != plogp] = 0 return -torch.sum(plogp, dim=-1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
QuaternionLinear
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import numpy as np from numpy.random import RandomState from torch.autograd import Variable from torch.nn.parameter import Parameter from scipy.stats import chi import torch.fx def quaternion_init(in_features, out_features, rng, kernel_size=None, criterion='glorot'): i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import numpy as np from numpy.random import RandomSt...
eleGAN23/HI2I
QuaternionLinear
false
6,678
[ "MIT" ]
1
7730ee0963614290099b011c113048ef6d1b149c
https://github.com/eleGAN23/HI2I/tree/7730ee0963614290099b011c113048ef6d1b149c
from torch.nn import Module import torch import numpy as np from numpy.random import RandomState from torch.autograd import Variable from torch.nn.parameter import Parameter from scipy.stats import chi import torch.fx def quaternion_init(in_features, out_features, rng, kernel_size=None, criterion='glorot'): i...
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 from torch import nn from torch.nn import functional as F def same_tensor(tensor, *args): """ Do the input tensors all point to the same underlying data """ for other in args: if not torch.is_tensor(other): return False if tensor.device != other.device: ret...
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....
fallcat/synst
MultiHeadedAttention
false
6,679
[ "BSD-3-Clause" ]
1
0fa4adffa825af4a62b6e739b59c4125a7b6698e
https://github.com/fallcat/synst/tree/0fa4adffa825af4a62b6e739b59c4125a7b6698e
import torch from torch import nn from torch.nn import functional as F def same_tensor(tensor, *args): """ Do the input tensors all point to the same underlying data """ for other in args: if not torch.is_tensor(other): return False if tensor.device != other.device: ret...
MultiLayeredConv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 class MultiLayeredConv1d(torch.nn.Module): """Multi-layered conv1d for Transformer block. This is a module of multi-leyered conv1d designed to replace positionwise feed-forward network in Transforner block, which is introduced in `FastSpeech: Fast, Robust and Controllable Tex...
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 assert_size_s...
fancyliumeng/asv-subtools
MultiLayeredConv1d
false
6,680
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
import torch import torch.nn class Model(torch.nn.Module): """Multi-layered conv1d for Transformer block. This is a module of multi-leyered conv1d designed to replace positionwise feed-forward network in Transforner block, which is introduced in `FastSpeech: Fast, Robust and Controllable Text to Speech`_...
LDEPooling
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 class LDEPooling(torch.nn.Module): """A novel learnable dictionary encoding layer according to [Weicheng Cai, etc., "A NOVEL LEARNABLE DICTIONARY ENCODING LAYER FOR END-TO-END LANGUAGE IDENTIFICATION", icassp, 2018]""" def __init__(self, input_dim, c_num=64): super(L...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn assert...
fancyliumeng/asv-subtools
LDEPooling
false
6,681
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
import torch import torch.nn class Model(torch.nn.Module): """A novel learnable dictionary encoding layer according to [Weicheng Cai, etc., "A NOVEL LEARNABLE DICTIONARY ENCODING LAYER FOR END-TO-END LANGUAGE IDENTIFICATION", icassp, 2018]""" def __init__(self, input_dim, c_num=64): super().__in...
Conv1dLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 class Conv1dLinear(torch.nn.Module): """Conv1D + Linear for Transformer block. A variant of MultiLayeredConv1d, which replaces second conv-layer to linear. """ def __init__(self, in_chans, hidden_chans, kernel_size, dropout_rate): """Initialize Conv1dLinear modu...
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 assert_size_s...
fancyliumeng/asv-subtools
Conv1dLinear
false
6,682
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
import torch import torch.nn class Model(torch.nn.Module): """Conv1D + Linear for Transformer block. A variant of MultiLayeredConv1d, which replaces second conv-layer to linear. """ def __init__(self, in_chans, hidden_chans, kernel_size, dropout_rate): """Initialize Conv1dLinear module. ...
TdnnAffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
fancyliumeng/asv-subtools
TdnnAffine
false
6,683
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
UpBlok
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 UpBlok(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv1x1 = nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0) self.conv3x3 = nn.Conv2d(in_chan...
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_...
fendaq/TextRSN
UpBlok
false
6,684
[ "MIT" ]
1
02a6bc06cd64b581414ed5065a8c93e0c68a807a
https://github.com/fendaq/TextRSN/tree/02a6bc06cd64b581414ed5065a8c93e0c68a807a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv1x1 = nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0) self.conv3x3 = nn.Conv2d(in_chann...
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 torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim): super(Critic, self).__init__() self.fc1 = nn.Linear(state_dim, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 1) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
fengzhengyong-github/Deep-reinforcement-learning-with-pytorch
Critic
false
6,685
[ "MIT" ]
1
3c56b601d14b0b0c8cde4b6bc6df5c1e8f298c7b
https://github.com/fengzhengyong-github/Deep-reinforcement-learning-with-pytorch/tree/3c56b601d14b0b0c8cde4b6bc6df5c1e8f298c7b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 1) def forward(self, x): x = F.re...
ScaledDotProductAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout: 'float'=0.0) ->None: super(ScaledDotProductAttention, self).__init__() self._dropout = nn.Dropout(dropout) self._softmax = nn.Softmax(dim=2) def forward(self, query: 'torch.Tens...
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....
fengtaoo/opmft
ScaledDotProductAttention
false
6,686
[ "MIT" ]
1
64f2a12c724295cd913eda02502f2e2a20f2dd55
https://github.com/fengtaoo/opmft/tree/64f2a12c724295cd913eda02502f2e2a20f2dd55
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dropout: 'float'=0.0) ->None: super().__init__() self._dropout = nn.Dropout(dropout) self._softmax = nn.Softmax(dim=2) def forward(self, query: 'torch.Tensor', key: 'torch.Tensor', value: 'torch.Ten...
L_TV
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.optim class L_TV(nn.Module): def __init__(self, TVLoss_weight=1): super(L_TV, self).__init__() self.TVLoss_weight = TVLoss_weight def forward(self, x): batch_size = x.size()[0] h_x = x.size()[2] w_x = x.size()[3] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
farhantandia/Applied-CV-Zero-DCE-master
L_TV
false
6,687
[ "MIT" ]
1
56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
https://github.com/farhantandia/Applied-CV-Zero-DCE-master/tree/56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
import torch import torch.nn as nn import torch.optim class Model(nn.Module): def __init__(self, TVLoss_weight=1): super().__init__() self.TVLoss_weight = TVLoss_weight def forward(self, x): batch_size = x.size()[0] h_x = x.size()[2] w_x = x.size()[3] count_h ...
PixelNormLayer
# 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 PixelNormLayer(nn.Module): """ Pixelwise feature vector normalization. """ def __init__(self, eps=1e-08): super(PixelNormLayer, self).__init__() self.eps = eps def forward(self, x): return x / torch.sqrt(torch.mean(x ** 2, dim=1, k...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
ferngonzalezp/turbulence-GAN
PixelNormLayer
false
6,688
[ "MIT" ]
1
a215a3c5af2dc9a723f95c344e295ecc08954f26
https://github.com/ferngonzalezp/turbulence-GAN/tree/a215a3c5af2dc9a723f95c344e295ecc08954f26
import torch import torch.nn as nn class Model(nn.Module): """ Pixelwise feature vector normalization. """ def __init__(self, eps=1e-08): super().__init__() self.eps = eps def forward(self, x): return x / torch.sqrt(torch.mean(x ** 2, dim=1, keepdim=True) + 0.0001) d...
CNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn import functional as F from torch import nn class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(3, 8, 6, 1) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(8, 16, 6, 1) self.conv3 = nn.Conv2d(16, 24,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
eosay/robotCNN
CNN
false
6,689
[ "MIT" ]
1
9eaefcc223e868c01f6d1a49a28d2a9f392857e5
https://github.com/eosay/robotCNN/tree/9eaefcc223e868c01f6d1a49a28d2a9f392857e5
import torch from torch.nn import functional as F from torch import nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 8, 6, 1) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(8, 16, 6, 1) self.conv3 = nn.Conv2d(16, 24, 6, 1) ...
SequenceBias
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from torch.nn.parameter import Parameter class SequenceBias(nn.Module): """ Adds one bias element to the end of the sequence. so if the input has a shape ``(L, N, E)``, where ``L`` i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from torch.nn.parameter import Pa...
ffuuugor/opacus
SequenceBias
false
6,690
[ "Apache-2.0" ]
1
2048a6e92902685c2a735e9fb7c0d48b4846b494
https://github.com/ffuuugor/opacus/tree/2048a6e92902685c2a735e9fb7c0d48b4846b494
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from torch.nn.parameter import Parameter class Model(nn.Module): """ Adds one bias element to the end of the sequence. so if the input has a shape ``(L, N, E)``, where ``L`` is the s...
SoftmaxAffineLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
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....
fancyliumeng/asv-subtools
SoftmaxAffineLayer
false
6,691
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
MLPLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class MLPLayer(nn.Module): """ Head for getting sentence representations over RoBERTa/BERT's CLS representation. """ def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_siz...
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 ...
BDBC-KG-NLP/MixCSE_AAAI2022
MLPLayer
false
6,692
[ "MIT" ]
1
884145e24a5258c044fedb658df9999f012df875
https://github.com/BDBC-KG-NLP/MixCSE_AAAI2022/tree/884145e24a5258c044fedb658df9999f012df875
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Model(nn.Module): """ Head for getting sentence representations over RoBERTa/BERT's CLS representation. """ def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, ...
SEBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
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.functional as...
fancyliumeng/asv-subtools
SEBlock
false
6,693
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
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.utils.data import torch.distributed import torch.nn as nn from torch.nn import Parameter import torch.optim import torch.optim.lr_scheduler class MultiheadAttention(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more detail...
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....
farhanazareen/Fairseq
MultiheadAttention
false
6,694
[ "BSD-3-Clause" ]
1
39c7b6804b4a3426ef23b30f3ca8a3c0a9948079
https://github.com/farhanazareen/Fairseq/tree/39c7b6804b4a3426ef23b30f3ca8a3c0a9948079
import torch import torch.nn.functional as F import torch.utils.data import torch.distributed import torch.nn as nn from torch.nn import Parameter import torch.optim import torch.optim.lr_scheduler class Model(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more details. """ ...
DPLSTMCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Optional from typing import Tuple class LSTMLinear(nn.Linear): """ This function is the same as a nn.Linear layer, except that in the backward pass the gra...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
ffuuugor/opacus
DPLSTMCell
false
6,695
[ "Apache-2.0" ]
1
2048a6e92902685c2a735e9fb7c0d48b4846b494
https://github.com/ffuuugor/opacus/tree/2048a6e92902685c2a735e9fb7c0d48b4846b494
import math import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Optional from typing import Tuple class LSTMLinear(nn.Linear): """ This function is the same as a nn.Linear layer, except that in the backward pass the gra...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class ResidualBlock(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number...
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...
fqhank/HESIC
ResidualBlock
false
6,696
[ "Apache-2.0" ]
1
f15cb8e6822af45f0022ea4887fce915e250ed75
https://github.com/fqhank/HESIC/tree/f15cb8e6822af45f0022ea4887fce915e250ed75
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class Model(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number of inpu...
AdaIN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class AdaIN(nn.Module): def __init__(self, style_dim, num_features): super().__init__() self.norm = nn.InstanceNorm2d(num_features, affine=False) self.fc = nn.Linear(style_dim, num_features * 2) def forward(self, x, s): h = self.fc(s) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
fpaupier/stargan-v2
AdaIN
false
6,697
[ "MIT" ]
1
18d2e04ed6e6df963b84345e798d94383757aaa2
https://github.com/fpaupier/stargan-v2/tree/18d2e04ed6e6df963b84345e798d94383757aaa2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, style_dim, num_features): super().__init__() self.norm = nn.InstanceNorm2d(num_features, affine=False) self.fc = nn.Linear(style_dim, num_features * 2) def forward(self, x, s): h = self.fc(s) ...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn from torch.nn import init def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, 'weight'): if init_type == '...
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....
fanyix/flownet2
SelfAttention
false
6,698
[ "Apache-2.0" ]
1
0643beef59eeaf4cf4907d0d51f486ffd713363f
https://github.com/fanyix/flownet2/tree/0643beef59eeaf4cf4907d0d51f486ffd713363f
import math import torch import torch.nn as nn from torch.nn import init def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, 'weight'): if init_type == '...
dense_warp
# 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 dense_warp(nn.Module): def __init__(self): super().__init__() def forward(self, h1, cost): g2 = torch.zeros_like(h1) clone_h1 = h1.detach() if h1.device.type == 'cuda': g2 = g2 clone_h1 = clone_h1 for 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
fqhank/HESIC
dense_warp
false
6,699
[ "Apache-2.0" ]
1
f15cb8e6822af45f0022ea4887fce915e250ed75
https://github.com/fqhank/HESIC/tree/f15cb8e6822af45f0022ea4887fce915e250ed75
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, h1, cost): g2 = torch.zeros_like(h1) clone_h1 = h1.detach() if h1.device.type == 'cuda': g2 = g2 clone_h1 = clone_h1 for d in ra...
KernelMatcher
# 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 Dict import torch.nn as nn import torch.nn.functional as F class KernelMatcher(nn.Module): def __init__(self, embed_dim: 'int', kernel_num: 'int'=21) ->None: super(KernelMatcher, self).__init__() self._embed_dim = embed_dim self._kernel_num = kernel_num ...
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....
fengtaoo/opmft
KernelMatcher
false
6,700
[ "MIT" ]
1
64f2a12c724295cd913eda02502f2e2a20f2dd55
https://github.com/fengtaoo/opmft/tree/64f2a12c724295cd913eda02502f2e2a20f2dd55
import torch from typing import Dict import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, embed_dim: 'int', kernel_num: 'int'=21) ->None: super().__init__() self._embed_dim = embed_dim self._kernel_num = kernel_num mus, sigmas = self.ker...
ResBlk
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F def normalize(x, eps=1e-06): """Apply min-max normalization.""" x = x.contiguous() N, C, H, W = x.size() x_ = x.view(N * C, -1) max_val = torch.max(x_, dim=1, keepdim=True)[0] min_val = torch.min(x_, dim=1, keepdim=...
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...
fpaupier/stargan-v2
ResBlk
false
6,701
[ "MIT" ]
1
18d2e04ed6e6df963b84345e798d94383757aaa2
https://github.com/fpaupier/stargan-v2/tree/18d2e04ed6e6df963b84345e798d94383757aaa2
import math import torch import torch.nn as nn import torch.nn.functional as F def normalize(x, eps=1e-06): """Apply min-max normalization.""" x = x.contiguous() N, C, H, W = x.size() x_ = x.view(N * C, -1) max_val = torch.max(x_, dim=1, keepdim=True)[0] min_val = torch.min(x_, dim=1, keepdim=...
Enhancement_Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class ResidualBlock(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number...
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...
fqhank/HESIC
Enhancement_Block
false
6,702
[ "Apache-2.0" ]
1
f15cb8e6822af45f0022ea4887fce915e250ed75
https://github.com/fqhank/HESIC/tree/f15cb8e6822af45f0022ea4887fce915e250ed75
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class ResidualBlock(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number...
PolicyNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=3e-05): super(PolicyNetwork, self).__init__() self.linear1 = nn.Linear(num_inputs, hidden_size) self.linear2 = nn.Linear(hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
frknayk/Reinforcement-Learning-In-Control
PolicyNetwork
false
6,703
[ "MIT" ]
1
24c7eb6fa6b6390ee2dd04f25036c37896ecd944
https://github.com/frknayk/Reinforcement-Learning-In-Control/tree/24c7eb6fa6b6390ee2dd04f25036c37896ecd944
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=3e-05): super().__init__() self.linear1 = nn.Linear(num_inputs, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) ...
enhance_net_nopool
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class enhance_net_nopool(nn.Module): def __init__(self): super(enhance_net_nopool, self).__init__() self.relu = nn.ReLU(inplace=True) number_f = 32 self.e_conv1 = nn.Conv2d(3, number_f, 3, 1, 1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
farhantandia/Applied-CV-Zero-DCE-master
enhance_net_nopool
false
6,704
[ "MIT" ]
1
56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
https://github.com/farhantandia/Applied-CV-Zero-DCE-master/tree/56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class Model(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU(inplace=True) number_f = 32 self.e_conv1 = nn.Conv2d(3, number_f, 3, 1, 1, bias=True) self.e_conv2 = nn....
ActorCriticContinuous
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 ActorCriticContinuous(nn.Module): """ Actor-Critic for continuous action spaces. The network returns a state_value (critic) and action mean and action standarddeviation (actor). The action is the sampled from a normal distribution...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
fschur/Advantage-Actor-Critic-for-OpenAi-gym
ActorCriticContinuous
false
6,705
[ "MIT" ]
1
c130038789425301684825e09e77f17e89d21859
https://github.com/fschur/Advantage-Actor-Critic-for-OpenAi-gym/tree/c130038789425301684825e09e77f17e89d21859
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ Actor-Critic for continuous action spaces. The network returns a state_value (critic) and action mean and action standarddeviation (actor). The action is the sampled from a normal distribution with mean and s...
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 from torch import 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 from torch import nn assert_s...
francescotorregrossa/deep-reinforcement-learning-nanodegree
Policy
false
6,706
[ "MIT" ]
1
396648570aa53c9e727a8de69175e4a139d4ded5
https://github.com/francescotorregrossa/deep-reinforcement-learning-nanodegree/tree/396648570aa53c9e727a8de69175e4a139d4ded5
import torch import torch.nn.functional as F from torch import 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 ...
EqualConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') 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 import nn from math import sqrt assert_size_stride = torch._C._dynamo...
g33sean/RTIL
EqualConv2d
false
6,707
[ "BSD-2-Clause", "MIT" ]
1
5325f6d5e3ddf7579b6bd8199898e00eff3da631
https://github.com/g33sean/RTIL/tree/5325f6d5e3ddf7579b6bd8199898e00eff3da631
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
Feedforward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class Feedforward(torch.nn.Module): def __init__(self, input_size, output_size, hidden_size): super(Feedforward, self).__init__() self.input_size = input_size self.output_size = output_size self.hidden_size = hidden_size self.fc1 = torch.nn.Linear(self.input_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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
fywu85/eecs206a_project
Feedforward
false
6,708
[ "MIT" ]
1
73ea518779da4d187df8bbe4cbe46bca6d1a0714
https://github.com/fywu85/eecs206a_project/tree/73ea518779da4d187df8bbe4cbe46bca6d1a0714
import torch class Model(torch.nn.Module): def __init__(self, input_size, output_size, hidden_size): super().__init__() self.input_size = input_size self.output_size = output_size self.hidden_size = hidden_size self.fc1 = torch.nn.Linear(self.input_size, self.hidden_size) ...
ActorCriticDiscrete
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 ActorCriticDiscrete(nn.Module): """ Actor-Critic for discrete action spaces. The network returns a state_value (critic)and action probabilities (actor). """ def __init__(self, action_dim, state_dim, hidden_dim): super(Act...
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....
fschur/Advantage-Actor-Critic-for-OpenAi-gym
ActorCriticDiscrete
false
6,709
[ "MIT" ]
1
c130038789425301684825e09e77f17e89d21859
https://github.com/fschur/Advantage-Actor-Critic-for-OpenAi-gym/tree/c130038789425301684825e09e77f17e89d21859
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ Actor-Critic for discrete action spaces. The network returns a state_value (critic)and action probabilities (actor). """ def __init__(self, action_dim, state_dim, hidden_dim): super().__init__() ...
EqualLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') 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 import nn from math import sqrt assert_size_stride = torch._C._dynamo...
g33sean/RTIL
EqualLinear
false
6,710
[ "BSD-2-Clause", "MIT" ]
1
5325f6d5e3ddf7579b6bd8199898e00eff3da631
https://github.com/g33sean/RTIL/tree/5325f6d5e3ddf7579b6bd8199898e00eff3da631
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
UNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.functional import F import torch.nn as nn import torch.nn.functional as F class down(nn.Module): def __init__(self, inChannels, outChannels, filterSize): """ Parameters ---------- inChannels : int number of input channels for the first c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.functional import ...
delldu/VideoSlow
UNet
false
6,711
[ "MIT" ]
1
2badbbfa2187ea15ea37ef35e70a103ef98c1e33
https://github.com/delldu/VideoSlow/tree/2badbbfa2187ea15ea37ef35e70a103ef98c1e33
import torch from torch.functional import F import torch.nn as nn import torch.nn.functional as F class down(nn.Module): def __init__(self, inChannels, outChannels, filterSize): """ Parameters ---------- inChannels : int number of input channels for the first c...
ConstantODE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class ConstantODE(torch.nn.Module): def __init__(self): super(ConstantODE, self).__init__() self.a = torch.nn.Parameter(torch.tensor(0.2)) self.b = torch.nn.Parameter(torch.tensor(3.0)) def forward(self, t, y): return self.a + (y - (self.a * t + self.b)) ** 5 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
gaozhihan/torchdiffeq
ConstantODE
false
6,712
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() self.a = torch.nn.Parameter(torch.tensor(0.2)) self.b = torch.nn.Parameter(torch.tensor(3.0)) def forward(self, t, y): return self.a + (y - (self.a * t + self.b)) ** 5 def y_exact(self, t):...
SineODE
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch class SineODE(torch.nn.Module): def forward(self, t, y): return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3 def y_exact(self, t): return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * t ** 3 * torch.sin( 2 * t) + 0.25 * t ** 2 * torch.cos(2 * t)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
gaozhihan/torchdiffeq
SineODE
false
6,713
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
import math import torch class Model(torch.nn.Module): def forward(self, t, y): return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3 def y_exact(self, t): return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * t ** 3 * torch.sin( 2 * t) + 0.25 * t ** 2 * torch.cos(2 * t) -...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 ResidualBlock(nn.Module): def __init__(self, filter_size, dilation, residual_channels, dilated_channels, skip_channels): super().__init__() self.conv = nn.Conv1d(residual_channels, dilated_channels, kernel_size=filter_size, padding=dilat...
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...
fukuroder/pytorch_lightning_wavenet
ResidualBlock
false
6,714
[ "MIT" ]
1
440ef4092397998edf0df4625f1f10157db2243e
https://github.com/fukuroder/pytorch_lightning_wavenet/tree/440ef4092397998edf0df4625f1f10157db2243e
import torch from torch import nn class Model(nn.Module): def __init__(self, filter_size, dilation, residual_channels, dilated_channels, skip_channels): super().__init__() self.conv = nn.Conv1d(residual_channels, dilated_channels, kernel_size=filter_size, padding=dilation * (f...
EqualConvTranspose2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') 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 import nn from math import sqrt assert_size_stride = torch._C._dynamo...
g33sean/RTIL
EqualConvTranspose2d
false
6,715
[ "BSD-2-Clause", "MIT" ]
1
5325f6d5e3ddf7579b6bd8199898e00eff3da631
https://github.com/g33sean/RTIL/tree/5325f6d5e3ddf7579b6bd8199898e00eff3da631
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
CombineSlices
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class CombineSlices(nn.Module): def __init__(self, slice_dim=2): super().__init__() self.slice_dim = slice_dim def forward(self, x): return torch.index_select(x, dim=self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim assert_size_stride = torch._C._dynamo.gu...
gbosdet/fastMRI
CombineSlices
false
6,716
[ "MIT" ]
1
7f94f8006f8919d98fb87788b6dadec9a58d1a3a
https://github.com/gbosdet/fastMRI/tree/7f94f8006f8919d98fb87788b6dadec9a58d1a3a
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Model(nn.Module): def __init__(self, slice_dim=2): super().__init__() self.slice_dim = slice_dim def forward(self, x): return torch.index_select(x, dim=self.slice_di...
ResBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ResBlock(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....
gaozhihan/torchdiffeq
ResBlock
false
6,717
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def norm(dim): return nn.GroupNorm(min(32, dim), dim) class Model(nn.Module): exp...
ConcatConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() module = nn.ConvTranspose2d if transpose else nn.Conv2d 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gaozhihan/torchdiffeq
ConcatConv2d
false
6,718
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super().__init__() module = nn.ConvTranspose2d if transpose else nn.Conv2d self._layer = module(dim_in + ...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Decoder(nn.Module): def __init__(self, latent_dim=4, obs_dim=2, nhidden=20): super(Decoder, self).__init__() self.relu = nn.ReLU(inplace=True) self.fc1 = nn.Linear(latent_dim, nhidden) self.fc2 = nn.Linear(nhidden, obs_dim) def forward...
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_...
gaozhihan/torchdiffeq
Decoder
false
6,719
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, latent_dim=4, obs_dim=2, nhidden=20): super().__init__() self.relu = nn.ReLU(inplace=True) self.fc1 = nn.Linear(latent_dim, nhidden) self.fc2 = nn.Linear(nhidden, obs_dim) def forward(self, z): ...
MaskedHuberLoss
# 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 MaskedHuberLoss(torch.nn.Module): def __init__(self): super(MaskedHuberLoss, self).__init__() def forward(self, output, labels, mask): lossHuber = nn.SmoothL1Loss(reduction='none') l = lossHuber(output * mask, labels * mask) l = l.sum(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
gabrieleangeletti/GndNet
MaskedHuberLoss
false
6,720
[ "MIT" ]
1
323af65c9c16a725805f480ff799936b77b04d53
https://github.com/gabrieleangeletti/GndNet/tree/323af65c9c16a725805f480ff799936b77b04d53
import torch import torch.nn as nn class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, output, labels, mask): lossHuber = nn.SmoothL1Loss(reduction='none') l = lossHuber(output * mask, labels * mask) l = l.sum(dim=(1, 2)) mask = mask...
Netleaky
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Netleaky(nn.Module): def __init__(self, input_dim, output_dim): super(Netleaky, self).__init__() self.linear1 = nn.Linear(input_dim, 32) self.linear2 = nn.Linear(32, 32) self.linear3 = nn.Linear(32, 64) ...
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_...
gautam-sharma1/openRL
Netleaky
false
6,721
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 32) self.linear2 = nn.Linear(32, 32) self.linear3 = nn.Linear(32, 64) self.linear4 =...
Cartesian
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Cartesian(nn.Module): def forward(self, x): r, phi = x[..., 0], x[..., 1] return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1) def get_inputs(): return [tor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data import torch.utils.data.dist...
gbosdet/fastMRI
Cartesian
false
6,722
[ "MIT" ]
1
7f94f8006f8919d98fb87788b6dadec9a58d1a3a
https://github.com/gbosdet/fastMRI/tree/7f94f8006f8919d98fb87788b6dadec9a58d1a3a
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Model(nn.Module): def forward(self, x): r, phi = x[..., 0], x[..., 1] return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1) def get_inputs(): return [torch.r...
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, input_dim, output_dim): super(Net, self).__init__() self.linear1 = nn.Linear(input_dim, 256) self.linear2 = nn.Linear(256, output_dim) def forward(self, x): x = F.relu(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gautam-sharma1/openRL
Net
false
6,723
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 256) self.linear2 = nn.Linear(256, output_dim) def forward(self, x): x = F.relu(self.li...
NN_2layer_regression
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 NN_2layer_regression(nn.Module): def __init__(self, input_dim, interm_dim1, interm_dim2): super().__init__() self.d = input_dim self.interm_dim1 = interm_dim1 self.interm_dim2 = interm_dim2 self.fc1 = nn.Linear(input_dim, interm_dim1...
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...
gaseln/FLIX_small_scale_experiments
NN_2layer_regression
false
6,724
[ "MIT" ]
1
af9ebd7f192fc0f67a6a94af7939fd3d6f548bd6
https://github.com/gaseln/FLIX_small_scale_experiments/tree/af9ebd7f192fc0f67a6a94af7939fd3d6f548bd6
import torch from torch import nn class Model(nn.Module): def __init__(self, input_dim, interm_dim1, interm_dim2): super().__init__() self.d = input_dim self.interm_dim1 = interm_dim1 self.interm_dim2 = interm_dim2 self.fc1 = nn.Linear(input_dim, interm_dim1) self....
HighwayLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn import torch.onnx.operators class HighwayLayer(nn.Module): def __init__(self, input_dim, transform_activation=F.relu, gate_activation=F.softmax, gate_bias=-2): super().__init__() self.highway_transform_activation = transfo...
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....
gardenia22/translate
HighwayLayer
false
6,725
[ "BSD-3-Clause" ]
1
0be57c8f55b52fc9d39197efa02e05d1c1cda024
https://github.com/gardenia22/translate/tree/0be57c8f55b52fc9d39197efa02e05d1c1cda024
import torch import torch.nn.functional as F import torch.nn as nn import torch.onnx.operators class Model(nn.Module): def __init__(self, input_dim, transform_activation=F.relu, gate_activation=F.softmax, gate_bias=-2): super().__init__() self.highway_transform_activation = transform_acti...
DPSLTMAdapter
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 from torch.nn.utils.rnn import pad_sequence import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Optional from typing import Union from typing import List from typing import Tuple from torch.nn.uti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
ffuuugor/opacus
DPSLTMAdapter
false
6,726
[ "Apache-2.0" ]
1
2048a6e92902685c2a735e9fb7c0d48b4846b494
https://github.com/ffuuugor/opacus/tree/2048a6e92902685c2a735e9fb7c0d48b4846b494
import math import torch from torch import Tensor import torch.nn as nn from torch.nn.utils.rnn import pad_sequence import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Optional from typing import Union from typing import List from typing import Tuple from torch.nn.uti...
Net16
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 Net16(nn.Module): def __init__(self, input_dim, output_dim): super(Net16, self).__init__() self.linear1 = nn.Linear(input_dim, 16) self.linear2 = nn.Linear(16, output_dim) def forward(self, x): x = F.rel...
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_...
gautam-sharma1/openRL
Net16
false
6,727
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.linear1 = nn.Linear(input_dim, 16) self.linear2 = nn.Linear(16, output_dim) def forward(self, x): x = F.relu(self.line...