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
Pooling
# 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 Pooling(nn.Module): """ Implementation of pooling for PoolFormer --pool_size: pooling size """ def __init__(self, pool_size=3): super().__init__() self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size // 2, count_incl...
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...
TranNhiem/MA_SSRL_Pytorch
Pooling
false
1,141
[ "MIT" ]
0
87d946461850240fdd54de761603f13ef3710c2b
https://github.com/TranNhiem/MA_SSRL_Pytorch/tree/87d946461850240fdd54de761603f13ef3710c2b
import torch import torch.nn as nn class Model(nn.Module): """ Implementation of pooling for PoolFormer --pool_size: pooling size """ def __init__(self, pool_size=3): super().__init__() self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size // 2, count_includ...
TwoWordBilinearLabelProbe
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.dataloader class TwoWordBilinearLabelProbe(nn.Module): """ Computes a bilinear function of pairs of vectors. For a batch of sentences, computes all n^2 pairs of scores for each sentence in the batch. """ def __init__(self, model_dim, rank...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.dataloader assert_size_stride = to...
TimO96/NLP2
TwoWordBilinearLabelProbe
false
1,142
[ "MIT" ]
0
83f65a385457f68397c641f38b53df0110282578
https://github.com/TimO96/NLP2/tree/83f65a385457f68397c641f38b53df0110282578
import torch import torch.nn as nn import torch.utils.data.dataloader class Model(nn.Module): """ Computes a bilinear function of pairs of vectors. For a batch of sentences, computes all n^2 pairs of scores for each sentence in the batch. """ def __init__(self, model_dim, rank, prob, device): ...
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 from torch import nn from torch.nn import functional as F class Policy(nn.Module): def __init__(self, act_dim, obs_dim): super(Policy, self).__init__() self.fc0 = nn.Linear(act_dim, 128) self.fc1 = nn.Linear(128, obs_dim) def forward(self, x): x = x.type_as(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 import nn assert_s...
TommeyChang/CS294-Homework
Policy
false
1,143
[ "MIT" ]
0
17b525bf4366034b45c4febd89f1053d44550237
https://github.com/TommeyChang/CS294-Homework/tree/17b525bf4366034b45c4febd89f1053d44550237
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, act_dim, obs_dim): super().__init__() self.fc0 = nn.Linear(act_dim, 128) self.fc1 = nn.Linear(128, obs_dim) def forward(self, x): x = x.type_as(self.fc0.bias) ...
CrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data.dataloader class CrossEntropyLoss(nn.Module): """Custom cross-entropy loss""" def __init__(self): super(CrossEntropyLoss, self).__init__() self.pytorch_ce_loss = torch.nn.CrossEntropyLoss(ignore_index=-1, reduction='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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
TimO96/NLP2
CrossEntropyLoss
false
1,144
[ "MIT" ]
0
83f65a385457f68397c641f38b53df0110282578
https://github.com/TimO96/NLP2/tree/83f65a385457f68397c641f38b53df0110282578
import torch import torch.nn as nn import torch.utils.data.dataloader class Model(nn.Module): """Custom cross-entropy loss""" def __init__(self): super().__init__() self.pytorch_ce_loss = torch.nn.CrossEntropyLoss(ignore_index=-1, reduction='sum') def forward(self, prediction...
GlobalAttentionGeneral
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.parallel import torch.onnx def conv1x1(in_planes, out_planes, bias=False): """1x1 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, padding=0, bias=bias) class GlobalAttentionGeneral(nn.Module): def __...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Thesis-02F/Style-Attn
GlobalAttentionGeneral
false
1,145
[ "MIT" ]
0
55f78de4858e395ebf9750a23923fd772600290f
https://github.com/Thesis-02F/Style-Attn/tree/55f78de4858e395ebf9750a23923fd772600290f
import torch import torch.nn as nn import torch.nn.parallel import torch.onnx def conv1x1(in_planes, out_planes, bias=False): """1x1 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, padding=0, bias=bias) class Model(nn.Module): def __init__(self, idf,...
Mlp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import warnings import torch.nn as nn def _no_grad_trunc_normal_(tensor, mean, std, a, b): """Copy & paste from PyTorch official master until it's in a few official releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf """ def 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.triton_helpers import libdevice import math import ...
TranNhiem/solo-learn
Mlp
false
1,146
[ "MIT" ]
0
7539732b68d153087d09a26a23e1edfdc49bc086
https://github.com/TranNhiem/solo-learn/tree/7539732b68d153087d09a26a23e1edfdc49bc086
import math import torch import warnings import torch.nn as nn def _no_grad_trunc_normal_(tensor, mean, std, a, b): """Copy & paste from PyTorch official master until it's in a few official releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf """ def n...
TokenMixer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 TokenMixer(nn.Module): def __init__(self, input_size, hidden_size, dropout=None): super(TokenMixer, self).__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, input_size) self.dropout = None if ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
TheRealMarVin/mlp-mixer
TokenMixer
false
1,147
[ "MIT" ]
0
2124cb5c5adfc7af473cab535095471d4943adab
https://github.com/TheRealMarVin/mlp-mixer/tree/2124cb5c5adfc7af473cab535095471d4943adab
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, hidden_size, dropout=None): super().__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, input_size) self.dropout = None if dropout is not None: ...
SelfAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class SelfAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0.1): super(SelfAttention, self).__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value, mask=None): ke...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TranQuocTrinh/image_captioning
SelfAttention
false
1,148
[ "MIT" ]
0
4c2d77426ba3b9fe9151a15a958320d5298aa190
https://github.com/TranQuocTrinh/image_captioning/tree/4c2d77426ba3b9fe9151a15a958320d5298aa190
import torch import numpy as np import torch.nn as nn class Model(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0.1): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value, mask=None): key_dim = key.size(-1) ...
AveragePoolingLayer
# 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 AveragePoolingLayer(nn.Module): """Implements the average pooling layer. Basically, this layer can be used to downsample feature maps from spatial domain. """ def __init__(self, scale_factor=2): super().__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Twizwei/idinvert_pytorch
AveragePoolingLayer
false
1,149
[ "MIT" ]
0
11f1126aab517fbe32b488d92f6fdea339463d04
https://github.com/Twizwei/idinvert_pytorch/tree/11f1126aab517fbe32b488d92f6fdea339463d04
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Implements the average pooling layer. Basically, this layer can be used to downsample feature maps from spatial domain. """ def __init__(self, scale_factor=2): super().__init__() self.scale_fa...
LayerNormChannel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LayerNormChannel(nn.Module): """ LayerNorm only for Channel Dimension. Input: tensor in shape [B, C, H, W] """ def __init__(self, num_channels, eps=1e-05): super().__init__() self.weight = nn.Parameter(torch.ones(num_channels)) self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
TranNhiem/MA_SSRL_Pytorch
LayerNormChannel
false
1,150
[ "MIT" ]
0
87d946461850240fdd54de761603f13ef3710c2b
https://github.com/TranNhiem/MA_SSRL_Pytorch/tree/87d946461850240fdd54de761603f13ef3710c2b
import torch import torch.nn as nn class Model(nn.Module): """ LayerNorm only for Channel Dimension. Input: tensor in shape [B, C, H, W] """ def __init__(self, num_channels, eps=1e-05): super().__init__() self.weight = nn.Parameter(torch.ones(num_channels)) self.bias = nn....
Whitening2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.cuda.amp import custom_fwd from torch.nn.functional import conv2d class Whitening2d(nn.Module): def __init__(self, output_dim: 'int', eps: 'float'=0.0): """Layer that computes hard whitening for W-MSE using the Cholesky decomposition. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
TranNhiem/solo-learn
Whitening2d
false
1,151
[ "MIT" ]
0
7539732b68d153087d09a26a23e1edfdc49bc086
https://github.com/TranNhiem/solo-learn/tree/7539732b68d153087d09a26a23e1edfdc49bc086
import torch import torch.nn as nn from torch.cuda.amp import custom_fwd from torch.nn.functional import conv2d class Model(nn.Module): def __init__(self, output_dim: 'int', eps: 'float'=0.0): """Layer that computes hard whitening for W-MSE using the Cholesky decomposition. Args: out...
ClassificationModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256, dropout1=0.25, dropout2=0.25): super(ClassificationModel, self).__init__() self.num_classes = num_classes self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
TobyChen0106/DeepQ_Final_B05901170
ClassificationModel
false
1,152
[ "Apache-2.0" ]
0
808a224c01272726a051eb7b7bb9e1b28887716e
https://github.com/TobyChen0106/DeepQ_Final_B05901170/tree/808a224c01272726a051eb7b7bb9e1b28887716e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256, dropout1=0.25, dropout2=0.25): super().__init__() self.num_classes = num_classes self.num_anchors = num_anchors self....
ContrastiveLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): """ contrastive loss L2 distance: L(a1,a2,y) = y * d(a1, a2) + (1-y)*max(0, m - d(a1, a2)) cosine distance: L(a1, a2, y) = y * (1 - d(a1,a2)) + (1-y) * max(0, d(a1,a2) -m) where y=1 if (a1,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
TuBui/deep_image_comparator
ContrastiveLoss
false
1,153
[ "MIT" ]
0
2dea7738d794b91a960ee9f41461a4e3ffcd5e44
https://github.com/TuBui/deep_image_comparator/tree/2dea7738d794b91a960ee9f41461a4e3ffcd5e44
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ contrastive loss L2 distance: L(a1,a2,y) = y * d(a1, a2) + (1-y)*max(0, m - d(a1, a2)) cosine distance: L(a1, a2, y) = y * (1 - d(a1,a2)) + (1-y) * max(0, d(a1,a2) -m) where y=1 if (a1,a2) releva...
GreedyHashLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class GreedyHashLoss(torch.nn.Module): def __init__(self): super(GreedyHashLoss, self).__init__() def forward(self, u): b = GreedyHashLoss.Hash.apply(u) loss = (u.abs() - 1).pow(3).abs().mean() return b, loss class Hash(torch.autograd.Function): @s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
TuBui/deep_image_comparator
GreedyHashLoss
false
1,154
[ "MIT" ]
0
2dea7738d794b91a960ee9f41461a4e3ffcd5e44
https://github.com/TuBui/deep_image_comparator/tree/2dea7738d794b91a960ee9f41461a4e3ffcd5e44
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, u): b = GreedyHashLoss.Hash.apply(u) loss = (u.abs() - 1).pow(3).abs().mean() return b, loss class Hash(torch.autograd.Function): @staticmethod def forwa...
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 numpy as np import torch.nn as nn class SelfAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0.1): super(SelfAttention, self).__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value, mask=None): ke...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TranQuocTrinh/image_captioning
MultiHeadAttention
false
1,155
[ "MIT" ]
0
4c2d77426ba3b9fe9151a15a958320d5298aa190
https://github.com/TranQuocTrinh/image_captioning/tree/4c2d77426ba3b9fe9151a15a958320d5298aa190
import torch import numpy as np import torch.nn as nn class SelfAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, dropout=0.1): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, query, key, value, mask=None): key_dim = key.size(-1...
LastBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class BatchNormLayer(nn.Module): """Implements batch normalization layer.""" def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon =1e-05): """Initializes with basic settings. Args: channels: Number of 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 numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
Twizwei/idinvert_pytorch
LastBlock
false
1,156
[ "MIT" ]
0
11f1126aab517fbe32b488d92f6fdea339463d04
https://github.com/Twizwei/idinvert_pytorch/tree/11f1126aab517fbe32b488d92f6fdea339463d04
import torch import numpy as np import torch.nn as nn class BatchNormLayer(nn.Module): """Implements batch normalization layer.""" def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon =1e-05): """Initializes with basic settings. Args: channels: Number of channels...
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...
TylerChoi1224/torchdiffeq
SineODE
false
1,157
[ "MIT" ]
0
72f74d9651a58ab11cdadd60682f1b61e625ef53
https://github.com/TylerChoi1224/torchdiffeq/tree/72f74d9651a58ab11cdadd60682f1b61e625ef53
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) -...
ObjectClassifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ObjectClassifier(nn.Module): """ perform log likelihood over sequence data ie. log(softmax), permute dimension accordingly to meet NLLLoss requirement Input: [seq_len, bsz, d_input] Output: [bsz, num_classes, seq_len] Usage: bsz=5; seq=16; d_input...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TuBui/deep_image_comparator
ObjectClassifier
false
1,158
[ "MIT" ]
0
2dea7738d794b91a960ee9f41461a4e3ffcd5e44
https://github.com/TuBui/deep_image_comparator/tree/2dea7738d794b91a960ee9f41461a4e3ffcd5e44
import torch from torch import nn class Model(nn.Module): """ perform log likelihood over sequence data ie. log(softmax), permute dimension accordingly to meet NLLLoss requirement Input: [seq_len, bsz, d_input] Output: [bsz, num_classes, seq_len] Usage: bsz=5; seq=16; d_input=1024; num_...
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 class GenericLayer(nn.Module): def __init__(self, layer, out_channels, padding=(0, 0, 0, 0), activation=None): super(GenericLayer, self).__init__() self._act = activation self._layer = layer self._norm = nn.InstanceNorm2d(out_channels, af...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ThomasRanvier/cnn_style_transfer
ResidualBlock
false
1,159
[ "MIT" ]
0
90b6c76c20263c22f4e45184d572284726ecbd7b
https://github.com/ThomasRanvier/cnn_style_transfer/tree/90b6c76c20263c22f4e45184d572284726ecbd7b
import torch import torch.nn as nn class GenericLayer(nn.Module): def __init__(self, layer, out_channels, padding=(0, 0, 0, 0), activation=None): super().__init__() self._act = activation self._layer = layer self._norm = nn.InstanceNorm2d(out_channels, affine=True) ...
FirstBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class BatchNormLayer(nn.Module): """Implements batch normalization layer.""" def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon =1e-05): """Initializes with basic settings. Args: channels: Number of 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 numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
Twizwei/idinvert_pytorch
FirstBlock
false
1,160
[ "MIT" ]
0
11f1126aab517fbe32b488d92f6fdea339463d04
https://github.com/Twizwei/idinvert_pytorch/tree/11f1126aab517fbe32b488d92f6fdea339463d04
import torch import numpy as np import torch.nn as nn class BatchNormLayer(nn.Module): """Implements batch normalization layer.""" def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon =1e-05): """Initializes with basic settings. Args: channels: Number of channels...
HR2O_NL
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 HR2O_NL(nn.Module): def __init__(self, hidden_dim=512, kernel_size=3, mlp_1x1=False): super(HR2O_NL, self).__init__() self.hidden_dim = hidden_dim padding = kernel_size // 2 self.conv_q = nn.Conv2d(hidden_dim, hidden_dim, kernel_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
StephenStorm/ACAR
HR2O_NL
false
1,161
[ "Apache-2.0" ]
0
21ef3eca7330bd62eccb645018c8e48d9fc52153
https://github.com/StephenStorm/ACAR/tree/21ef3eca7330bd62eccb645018c8e48d9fc52153
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, hidden_dim=512, kernel_size=3, mlp_1x1=False): super().__init__() self.hidden_dim = hidden_dim padding = kernel_size // 2 self.conv_q = nn.Conv2d(hidden_dim, hidden_dim, kernel_size, padding=...
Gated_Recurrent_Unit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torchvision.transforms import functional as F import torch.utils.data from torch import nn import torch.nn.functional as F class Gated_Recurrent_Unit(nn.Module): def __init__(self, fea_size, dropout): super(Gated_Recurrent_Unit, self).__init__() self.wih = nn.Linear(fea_size, fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.utils.data from ...
SpartaG117/scene_graph_benchmark
Gated_Recurrent_Unit
false
1,162
[ "MIT" ]
0
e2e49940dd2f752b1faf9ae26707435ba3441bcb
https://github.com/SpartaG117/scene_graph_benchmark/tree/e2e49940dd2f752b1faf9ae26707435ba3441bcb
import torch from torchvision.transforms import functional as F import torch.utils.data from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, fea_size, dropout): super().__init__() self.wih = nn.Linear(fea_size, fea_size, bias=True) self.whh = nn....
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...
TylerChoi1224/torchdiffeq
ConstantODE
false
1,163
[ "MIT" ]
0
72f74d9651a58ab11cdadd60682f1b61e625ef53
https://github.com/TylerChoi1224/torchdiffeq/tree/72f74d9651a58ab11cdadd60682f1b61e625ef53
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):...
GradientReversal
# 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.autograd import Function import torch class GradientReversalFunction(Function): """ Gradient Reversal Layer from: Unsupervised Domain Adaptation by Backpropagation (Ganin & Lempitsky, 2015) Forward pass is the identity function. In the backward pass, the upstream gradients are multipli...
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.autograd import Function assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.gu...
TheElderMindseeker/pytorch-domain-adaptation
GradientReversal
false
1,164
[ "MIT" ]
0
70ca862708bd6e59b5eee5d7c8bd808ef3457dc8
https://github.com/TheElderMindseeker/pytorch-domain-adaptation/tree/70ca862708bd6e59b5eee5d7c8bd808ef3457dc8
from torch.autograd import Function import torch class GradientReversalFunction(Function): """ Gradient Reversal Layer from: Unsupervised Domain Adaptation by Backpropagation (Ganin & Lempitsky, 2015) Forward pass is the identity function. In the backward pass, the upstream gradients are multipli...
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_...
TylerChoi1224/torchdiffeq
Decoder
false
1,165
[ "MIT" ]
0
72f74d9651a58ab11cdadd60682f1b61e625ef53
https://github.com/TylerChoi1224/torchdiffeq/tree/72f74d9651a58ab11cdadd60682f1b61e625ef53
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): ...
WeighedMSELoss
# 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.nn import MSELoss class WeighedMSELoss(MSELoss): def __init__(self, weights): super().__init__(reduction='none') self.weights = weights def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor: loss = super().forward(input, target...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import MSELoss assert_size_stride = torch._C._dynamo.guards.assert_size_str...
UT-ADL/lidar-as-camera
WeighedMSELoss
false
1,166
[ "Apache-2.0" ]
0
daccb2ae21b4899ecfd8611b7a27f91681617383
https://github.com/UT-ADL/lidar-as-camera/tree/daccb2ae21b4899ecfd8611b7a27f91681617383
import torch from torch import Tensor from torch.nn import MSELoss class Model(MSELoss): def __init__(self, weights): super().__init__(reduction='none') self.weights = weights def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor: loss = super().forward(input, target) ...
LanguageModelCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.autograd import * class LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): if target.ndim == 3: target = target.reshape(-1, target.shape[2]) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
VISLANG-Lab/MGCL
LanguageModelCriterion
false
1,167
[ "MIT" ]
0
22da06ffa7410d9632bfda8eefb1b79e4f660de0
https://github.com/VISLANG-Lab/MGCL/tree/22da06ffa7410d9632bfda8eefb1b79e4f660de0
import torch import torch.nn as nn from torch.autograd import * class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input, target, mask): if target.ndim == 3: target = target.reshape(-1, target.shape[2]) mask = mask.reshape(-1, mask.shape[...
PoolFormerBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 warnings import torch.nn as nn def _no_grad_trunc_normal_(tensor, mean, std, a, b): """Copy & paste from PyTorch official master until it's in a few official releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf """ def 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.triton_helpers import libdevice import math import ...
TranNhiem/solo-learn
PoolFormerBlock
false
1,168
[ "MIT" ]
0
7539732b68d153087d09a26a23e1edfdc49bc086
https://github.com/TranNhiem/solo-learn/tree/7539732b68d153087d09a26a23e1edfdc49bc086
import math import torch import warnings import torch.nn as nn def _no_grad_trunc_normal_(tensor, mean, std, a, b): """Copy & paste from PyTorch official master until it's in a few official releases - RW Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf """ def n...
SelfAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class SelfAttn(nn.Module): """ Self attention layer: aggreagating a sequence into a single vector. This implementation uses the attention formula proposed by Sukhbaatar etal. 2015 https://papers.nips.cc/paper/5846-end-to-end-memory-net...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TuBui/deep_image_comparator
SelfAttn
false
1,169
[ "MIT" ]
0
2dea7738d794b91a960ee9f41461a4e3ffcd5e44
https://github.com/TuBui/deep_image_comparator/tree/2dea7738d794b91a960ee9f41461a4e3ffcd5e44
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ Self attention layer: aggreagating a sequence into a single vector. This implementation uses the attention formula proposed by Sukhbaatar etal. 2015 https://papers.nips.cc/paper/5846-end-to-end-memory-networ...
SinkhornKnopp
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed as dist class SinkhornKnopp(torch.nn.Module): def __init__(self, num_iters: 'int'=3, epsilon: 'float'=0.05, world_size: 'int'=1): """Approximates optimal transport using the Sinkhorn-Knopp algorithm. A simple iterative method to approach the double s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
TranNhiem/solo-learn
SinkhornKnopp
false
1,170
[ "MIT" ]
0
7539732b68d153087d09a26a23e1edfdc49bc086
https://github.com/TranNhiem/solo-learn/tree/7539732b68d153087d09a26a23e1edfdc49bc086
import torch import torch.distributed as dist class Model(torch.nn.Module): def __init__(self, num_iters: 'int'=3, epsilon: 'float'=0.05, world_size: 'int'=1): """Approximates optimal transport using the Sinkhorn-Knopp algorithm. A simple iterative method to approach the double stochasti...
RewardCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.autograd import * class RewardCriterion(nn.Module): def __init__(self): super(RewardCriterion, self).__init__() def forward(self, input, seq, reward): input = input.gather(2, seq.unsqueeze(2)).squeeze(2) input = input.reshape(-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 import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
VISLANG-Lab/MGCL
RewardCriterion
false
1,171
[ "MIT" ]
0
22da06ffa7410d9632bfda8eefb1b79e4f660de0
https://github.com/VISLANG-Lab/MGCL/tree/22da06ffa7410d9632bfda8eefb1b79e4f660de0
import torch import torch.nn as nn from torch.autograd import * class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input, seq, reward): input = input.gather(2, seq.unsqueeze(2)).squeeze(2) input = input.reshape(-1) reward = reward.reshape(-1) ...
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....
TylerChoi1224/torchdiffeq
ResBlock
false
1,172
[ "MIT" ]
0
72f74d9651a58ab11cdadd60682f1b61e625ef53
https://github.com/TylerChoi1224/torchdiffeq/tree/72f74d9651a58ab11cdadd60682f1b61e625ef53
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...
MultiheadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class MultiheadAttention(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with residual connection, and positional encoding used in DETR is also passed as input. Args: embed_dims (int): The embedding dimens...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
VIRC-lab-csust/AGMNet
MultiheadAttention
false
1,173
[ "Apache-2.0" ]
0
ead95466da343cf9436774138c642d2ca12da4e4
https://github.com/VIRC-lab-csust/AGMNet/tree/ead95466da343cf9436774138c642d2ca12da4e4
import torch import torch.nn as nn class Model(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with residual connection, and positional encoding used in DETR is also passed as input. Args: embed_dims (int): The embedding dimension. ...
Model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, action_dim, conv=False, conv_size=16, fc_size=32, K=2): super(Model, self).__init__() self.input_size = input_size self.input_h = int(np.sqr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
VashishtMadhavan/pytorch-maml-rl
Model
false
1,174
[ "MIT" ]
0
d8821b8374d973869bb6a1393f1b2c369c9a664b
https://github.com/VashishtMadhavan/pytorch-maml-rl/tree/d8821b8374d973869bb6a1393f1b2c369c9a664b
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, action_dim, conv=False, conv_size=16, fc_size=32, K=2): super(Model, self).__init__() self.input_size = input_size self.input_h = int(np.sqr...
SoftClDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn import torch.jit import torch.nn.functional as F import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: f...
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 numpy as np from torch import nn import torch.jit import torch.nn.functional as F ...
CamilaGL/nnUNet
SoftClDiceLoss
false
1,175
[ "Apache-2.0" ]
0
471ab73a6e4f67fc72d476183b5344be4cccf7ca
https://github.com/CamilaGL/nnUNet/tree/471ab73a6e4f67fc72d476183b5344be4cccf7ca
import torch import numpy as np from torch import nn import torch.jit import torch.nn.functional as F import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: f...
ConvLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class ConvLayer(nn.Module): """A Convolutional Layer""" def __init__(self, in_channels=1, out_channels=256, kernel_size=9, stride=1 ): super(ConvLayer, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VIVelev/capsnets
ConvLayer
false
1,176
[ "MIT" ]
0
dca4bfcd4007977a6bc3534a4676880326fcf94a
https://github.com/VIVelev/capsnets/tree/dca4bfcd4007977a6bc3534a4676880326fcf94a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """A Convolutional Layer""" def __init__(self, in_channels=1, out_channels=256, kernel_size=9, stride=1 ): super().__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """Multi-headed Attention for input Query, Key, Value Multi-headed Attention is a module for attention mechanisms which runs through attention in several times in parallel, then the multiple...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
UdbhavPrasad072300/Kaggle-Competition-Templates
MultiHeadAttention
false
1,177
[ "MIT" ]
0
f3c93ff60ae33af9b6c6d79d30c5099eb250396c
https://github.com/UdbhavPrasad072300/Kaggle-Competition-Templates/tree/f3c93ff60ae33af9b6c6d79d30c5099eb250396c
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Multi-headed Attention for input Query, Key, Value Multi-headed Attention is a module for attention mechanisms which runs through attention in several times in parallel, then the multiple outputs are ...
WeighedL1Loss
# 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.nn import L1Loss class WeighedL1Loss(L1Loss): def __init__(self, weights): super().__init__(reduction='none') self.weights = weights def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor: loss = super().forward(input, target) ...
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.nn import L...
UT-ADL/lidar-as-camera
WeighedL1Loss
false
1,178
[ "Apache-2.0" ]
0
daccb2ae21b4899ecfd8611b7a27f91681617383
https://github.com/UT-ADL/lidar-as-camera/tree/daccb2ae21b4899ecfd8611b7a27f91681617383
import torch from torch import Tensor from torch.nn import L1Loss class Model(L1Loss): def __init__(self, weights): super().__init__(reduction='none') self.weights = weights def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor: loss = super().forward(input, target) r...
MaskL1Loss
# 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 MaskL1Loss(nn.Module): def __init__(self, eps=1e-06): super(MaskL1Loss, self).__init__() self.eps = eps def forward(self, pred: 'torch.Tensor', gt, mask): loss = (torch.abs(pred - gt) * mask).sum() / (mask.sum() + self.eps) return loss ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
Vivianyzw/Dual.DBNet.pytorch
MaskL1Loss
false
1,179
[ "Apache-2.0", "MIT" ]
0
19d823ed7c05076c087a3f7ad1127c71c1c0d692
https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692
import torch from torch import nn class Model(nn.Module): def __init__(self, eps=1e-06): super().__init__() self.eps = eps def forward(self, pred: 'torch.Tensor', gt, mask): loss = (torch.abs(pred - gt) * mask).sum() / (mask.sum() + self.eps) return loss def get_inputs(): ...
HardSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F class HardSigmoid(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold...
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...
Vivianyzw/Dual.DBNet.pytorch
HardSigmoid
false
1,180
[ "Apache-2.0", "MIT" ]
0
19d823ed7c05076c087a3f7ad1127c71c1c0d692
https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold(-x, -...
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.autograd import * class FullyConnectedLayer(nn.Module): def __init__(self, in_size, out_size, dropout_r=0.0, use_relu=True): super(FullyConnectedLayer, self).__init__() self.dropout_r = dropout_r self.use_relu = use_relu self.linear = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
VISLANG-Lab/MGCL
MLP
false
1,181
[ "MIT" ]
0
22da06ffa7410d9632bfda8eefb1b79e4f660de0
https://github.com/VISLANG-Lab/MGCL/tree/22da06ffa7410d9632bfda8eefb1b79e4f660de0
import torch import torch.nn as nn from torch.autograd import * class FullyConnectedLayer(nn.Module): def __init__(self, in_size, out_size, dropout_r=0.0, use_relu=True): super().__init__() self.dropout_r = dropout_r self.use_relu = use_relu self.linear = nn.Linear(in_size, out_si...
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 from torch import nn class DiceLoss(nn.Module): """ Loss function from https://arxiv.org/abs/1707.03237, where iou computation is introduced heatmap manner to measure the diversity bwtween tow heatmaps. """ def __init__(self, eps=1e-06): super(DiceLoss, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Vivianyzw/Dual.DBNet.pytorch
DiceLoss
false
1,182
[ "Apache-2.0", "MIT" ]
0
19d823ed7c05076c087a3f7ad1127c71c1c0d692
https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692
import torch from torch import nn class Model(nn.Module): """ Loss function from https://arxiv.org/abs/1707.03237, where iou computation is introduced heatmap manner to measure the diversity bwtween tow heatmaps. """ def __init__(self, eps=1e-06): super().__init__() self.eps =...
AFMLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import itertools import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class AFMLayer(nn.Module): """Attentonal Factorization Machine models pairwise (order-2) feature interactions without linear term and bias. Input shape - A list of 3D tensor with sha...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Sunmyunghan/Final_Project
AFMLayer
false
1,183
[ "MIT" ]
0
28cde293dc6d07521b2e1c5613b20444aea91d21
https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21
import itertools import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Model(nn.Module): """Attentonal Factorization Machine models pairwise (order-2) feature interactions without linear term and bias. Input shape - A list of 3D tensor with shape:...
Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Discriminator(nn.Module): def __init__(self, outputs_size, K=2): super(Discriminator, self).__init__() self.fc1 = nn.Linear(outputs_size, outputs_size // K, bias=True) outputs_size = out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from sk...
Ulian7/DeepCTR
Discriminator
false
1,184
[ "Apache-2.0" ]
0
d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5
https://github.com/Ulian7/DeepCTR/tree/d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Model(nn.Module): def __init__(self, outputs_size, K=2): super().__init__() self.fc1 = nn.Linear(outputs_size, outputs_size // K, bias=True) outputs_size = outputs_size // K self...
APL
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn.parameter import Parameter class APL(nn.Module): """ Implementation of APL (ADAPTIVE PIECEWISE LINEAR UNITS) unit: .. math:: APL(x_i) = max(0,x) + \\sum_{s=1}^{S}{a_i^s * max(0, -x + b_i^s)} with trainable parameters a and b, parameter...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from torch.nn.parameter import Parameter assert_size_stride = torch....
Venkateshwar2506/Echo
APL
false
1,185
[ "MIT" ]
0
5d236b25ee4900754f48e0a865e1bf1ae9183875
https://github.com/Venkateshwar2506/Echo/tree/5d236b25ee4900754f48e0a865e1bf1ae9183875
import torch from torch import nn from torch.nn.parameter import Parameter class Model(nn.Module): """ Implementation of APL (ADAPTIVE PIECEWISE LINEAR UNITS) unit: .. math:: APL(x_i) = max(0,x) + \\sum_{s=1}^{S}{a_i^s * max(0, -x + b_i^s)} with trainable parameters a and b, paramet...
ClipLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch import nn import torch.distributed as dist import torch.distributed.nn def gather_features(image_features, text_features, aug1_embed=None, aug2_embed=None, local_loss=False, gather_with_grad=False, rank=0, world_size=1, horovod=False): if horovod: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Vaishaal/open_clip
ClipLoss
false
1,186
[ "MIT" ]
0
8877c4036dacde022da90769c64006d9f2c82e84
https://github.com/Vaishaal/open_clip/tree/8877c4036dacde022da90769c64006d9f2c82e84
import torch import torch.nn.functional as F from torch import nn import torch.distributed as dist import torch.distributed.nn def gather_features(image_features, text_features, aug1_embed=None, aug2_embed=None, local_loss=False, gather_with_grad=False, rank=0, world_size=1, horovod=False): if horovod: ...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Encoder(nn.Module): def __init__(self): super(Encoder, self).__init__() self.Conv1 = nn.Conv2d(1, 16, 3, 1, 1) self.Relu = nn.ReLU(inplace=True) self.layers = nn.ModuleDict({'DenseConv1': nn.Conv2d(16, 16, 3, 1, 1), 'DenseConv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
VarunBabbar/Image_Compressor
Encoder
false
1,187
[ "MIT" ]
0
254d8d411f7cd16f3ce242275532c9fca537269c
https://github.com/VarunBabbar/Image_Compressor/tree/254d8d411f7cd16f3ce242275532c9fca537269c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.Conv1 = nn.Conv2d(1, 16, 3, 1, 1) self.Relu = nn.ReLU(inplace=True) self.layers = nn.ModuleDict({'DenseConv1': nn.Conv2d(16, 16, 3, 1, 1), 'DenseConv2': nn.Conv2d(32...
architecture
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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): super(Decoder, self).__init__() self.layers = nn.Sequential() self.layers.add_module('Conv3', nn.Conv2d(64, 32, 3, 1, 1)) self.layers.add_module('Act3', nn.ReLU(inplace=True)) self.layers.add_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
VarunBabbar/Image_Compressor
architecture
false
1,188
[ "MIT" ]
0
254d8d411f7cd16f3ce242275532c9fca537269c
https://github.com/VarunBabbar/Image_Compressor/tree/254d8d411f7cd16f3ce242275532c9fca537269c
import torch import torch.nn as nn class Decoder(nn.Module): def __init__(self): super().__init__() self.layers = nn.Sequential() self.layers.add_module('Conv3', nn.Conv2d(64, 32, 3, 1, 1)) self.layers.add_module('Act3', nn.ReLU(inplace=True)) self.layers.add_module('Conv4...
SReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn.parameter import Parameter class SReLU(nn.Module): """ SReLU (S-shaped Rectified Linear Activation Unit): a combination of three linear functions, which perform mapping R → R with the following formulation: .. math:: h(x_i) = \\left\\{\\begin{matri...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_...
Venkateshwar2506/Echo
SReLU
false
1,189
[ "MIT" ]
0
5d236b25ee4900754f48e0a865e1bf1ae9183875
https://github.com/Venkateshwar2506/Echo/tree/5d236b25ee4900754f48e0a865e1bf1ae9183875
import torch from torch import nn from torch.nn.parameter import Parameter class Model(nn.Module): """ SReLU (S-shaped Rectified Linear Activation Unit): a combination of three linear functions, which perform mapping R → R with the following formulation: .. math:: h(x_i) = \\left\\{\\begin{matri...
ResnetBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ResnetBlock(nn.Module): def __init__(self, in_channels, out_channels, use_bn=False): super(ResnetBlock, self).__init__() self.in_channels = in_channels self.out_channels = out_channels self.use_bn = use_bn self.relu = nn.ReLU(inplac...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
VashishtMadhavan/pytorch-maml-rl
ResnetBlock
false
1,190
[ "MIT" ]
0
d8821b8374d973869bb6a1393f1b2c369c9a664b
https://github.com/VashishtMadhavan/pytorch-maml-rl/tree/d8821b8374d973869bb6a1393f1b2c369c9a664b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, use_bn=False): super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.use_bn = use_bn self.relu = nn.ReLU(inplace=True) self.co...
ODEfunc
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 norm(dim): return nn.GroupNorm(min(32, dim), dim) 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 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
TylerChoi1224/torchdiffeq
ODEfunc
false
1,191
[ "MIT" ]
0
72f74d9651a58ab11cdadd60682f1b61e625ef53
https://github.com/TylerChoi1224/torchdiffeq/tree/72f74d9651a58ab11cdadd60682f1b61e625ef53
import torch import torch.nn as nn def norm(dim): return nn.GroupNorm(min(32, dim), dim) 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().__init__() module = nn.ConvTranspose2d...
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): super(Decoder, self).__init__() self.layers = nn.Sequential() self.layers.add_module('Conv3', nn.Conv2d(64, 32, 3, 1, 1)) self.layers.add_module('Act3', nn.ReLU(inplace=True)) self.layers.add_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
VarunBabbar/Image_Compressor
Decoder
false
1,192
[ "MIT" ]
0
254d8d411f7cd16f3ce242275532c9fca537269c
https://github.com/VarunBabbar/Image_Compressor/tree/254d8d411f7cd16f3ce242275532c9fca537269c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.layers = nn.Sequential() self.layers.add_module('Conv3', nn.Conv2d(64, 32, 3, 1, 1)) self.layers.add_module('Act3', nn.ReLU(inplace=True)) self.layers.add_module('Conv4',...
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 from torch import nn import torch.nn.functional as F class HardSigmoid(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
Vivianyzw/Dual.DBNet.pytorch
SEBlock
false
1,193
[ "Apache-2.0", "MIT" ]
0
19d823ed7c05076c087a3f7ad1127c71c1c0d692
https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692
import torch from torch import nn import torch.nn.functional as F class HardSigmoid(nn.Module): def __init__(self, slope=0.2, offset=0.5): super().__init__() self.slope = slope self.offset = offset def forward(self, x): x = self.slope * x + self.offset x = F.threshold...
CELoss
# 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 CELoss(nn.Module): """ Cross Entorpy Loss Wrapper Args: loss_weight (float): Weight of the loss. Default: 1.0. """ def __init__(self, loss_weight=1.0): super().__init__() self.loss_weight = loss_weight self.criterion = nn.Cross...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
WangXin93/mmpose
CELoss
false
1,194
[ "Apache-2.0" ]
0
28b6e9ac2f6ed195ab27fb04da2213fc885a5994
https://github.com/WangXin93/mmpose/tree/28b6e9ac2f6ed195ab27fb04da2213fc885a5994
import torch import torch.nn as nn class Model(nn.Module): """ Cross Entorpy Loss Wrapper Args: loss_weight (float): Weight of the loss. Default: 1.0. """ def __init__(self, loss_weight=1.0): super().__init__() self.loss_weight = loss_weight self.criterion = nn.CrossE...
AttentionPool2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn import torch.distributed.nn class AttentionPool2d(nn.Module): def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads: 'int', output_dim: 'int'=None): super().__init__() self.positional_embedding = nn.Parameter(t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Vaishaal/open_clip
AttentionPool2d
false
1,195
[ "MIT" ]
0
8877c4036dacde022da90769c64006d9f2c82e84
https://github.com/Vaishaal/open_clip/tree/8877c4036dacde022da90769c64006d9f2c82e84
import torch import torch.nn.functional as F from torch import nn import torch.distributed.nn class Model(nn.Module): def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads: 'int', output_dim: 'int'=None): super().__init__() self.positional_embedding = nn.Parameter(torch.randn...
TemperatureScaleTrainer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 TemperatureScaleTrainer(nn.Module): def __init__(self): super(TemperatureScaleTrainer, self).__init__() self._temperature = nn.Parameter(torch.ones(1), requires_grad=True) if torch.cuda.is_available(): self._temperature self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Kageshimasu/temperature-scaling-optimizer
TemperatureScaleTrainer
false
1,196
[ "MIT" ]
0
3af562e6c3fefef97aec0431d08b8e8275d275c7
https://github.com/Kageshimasu/temperature-scaling-optimizer/tree/3af562e6c3fefef97aec0431d08b8e8275d275c7
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self._temperature = nn.Parameter(torch.ones(1), requires_grad=True) if torch.cuda.is_available(): self._temperature self def forward(self, logits: 'torch.Tensor')...
ELUPlus
# 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.nn class ELUPlus(nn.Module): def __init__(self): super().__init__() self.elu = nn.ELU() def forward(self, x): return self.elu(x) + 1.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.nn assert_size_stride = torch._C._dynamo.guar...
UzTak/nflows
ELUPlus
false
1,197
[ "MIT" ]
0
7211b129bfd60fabed199a1d2a3272b2aac8bbda
https://github.com/UzTak/nflows/tree/7211b129bfd60fabed199a1d2a3272b2aac8bbda
import torch from torch import nn import torch.nn class Model(nn.Module): def __init__(self): super().__init__() self.elu = nn.ELU() def forward(self, x): return self.elu(x) + 1.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
InteractingLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class InteractingLayer(nn.Module): """A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism. Input shape - A 3D tensor with shape...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Ulian7/DeepCTR
InteractingLayer
false
1,198
[ "Apache-2.0" ]
0
d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5
https://github.com/Ulian7/DeepCTR/tree/d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Model(nn.Module): """A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism. Input shape - A 3D tensor with shape: ``(batch_...
CombinedTargetMSELoss
# 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 CombinedTargetMSELoss(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into ...
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...
WangXin93/mmpose
CombinedTargetMSELoss
false
1,199
[ "Apache-2.0" ]
0
28b6e9ac2f6ed195ab27fb04da2213fc885a5994
https://github.com/WangXin93/mmpose/tree/28b6e9ac2f6ed195ab27fb04da2213fc885a5994
import torch import torch.nn as nn class Model(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into Unbiased Data Pr...
AUGRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class AUGRUCell(nn.Module): """ Effect of GRU with attentional update gate (AUGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Sunmyunghan/Final_Project
AUGRUCell
false
1,200
[ "MIT" ]
0
28cde293dc6d07521b2e1c5613b20444aea91d21
https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Model(nn.Module): """ Effect of GRU with attentional update gate (AUGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018...
BiInteractionPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from sklearn.metrics import * class BiInteractionPooling(nn.Module): """Bi-Interaction Layer used in Neural FM,compress the pairwise element-wise product of features into one single vector. Input shape - A 3D tensor with shape:``(batch_size,field_size,embeddi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from sklearn.metrics import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
Sunmyunghan/Final_Project
BiInteractionPooling
false
1,201
[ "MIT" ]
0
28cde293dc6d07521b2e1c5613b20444aea91d21
https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21
import torch import torch.nn as nn from sklearn.metrics import * class Model(nn.Module): """Bi-Interaction Layer used in Neural FM,compress the pairwise element-wise product of features into one single vector. Input shape - A 3D tensor with shape:``(batch_size,field_size,embedding_size)``. ...
AGRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class AGRUCell(nn.Module): """ Attention based GRU (AGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018. """ def __...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Sunmyunghan/Final_Project
AGRUCell
false
1,202
[ "MIT" ]
0
28cde293dc6d07521b2e1c5613b20444aea91d21
https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Model(nn.Module): """ Attention based GRU (AGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018. """ def __ini...
cha_loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.optim import torch.cuda class cha_loss(nn.Module): def __init__(self, eps=0.001): super(cha_loss, self).__init__() self.eps = eps return def forward(self, inp, target): diff = torch.abs(inp - target) ** 2 + self.eps ** 2 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Weepingchestnut/OVSR
cha_loss
false
1,203
[ "Apache-2.0" ]
0
11554a3b1072d50a8c88cf59b4b986df1fda73f9
https://github.com/Weepingchestnut/OVSR/tree/11554a3b1072d50a8c88cf59b4b986df1fda73f9
import torch import torch.nn as nn import torch.optim import torch.cuda class Model(nn.Module): def __init__(self, eps=0.001): super().__init__() self.eps = eps return def forward(self, inp, target): diff = torch.abs(inp - target) ** 2 + self.eps ** 2 out = torch.sqrt...
AvgReducePool1d
# 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 AvgReducePool1d(nn.Module): """A subclass of :torch_nn:`Module`. Avg Pool layer for 1D inputs. The same as :torch_nn:`AvgPool1d` except that the pooling dimension is entirely reduced (i.e., `pool_size=input_length`). """ def forward(self, input: 'torch.Tens...
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...
WangXinglin/BIT_framework
AvgReducePool1d
false
1,204
[ "MIT" ]
0
1484874fcd00d052c7536789dec95050b480b25d
https://github.com/WangXinglin/BIT_framework/tree/1484874fcd00d052c7536789dec95050b480b25d
import torch from torch import nn class Model(nn.Module): """A subclass of :torch_nn:`Module`. Avg Pool layer for 1D inputs. The same as :torch_nn:`AvgPool1d` except that the pooling dimension is entirely reduced (i.e., `pool_size=input_length`). """ def forward(self, input: 'torch.Tensor') ->tor...
T5LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 T5LayerNorm(nn.Module): """ Custom LayerNorm for T5 with no mean subtraction and no bias. """ def __init__(self, input_size: 'int', eps: 'float'=1e-05): super().__init__() self.w = nn.Parameter(torch.ones(input_size)) self.eps = eps def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
WangXinglin/BIT_framework
T5LayerNorm
false
1,205
[ "MIT" ]
0
1484874fcd00d052c7536789dec95050b480b25d
https://github.com/WangXinglin/BIT_framework/tree/1484874fcd00d052c7536789dec95050b480b25d
import torch from torch import nn class Model(nn.Module): """ Custom LayerNorm for T5 with no mean subtraction and no bias. """ def __init__(self, input_size: 'int', eps: 'float'=1e-05): super().__init__() self.w = nn.Parameter(torch.ones(input_size)) self.eps = eps def forwa...
GraphConvolution
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.modules.module import Module import torch.nn.modules.loss import torch.utils.data class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
WanyuGroup/CVPR2022-OrphicX
GraphConvolution
false
1,206
[ "MIT" ]
0
98d8d8259439c45661573e575cf956331df16abc
https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.modules.module import Module import torch.nn.modules.loss import torch.utils.data class Model(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_featu...
Normalize
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F class Normalize(nn.Module): """Performs :math:`L_p` normalization of inputs over specified dimension. Does: .. math:: v = \\frac{v}{\\max(\\lVert v \\rVert_p, \\epsilon)} for each subtensor v over dimension dim of input...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
WillyChen123/CDFNet
Normalize
false
1,207
[ "MIT" ]
0
12d6b288aa2a8301683395a75bd44a7be44b7f2a
https://github.com/WillyChen123/CDFNet/tree/12d6b288aa2a8301683395a75bd44a7be44b7f2a
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): """Performs :math:`L_p` normalization of inputs over specified dimension. Does: .. math:: v = \\frac{v}{\\max(\\lVert v \\rVert_p, \\epsilon)} for each subtensor v over dimension dim of input. Ea...
InnerProductDecoder
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.modules.loss import torch.utils.data class InnerProductDecoder(nn.Module): """Decoder for using inner product for prediction.""" def __init__(self, dropout, act=torch.sigmoid): super(InnerProductDecoder, 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.nn as nn import torch.nn.modules.loss import torch.utils.data asser...
WanyuGroup/CVPR2022-OrphicX
InnerProductDecoder
false
1,208
[ "MIT" ]
0
98d8d8259439c45661573e575cf956331df16abc
https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.modules.loss import torch.utils.data class Model(nn.Module): """Decoder for using inner product for prediction.""" def __init__(self, dropout, act=torch.sigmoid): super().__init__() self.dropout = dropout ...
InnerProductDecoderMLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.nn.modules.loss import torch.utils.data class InnerProductDecoderMLP(nn.Module): """Decoder for using inner product for prediction.""" def __init__(self, input_dim, hidden_dim1, hidden_dim2, dropout, act= torch.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 import triton_helpers import torch.nn as nn import ...
WanyuGroup/CVPR2022-OrphicX
InnerProductDecoderMLP
false
1,209
[ "MIT" ]
0
98d8d8259439c45661573e575cf956331df16abc
https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.modules.loss import torch.utils.data class Model(nn.Module): """Decoder for using inner product for prediction.""" def __init__(self, input_dim, hidden_dim1, hidden_dim2, dropout, act= torch.sigmoid): super()._...
Accuracy
# 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 sklearn.metrics import * import torch.nn as nn def accuracy(logits, labels, ignore_index: 'int'=-100): with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_mask return correct.s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from sklearn.metrics import * import torch.nn as nn assert_size_stride = torch._C._dynamo...
Vasyka/DeepGQuad
Accuracy
false
1,210
[ "Apache-2.0" ]
0
772a461732fc4044a1dee84d2688bf16960e272c
https://github.com/Vasyka/DeepGQuad/tree/772a461732fc4044a1dee84d2688bf16960e272c
import torch from sklearn.metrics import * import torch.nn as nn def accuracy(logits, labels, ignore_index: 'int'=-100): with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_mask return correct.s...
InteractingLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class InteractingLayer(nn.Module): """A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism. Input shape - A 3D tensor with shape...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Sunmyunghan/Final_Project
InteractingLayer
false
1,211
[ "MIT" ]
0
28cde293dc6d07521b2e1c5613b20444aea91d21
https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class Model(nn.Module): """A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism. Input shape - A 3D tensor with shape: ``(batch_...
SoftDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss class SoftDiceLoss(_Loss): def __init__(self, size_average=None, reduce=None, reduction='mean'): super(SoftDiceLoss, self).__init__(size_average, reduce, reduction) def forward(self, y_pred, y_gt): numerator = torch.sum(y_pred * y_gt) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.asse...
Will3577/Medical-Transformer
SoftDiceLoss
false
1,212
[ "MIT" ]
0
e72bfe68fcd55268f57bc7c27b4cbce8029d1b81
https://github.com/Will3577/Medical-Transformer/tree/e72bfe68fcd55268f57bc7c27b4cbce8029d1b81
import torch from torch.nn.modules.loss import _Loss class Model(_Loss): def __init__(self, size_average=None, reduce=None, reduction='mean'): super().__init__(size_average, reduce, reduction) def forward(self, y_pred, y_gt): numerator = torch.sum(y_pred * y_gt) denominator = torch.s...
VGAE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.modules.loss import torch.utils.data class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
WanyuGroup/CVPR2022-OrphicX
VGAE
false
1,213
[ "MIT" ]
0
98d8d8259439c45661573e575cf956331df16abc
https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.modules.loss import torch.utils.data class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
SeparableConv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SeparableConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding='same', bias=False): super(SeparableConv1d, self).__init__() if stride > 1: padding = 0 self.depthwise = nn.Conv1d(in_chann...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
WhiteTeaDragon/hw-asr
SeparableConv1d
false
1,214
[ "MIT" ]
0
78a767ab00a743b8d28d1fdad795f066fc0795da
https://github.com/WhiteTeaDragon/hw-asr/tree/78a767ab00a743b8d28d1fdad795f066fc0795da
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding='same', bias=False): super().__init__() if stride > 1: padding = 0 self.depthwise = nn.Conv1d(in_channels, in_channels, kernel_size= ...
GetMask
# 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.multiprocessing import torch.utils.data class GetMask(torch.nn.Module): """ inputs: x: any size outputs:mask: same size as input x """ def __init__(self, pad_idx=0): super(GetMask, self).__init__() self.pad_idx = pad_idx def forward(se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.multiprocessing import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = to...
WuDiDaBinGe/TAKG
GetMask
false
1,215
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch import torch.multiprocessing import torch.utils.data class Model(torch.nn.Module): """ inputs: x: any size outputs:mask: same size as input x """ def __init__(self, pad_idx=0): super().__init__() self.pad_idx = pad_idx def forward(self, x): ...
SmoothCrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss import torch.utils.tensorboard class SmoothCrossEntropyLoss(_WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0): super().__init__(weight=weight, reduction=reduction) self.smoo...
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.nn.modules....
Dieg0Alejandr0/3D-Generative-SBDD
SmoothCrossEntropyLoss
false
1,216
[ "MIT" ]
0
51ffd36a6cf5048eeff6e68186a4608048feea4c
https://github.com/Dieg0Alejandr0/3D-Generative-SBDD/tree/51ffd36a6cf5048eeff6e68186a4608048feea4c
import torch import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss import torch.utils.tensorboard class Model(_WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0): super().__init__(weight=weight, reduction=reduction) self.smoothing = smoothing...
StandardNLL
# 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.multiprocessing import torch.utils.data class StandardNLL(torch.nn.modules.loss._Loss): """ Shape: log_prob: batch x time x class y_true: batch x time mask: batch x time output: batch """ def forward(self, log_prob, y_true, mas...
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.multiprocessing import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = to...
WuDiDaBinGe/TAKG
StandardNLL
false
1,217
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch import torch.multiprocessing import torch.utils.data class Model(torch.nn.modules.loss._Loss): """ Shape: log_prob: batch x time x class y_true: batch x time mask: batch x time output: batch """ def forward(self, log_prob, y_true, mask): ...
MLP_model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class MLP_model(nn.Module): """Feedfoward neural network with 6 hidden layer""" def __init__(self, in_size, out_size): super().__init__() self.linear1 = nn.Linear(in_size, 4096) self.linear2 = nn.Linear(4096, 2048) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
WeihengXia0123/Machine_Learning_Service
MLP_model
false
1,218
[ "MIT" ]
0
516d64ff780317ee96e18584001b77165ce6531c
https://github.com/WeihengXia0123/Machine_Learning_Service/tree/516d64ff780317ee96e18584001b77165ce6531c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Feedfoward neural network with 6 hidden layer""" def __init__(self, in_size, out_size): super().__init__() self.linear1 = nn.Linear(in_size, 4096) self.linear2 = nn.Linear(4096, 2048) ...
MaskedSoftmax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn import functional as F import torch.multiprocessing from torch import nn import torch.utils.data class MaskedSoftmax(nn.Module): def __init__(self, dim): super(MaskedSoftmax, self).__init__() self.dim = dim def forward(self, logit, mask=None): if mask is No...
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.multiproc...
WuDiDaBinGe/TAKG
MaskedSoftmax
false
1,219
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch from torch.nn import functional as F import torch.multiprocessing from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, logit, mask=None): if mask is None: max_value =...
ShiftedSoftplus
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.tensorboard class ShiftedSoftplus(nn.Module): def __init__(self): super().__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def ge...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.utils.tensorboard assert_si...
Dieg0Alejandr0/3D-Generative-SBDD
ShiftedSoftplus
false
1,220
[ "MIT" ]
0
51ffd36a6cf5048eeff6e68186a4608048feea4c
https://github.com/Dieg0Alejandr0/3D-Generative-SBDD/tree/51ffd36a6cf5048eeff6e68186a4608048feea4c
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.tensorboard class Model(nn.Module): def __init__(self): super().__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_inputs()...
InnerProductLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from sklearn.metrics import * class InnerProductLayer(nn.Module): """InnerProduct Layer used in PNN that compute the element-wise product or inner product between feature vectors. Input shape - a list of 3D tensor with shape: ``(batch_size,1,embedding_size)``. ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from sklearn.metrics import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
Sunmyunghan/Final_Project
InnerProductLayer
false
1,221
[ "MIT" ]
0
28cde293dc6d07521b2e1c5613b20444aea91d21
https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21
import torch import torch.nn as nn from sklearn.metrics import * class Model(nn.Module): """InnerProduct Layer used in PNN that compute the element-wise product or inner product between feature vectors. Input shape - a list of 3D tensor with shape: ``(batch_size,1,embedding_size)``. Output...
TransferNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 GenericLayer(nn.Module): def __init__(self, layer, out_channels, padding=(0, 0, 0, 0), activation=None): super(GenericLayer, self).__init__() self._act = activation self._layer = layer self._norm = nn.InstanceNorm2d(out_channels, af...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ThomasRanvier/cnn_style_transfer
TransferNet
false
1,222
[ "MIT" ]
0
90b6c76c20263c22f4e45184d572284726ecbd7b
https://github.com/ThomasRanvier/cnn_style_transfer/tree/90b6c76c20263c22f4e45184d572284726ecbd7b
import torch import torch.nn as nn class GenericLayer(nn.Module): def __init__(self, layer, out_channels, padding=(0, 0, 0, 0), activation=None): super().__init__() self._act = activation self._layer = layer self._norm = nn.InstanceNorm2d(out_channels, affine=True) ...
MSE_Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class MSE_Loss(nn.Module): def __init__(self, sum_dim=None, sqrt=False, dimension_warn=0): super().__init__() self.sum_dim = sum_dim self.sqrt = sqrt self.dimension_warn = dimension_warn def forward(self, x, y): assert x.shape == y.s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
WorksApplications/omni_torch
MSE_Loss
false
1,223
[ "Apache-2.0" ]
0
10b689d794c8f485e38c765303ef018da17bc641
https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, sum_dim=None, sqrt=False, dimension_warn=0): super().__init__() self.sum_dim = sum_dim self.sqrt = sqrt self.dimension_warn = dimension_warn def forward(self, x, y): assert x.shape == y.shap...
KL_Divergence
# 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 KL_Divergence(nn.Module): def __init__(self, sum_dim=None, sqrt=False, dimension_warn=0): super().__init__() self.sum_dim = sum_dim self.sqrt = sqrt self.dimension_warn = dimension_warn def forward(self, x, y): x = x.view(x.siz...
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 ...
WorksApplications/omni_torch
KL_Divergence
false
1,224
[ "Apache-2.0" ]
0
10b689d794c8f485e38c765303ef018da17bc641
https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, sum_dim=None, sqrt=False, dimension_warn=0): super().__init__() self.sum_dim = sum_dim self.sqrt = sqrt self.dimension_warn = dimension_warn def forward(self, x, y): x = x.view(x.size(0), x....
FC_Layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def standardize(param, assert_length): if type(param) is not list and type(param) is not tuple: param = [param] * assert_length assert len(param ) == assert_length, 'expect %s input params, got %s input parameter' % ( assert_length, len(param)) re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
WorksApplications/omni_torch
FC_Layer
false
1,225
[ "Apache-2.0" ]
0
10b689d794c8f485e38c765303ef018da17bc641
https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641
import torch import torch.nn as nn def standardize(param, assert_length): if type(param) is not list and type(param) is not tuple: param = [param] * assert_length assert len(param ) == assert_length, 'expect %s input params, got %s input parameter' % ( assert_length, len(param)) re...
JS_Divergence
# 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 JS_Divergence(nn.Module): def __init__(self): super().__init__() self.engine = nn.KLDivLoss() def forward(self, x, y): return self.engine(x, y) + self.engine(y, x) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
WorksApplications/omni_torch
JS_Divergence
false
1,226
[ "Apache-2.0" ]
0
10b689d794c8f485e38c765303ef018da17bc641
https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.engine = nn.KLDivLoss() def forward(self, x, y): return self.engine(x, y) + self.engine(y, x) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] d...
ContextGate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.multiprocessing from torch import nn import torch.utils.data class ContextGate(nn.Module): def __init__(self, vector_dim, topic_dim): super().__init__() assert vector_dim == topic_dim self.fusion_linear = nn.Linear(vector_dim + topic_dim, vector_dim) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.multip...
WuDiDaBinGe/TAKG
ContextGate
false
1,227
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch import torch.multiprocessing from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, vector_dim, topic_dim): super().__init__() assert vector_dim == topic_dim self.fusion_linear = nn.Linear(vector_dim + topic_dim, vector_dim) self.sigmo...
ClassicMixtureDensityModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ClassicMixtureDensityModule(nn.Module): def __init__(self, dim_input, dim_output, num_components): super(ClassicMixtureDensityModule, self).__init__() self.dim_input = dim_input self.dim_output = dim_output self.M = num_components se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Woodenonez/MultimodalMotionPred_SamplingWTACGF_Pytorch
ClassicMixtureDensityModule
false
1,228
[ "MIT" ]
0
2be4f8aaaebb9ec80b29d4ff86146010a0192573
https://github.com/Woodenonez/MultimodalMotionPred_SamplingWTACGF_Pytorch/tree/2be4f8aaaebb9ec80b29d4ff86146010a0192573
import torch from torch import nn class Model(nn.Module): def __init__(self, dim_input, dim_output, num_components): super().__init__() self.dim_input = dim_input self.dim_output = dim_output self.M = num_components self.layer_mapping = nn.Linear(dim_input, (2 * dim_output...
EncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class SPA(nn.Module): """ Selective parallel attention """ def __init__(self, n_head: 'int'=8, d_v: 'int'=64): super().__init__() self.gap = nn.AdaptiveAvgPool1d(1) self.sk = nn.Linear(d_v, n_head * d_v) self.s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WOMMOW/AIT
EncoderLayer
false
1,229
[ "MIT" ]
0
305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5
https://github.com/WOMMOW/AIT/tree/305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5
import torch import torch.nn as nn import torch.nn.functional as F class SPA(nn.Module): """ Selective parallel attention """ def __init__(self, n_head: 'int'=8, d_v: 'int'=64): super().__init__() self.gap = nn.AdaptiveAvgPool1d(1) self.sk = nn.Linear(d_v, n_head * d_v) self.s...
Mean
# 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 Mean(nn.Module): def __init__(self, dim, keep_dim=False): super(Mean, self).__init__() self.dim = dim self.keep_dim = keep_dim def forward(self, input): return input.mean(self.dim, self.keep_dim) def get_inputs(): return [torch.r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
WillyChen123/CDFNet
Mean
false
1,230
[ "MIT" ]
0
12d6b288aa2a8301683395a75bd44a7be44b7f2a
https://github.com/WillyChen123/CDFNet/tree/12d6b288aa2a8301683395a75bd44a7be44b7f2a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim, keep_dim=False): super().__init__() self.dim = dim self.keep_dim = keep_dim def forward(self, input): return input.mean(self.dim, self.keep_dim) def get_inputs(): return [torch.rand([4, 4...
CLeakyReLU
# 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 CLeakyReLU(nn.LeakyReLU): def forward(self, xr, xi): return F.leaky_relu(xr, self.negative_slope, self.inplace ), F.leaky_relu(xi, self.negative_slope, self.inplace) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
X-CCS/TensorFlowTTS
CLeakyReLU
false
1,231
[ "Apache-2.0" ]
0
157fab4cbcf11a68ff62f6ec364af43447247c76
https://github.com/X-CCS/TensorFlowTTS/tree/157fab4cbcf11a68ff62f6ec364af43447247c76
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.LeakyReLU): def forward(self, xr, xi): return F.leaky_relu(xr, self.negative_slope, self.inplace ), F.leaky_relu(xi, self.negative_slope, self.inplace) def get_inputs(): return [torch.rand([4, 4, 4, 4]), t...
KL_Triplet_Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class KL_Triplet_Loss(nn.Module): def __init__(self, symmetric=True): """ :param symmetric: if symmetric, we will use JS Divergence, if not KL Divergence will be used. """ super().__init__() self.symmetric = symmetric self.engine ...
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...
WorksApplications/omni_torch
KL_Triplet_Loss
false
1,232
[ "Apache-2.0" ]
0
10b689d794c8f485e38c765303ef018da17bc641
https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, symmetric=True): """ :param symmetric: if symmetric, we will use JS Divergence, if not KL Divergence will be used. """ super().__init__() self.symmetric = symmetric self.engine = nn.KLDiv...
DecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class SPA(nn.Module): """ Selective parallel attention """ def __init__(self, n_head: 'int'=8, d_v: 'int'=64): super().__init__() self.gap = nn.AdaptiveAvgPool1d(1) self.sk = nn.Linear(d_v, n_head * d_v) self.s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WOMMOW/AIT
DecoderLayer
false
1,233
[ "MIT" ]
0
305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5
https://github.com/WOMMOW/AIT/tree/305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5
import torch import torch.nn as nn import torch.nn.functional as F class SPA(nn.Module): """ Selective parallel attention """ def __init__(self, n_head: 'int'=8, d_v: 'int'=64): super().__init__() self.gap = nn.AdaptiveAvgPool1d(1) self.sk = nn.Linear(d_v, n_head * d_v) self.s...
DocumentTopicDecoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.multiprocessing from torch import nn import torch.utils.data class DocumentTopicDecoder(nn.Module): def __init__(self, dim_h, num_topics): super(DocumentTopicDecoder, self).__init__() self.decoder = nn.GRUCell(input_size=dim_h, hidden_size=dim_h) self.out_linear ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
WuDiDaBinGe/TAKG
DocumentTopicDecoder
false
1,234
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch import torch.multiprocessing from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, dim_h, num_topics): super().__init__() self.decoder = nn.GRUCell(input_size=dim_h, hidden_size=dim_h) self.out_linear = nn.Linear(dim_h, num_topics) se...
LinearMultiplicationComposition
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.parallel import torch.utils.data import torch.distributions asse...
XeniaOhmer/SystematicRepresentations
LinearMultiplicationComposition
false
1,235
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
LinearComposition
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.parallel import torch.utils.data import torch.distributions asse...
XeniaOhmer/SystematicRepresentations
LinearComposition
false
1,236
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
LinearAdditionComposition
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.parallel import torch.utils.data import torch.distributions asse...
XeniaOhmer/SystematicRepresentations
LinearAdditionComposition
false
1,237
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
SingleGate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.multiprocessing from torch import nn import torch.utils.data class SingleGate(nn.Module): def __init__(self, vector_dim, topic_dim): super().__init__() assert vector_dim == topic_dim self.fusion_linear = nn.Linear(vector_dim + topic_dim, 1) self.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 import torch.multiprocessing from torch import nn import torch.utils.data assert...
WuDiDaBinGe/TAKG
SingleGate
false
1,238
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch import torch.multiprocessing from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, vector_dim, topic_dim): super().__init__() assert vector_dim == topic_dim self.fusion_linear = nn.Linear(vector_dim + topic_dim, 1) self.sigmoid = nn.S...
AvgReadout
# 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 AvgReadout(nn.Module): """ Considering the efficiency of the method, we simply employ average pooling, computing the average of the set of embedding matrices .. math:: \\begin{equation} \\mathbf{H}=\\mathcal{Q}\\left(\\left\\{\\mathbf{H}^{(r)} \\mid ...
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...
Xinstein3033/OpenHGNN
AvgReadout
false
1,239
[ "Apache-2.0" ]
0
a9ca499834523419ecdaaa09e4b42f640486f262
https://github.com/Xinstein3033/OpenHGNN/tree/a9ca499834523419ecdaaa09e4b42f640486f262
import torch import torch.nn as nn class Model(nn.Module): """ Considering the efficiency of the method, we simply employ average pooling, computing the average of the set of embedding matrices .. math:: \\begin{equation} \\mathbf{H}=\\mathcal{Q}\\left(\\left\\{\\mathbf{H}^{(r)} \\mid r \\i...
F_fully_connected
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 F_fully_connected(nn.Module): """Fully connected tranformation, not reversible, but used below.""" def __init__(self, size_in, size, internal_size=None, dropout=0.0): super(F_fully_connected, self).__init__() if not internal_size: internal_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Xenovortex/INN_Embedding_Classification
F_fully_connected
false
1,240
[ "MIT" ]
0
df31ec3dcf70780cae5140a69ffafdd64f218e5f
https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f
import torch import torch.nn as nn class Model(nn.Module): """Fully connected tranformation, not reversible, but used below.""" def __init__(self, size_in, size, internal_size=None, dropout=0.0): super().__init__() if not internal_size: internal_size = 2 * size self.d1 = n...