entry_point
stringlengths
1
65
original_triton_python_code
stringlengths
208
619k
optimised_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
InverseDepthSmoothnessLoss
import torch import torch.nn as nn def _gradient_x(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :, :-1] - img[:, :, :, 1:] def _gradient_y(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :-1, :] - img[:, :, 1:...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
JoanFM/kornia
InverseDepthSmoothnessLoss
false
11,551
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
RgbaToBgr
import torch import torch.nn as nn def bgr_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert a BGR image to RGB. Args: image: BGR Image to be converted to BGR of shape :math:`(*,3,H,W)`. Returns: RGB version of the image with shape of shape :math:`(*,3,H,W)`. Example: ...
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...
JoanFM/kornia
RgbaToBgr
false
11,552
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
Encoder
import torch import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): def __init__(self, out_dim=64): super(Encoder, self).__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1) self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
JanSoltysik/SimCLR
Encoder
false
11,553
[ "MIT" ]
0
34ea6d17a630382b65a00aa445d82876754ee679
https://github.com/JanSoltysik/SimCLR/tree/34ea6d17a630382b65a00aa445d82876754ee679
InvDepth
import torch import torch.nn as nn class InvDepth(nn.Module): def __init__(self, height, width, min_depth=0.5, max_depth=25.0): super(InvDepth, self).__init__() self._min_range = 1.0 / max_depth self._max_range = 1.0 / min_depth self.w = nn.Parameter(self._init_weights(height, wid...
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...
JoanFM/kornia
InvDepth
false
11,554
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
PoseNetFeat
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.nn.functional as F class PoseNetFeat(nn.Module): def __init__(self, num_points): super(PoseNetFeat, self).__init__() self.conv1 = torch.nn.Conv1d(3, 64, 1) self.conv2 = torch.nn.Conv1d(64, 128...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
JiazeWang/6-PACK
PoseNetFeat
false
11,555
[ "MIT" ]
0
bce910213cfbf89b4ed7b59ff6c70a59a7c19b99
https://github.com/JiazeWang/6-PACK/tree/bce910213cfbf89b4ed7b59ff6c70a59a7c19b99
Hflip
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-1]) class Hflip(nn.Module): """Horizontally flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
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...
JoanFM/kornia
Hflip
false
11,556
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
BinaryFocalLossWithLogits
import torch import torch.nn as nn def binary_focal_loss_with_logits(input: 'torch.Tensor', target: 'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction: 'str'='none', eps: 'float'=1e-08) ->torch.Tensor: """Function that computes Binary Focal loss. .. math:: \\text{FL}(p_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 torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
JoanFM/kornia
BinaryFocalLossWithLogits
false
11,557
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
TotalVariation
import torch import torch.nn as nn def total_variation(img: 'torch.Tensor') ->torch.Tensor: """Function that computes Total Variation according to [1]. Args: img (torch.Tensor): the input image with shape :math:`(N, C, H, W)` or :math:`(C, H, W)`. Return: torch.Tensor: a scalar with the ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
JoanFM/kornia
TotalVariation
false
11,558
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
Vflip
import torch import torch.nn as nn def vflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2]) class Vflip(nn.Module): """Vertically flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
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...
JoanFM/kornia
Vflip
false
11,559
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
LinearSum
import torch import torch.nn as nn import torch.nn.functional as F class LinearSum(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(LinearSum, s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
JoannaLXY/block.bootstrap.pytorch
LinearSum
false
11,560
[ "BSD-3-Clause" ]
0
42c3e7616b704e05c6ff2376ff68b5b18044fe77
https://github.com/JoannaLXY/block.bootstrap.pytorch/tree/42c3e7616b704e05c6ff2376ff68b5b18044fe77
MFB
import torch import torch.nn as nn import torch.nn.functional as F class MFB(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_norm=0.0, dropout_output=0.0): super(MFB, sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
JoannaLXY/block.bootstrap.pytorch
MFB
false
11,561
[ "BSD-3-Clause" ]
0
42c3e7616b704e05c6ff2376ff68b5b18044fe77
https://github.com/JoannaLXY/block.bootstrap.pytorch/tree/42c3e7616b704e05c6ff2376ff68b5b18044fe77
MFH
import torch import torch.nn as nn import torch.nn.functional as F class MFH(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(MFH, 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_...
JoannaLXY/block.bootstrap.pytorch
MFH
false
11,562
[ "BSD-3-Clause" ]
0
42c3e7616b704e05c6ff2376ff68b5b18044fe77
https://github.com/JoannaLXY/block.bootstrap.pytorch/tree/42c3e7616b704e05c6ff2376ff68b5b18044fe77
BinaryExpAbs
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import abc import inspect import warnings import torch.nn as nn import to...
Johnsonms/NNI_master
BinaryExpAbs
false
11,563
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BinaryMul
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typ...
Johnsonms/NNI_master
BinaryMul
false
11,564
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
NetVLAD
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from sklearn.neighbors import NearestNeighbors class NetVLAD(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True, vladv2=False): """ Args:...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AlessandroRigoli/project_vg
NetVLAD
false
11,565
[ "MIT" ]
0
cb1323bee60cdb4108fe0aab68791321c7974832
https://github.com/AlessandroRigoli/project_vg/tree/cb1323bee60cdb4108fe0aab68791321c7974832
Block
import torch from torch import nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, the original name is ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JetRunner/PaSST-EE
Block
false
11,566
[ "Apache-2.0" ]
0
2ff8f4fd0e9c1868856d08147e6e3cf1c1bed68c
https://github.com/JetRunner/PaSST-EE/tree/2ff8f4fd0e9c1868856d08147e6e3cf1c1bed68c
BinarySigmoid
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typ...
Johnsonms/NNI_master
BinarySigmoid
false
11,567
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
MLB
import torch import torch.nn as nn import torch.nn.functional as F class MLB(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(MLB, self).__init_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
JoannaLXY/block.bootstrap.pytorch
MLB
false
11,568
[ "BSD-3-Clause" ]
0
42c3e7616b704e05c6ff2376ff68b5b18044fe77
https://github.com/JoannaLXY/block.bootstrap.pytorch/tree/42c3e7616b704e05c6ff2376ff68b5b18044fe77
PatchEmbed
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class PatchEmbed(nn.Module): """ PatchEmbed. """ def __init__(self, dim_in=3, dim_out=768, kernel=(1, 16, 16), stride=(1, 4, 4), padding=(1, 7, 7), conv_2d=False): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from itertools import chain as chain import torch.utils.data import torch.nn as ...
JerryYLi/SlowFast
PatchEmbed
false
11,569
[ "Apache-2.0" ]
0
70bbd8d917c49f86b41fdd7c2de5c1231e6d950c
https://github.com/JerryYLi/SlowFast/tree/70bbd8d917c49f86b41fdd7c2de5c1231e6d950c
BinaryDivide
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typ...
Johnsonms/NNI_master
BinaryDivide
false
11,570
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BinaryMinus
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typ...
Johnsonms/NNI_master
BinaryMinus
false
11,571
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BinaryMin
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel ...
Johnsonms/NNI_master
BinaryMin
false
11,572
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BinaryParamAdd
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typ...
Johnsonms/NNI_master
BinaryParamAdd
false
11,573
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BinaryMax
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel ...
Johnsonms/NNI_master
BinaryMax
false
11,574
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
DistillKL
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class DistillKL(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self, T): super(DistillKL, self).__init__() 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 libdevice, math as tl_math import torc...
Johnsonms/NNI_master
DistillKL
false
11,575
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
PatchSequential
import math import torch import warnings from typing import Dict from typing import Optional from typing import Tuple import torch.nn as nn import torch.nn.functional as F from typing import cast from typing import List from typing import Union from torch.distributions import Bernoulli from itertools import zip_longest...
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 math import warnings from typing import Dict from typing import Optional from typing import Tuple import torch.nn as nn import torch....
JoanFM/kornia
PatchSequential
false
11,576
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
LinearCombine
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class LinearCombine(nn.Module): def __init__(self, layers_num, trainable=True, input_aware=False, word_level=False): super(LinearCombine, sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.nn.parallel import torch.optim import ...
Johnsonms/NNI_master
LinearCombine
false
11,577
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
ResidualConvUnit
import torch import torch.fft import torch.nn as nn import torch.utils.cpp_extension class ResidualConvUnit(nn.Module): def __init__(self, cin, activation, bn): super().__init__() self.conv = nn.Conv2d(cin, cin, kernel_size=3, stride=1, padding=1, bias=True) self.skip_add = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.fft import torch.nn as nn import torch.utils.cpp_extension assert_s...
CeciLyu/projected_gan
ResidualConvUnit
false
11,578
[ "MIT" ]
0
5e86ee0c88d47164c30ede37448e7ba7f010fa7b
https://github.com/CeciLyu/projected_gan/tree/5e86ee0c88d47164c30ede37448e7ba7f010fa7b
Pooling
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class ReLUConvBN(nn.Module): """ Parameters --- C_in: int the number of input channels C_out: int the number of output channels stride: int stride...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * assert_size_stride = torch._C...
Johnsonms/NNI_master
Pooling
false
11,579
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
Interpolate
import torch import torch.fft import torch.nn as nn import torch.utils.cpp_extension class Interpolate(nn.Module): """Interpolation module.""" def __init__(self, size, mode='bilinear', align_corners=False): """Init. Args: scale_factor (float): scaling mode (str): inter...
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.fft import torch.nn as nn import torch.utils.cpp_extension assert_size_strid...
CeciLyu/projected_gan
Interpolate
false
11,580
[ "MIT" ]
0
5e86ee0c88d47164c30ede37448e7ba7f010fa7b
https://github.com/CeciLyu/projected_gan/tree/5e86ee0c88d47164c30ede37448e7ba7f010fa7b
Mask
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class Mask(nn.Module): def forward(self, seq, mask): seq_mask = torch.unsqueeze(mask, 2) seq_mask = torch.transpose(seq_mask.repeat(1, 1, seq.size()[1]), 1, 2) retur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * assert_size_stride = torch._C...
Johnsonms/NNI_master
Mask
false
11,581
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
MLP
import torch import torch.nn as nn class FC(nn.Module): def __init__(self, in_size, out_size, dropout_r=0.0, use_relu=True): super(FC, self).__init__() self.dropout_r = dropout_r self.use_relu = use_relu self.linear = nn.Linear(in_size, out_size) if use_relu: s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
JoonseoKang/mcan-cap
MLP
false
11,582
[ "Apache-2.0" ]
0
788e21fc1bc712018166aa44cc3298264f493f3b
https://github.com/JoonseoKang/mcan-cap/tree/788e21fc1bc712018166aa44cc3298264f493f3b
InformedSender
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class InformedSender(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super(InformedSender, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IA3005/NLP_ens
InformedSender
false
11,583
[ "MIT" ]
0
794ebbff46d5e6d5476f29b577b40bbb52991246
https://github.com/IA3005/NLP_ens/tree/794ebbff46d5e6d5476f29b577b40bbb52991246
BinaryExpSquare
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import abc import inspect import warnings import torch.nn as nn import to...
Johnsonms/NNI_master
BinaryExpSquare
false
11,584
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
Hsigmoid
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class Hsigmoid(nn.Module): """Hsigmoid activation function.""" def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data...
Johnsonms/NNI_master
Hsigmoid
false
11,585
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
SymmSoftplus
import torch from torch.utils.data import Dataset as Dataset import torch.utils.data def symm_softplus(x, softplus_=torch.nn.functional.softplus): return softplus_(x) - 0.5 * x class SymmSoftplus(torch.nn.Module): def forward(self, x): return symm_softplus(x) 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch.utils.data import Dataset as Dataset import torch.u...
JunLi-Galios/CP-Flow
SymmSoftplus
false
11,586
[ "MIT" ]
0
69272636c8c644ce3c96bbc4d610591756b8e3ff
https://github.com/JunLi-Galios/CP-Flow/tree/69272636c8c644ce3c96bbc4d610591756b8e3ff
InteractiveKLLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class InteractiveKLLoss(nn.Module): def __init__(self, temperature): super().__init__() self.temperature = temperature self.kl_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 libdevice, math as tl_math import torc...
Johnsonms/NNI_master
InteractiveKLLoss
false
11,587
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
GlobalAvgPool1d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from abc import abstractmethod from torch.nn import functional from typing import * class AvgPool(nn.Module): """ AvgPool Module. """ def __init__(self): super().__init__() @abstractmet...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from abc import abstractmethod from typing import ...
Johnsonms/NNI_master
GlobalAvgPool1d
false
11,588
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BinaryAdd
import abc import inspect import torch import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import Any from typing import * def get_module_name(cls_or_func): module_name = cls_or_func.__module__ if module_name == '__main__': for frm in i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import abc import inspect import warnings import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typ...
Johnsonms/NNI_master
BinaryAdd
false
11,589
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
BackboneModel1
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class BackboneModel1(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 1, 1, 1) def forward(self, x): return self.conv1(x) def get_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.u...
Johnsonms/NNI_master
BackboneModel1
false
11,590
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data from typing import * def attention(query, key, value, mask=None, dropout=None): d_k = query.size(-1) logits = torch.matmul(query, key.transpose(-2, -1)) / math.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 from torch._inductor.runtime....
Johnsonms/NNI_master
MultiHeadAttention
false
11,591
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
PosLinear2
import torch from torch import Tensor from torch.utils.data import Dataset as Dataset import torch.nn as nn import torch.utils.data class PosLinear2(torch.nn.Linear): def forward(self, x: 'Tensor') ->Tensor: return nn.functional.linear(x, torch.nn.functional.softmax(self. weight, 1), self.bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JunLi-Galios/CP-Flow
PosLinear2
false
11,592
[ "MIT" ]
0
69272636c8c644ce3c96bbc4d610591756b8e3ff
https://github.com/JunLi-Galios/CP-Flow/tree/69272636c8c644ce3c96bbc4d610591756b8e3ff
ActorCritic
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class ActorCritic(nn.Module): def __init__(self, num_states, num_actions, hidden_size): super(ActorCritic, self).__init__() self.num_actions ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Johnsonms/NNI_master
ActorCritic
false
11,593
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
MSELoss
import torch import torch.nn as nn class MSELoss(nn.Module): """ Mean-squared error loss """ def __init__(self, reduction='mean', eps=1e-08): super().__init__() if reduction not in ('mean', 'sum'): raise ValueError( '`reduction` not recognized. must be "mean" or "s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
KAGRA-TW-ML/deepclean-prod
MSELoss
false
11,594
[ "MIT" ]
0
9fb834cb4027fd3b377bc0e763c237235c98eabd
https://github.com/KAGRA-TW-ML/deepclean-prod/tree/9fb834cb4027fd3b377bc0e763c237235c98eabd
PosLinear
import torch from torch import Tensor from torch.utils.data import Dataset as Dataset import torch.nn as nn import torch.utils.data class PosLinear(torch.nn.Linear): def forward(self, x: 'Tensor') ->Tensor: gain = 1 / x.size(1) return nn.functional.linear(x, torch.nn.functional.softplus(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, math as tl_math fr...
JunLi-Galios/CP-Flow
PosLinear
false
11,595
[ "MIT" ]
0
69272636c8c644ce3c96bbc4d610591756b8e3ff
https://github.com/JunLi-Galios/CP-Flow/tree/69272636c8c644ce3c96bbc4d610591756b8e3ff
PFLDLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class PFLDLoss(nn.Module): """Weighted loss of L2 distance with the pose angle for PFLD.""" def __init__(self): super(PFLDLoss, self).__init__() def forward(self, landmark_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.nn.parallel import torch.optim import ...
Johnsonms/NNI_master
PFLDLoss
false
11,596
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
NoiseInjection
import torch from torch import nn class NoiseInjection(nn.Module): def __init__(self, channel): super().__init__() self.weight = nn.Parameter(torch.zeros(1, channel, 1, 1)) def forward(self, image, noise): return image + self.weight * noise def get_inputs(): return [torch.rand(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
KUMartin77/AAA738_StyleGAN_pytorch
NoiseInjection
false
11,597
[ "BSD-2-Clause" ]
0
ed0689102c922d336f53e374e8be2ab532a84ccd
https://github.com/KUMartin77/AAA738_StyleGAN_pytorch/tree/ed0689102c922d336f53e374e8be2ab532a84ccd
wide_basic
import torch import torch.nn as nn def get_norm(n_filters, norm): if norm is None: return Identity() elif norm == 'batch': return nn.BatchNorm2d(n_filters, momentum=0.9) elif norm == 'instance': return nn.InstanceNorm2d(n_filters, affine=True) elif norm == 'layer': retu...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
JunLi-Galios/JEM
wide_basic
false
11,598
[ "Apache-2.0" ]
0
dd4d33f64269d3999458f129ac83a3043ad7e63f
https://github.com/JunLi-Galios/JEM/tree/dd4d33f64269d3999458f129ac83a3043ad7e63f
Softplus
import torch import numpy as np from torch.utils.data import Dataset as Dataset import torch.nn as nn import torch.utils.data def activation_shifting(activation): def shifted_activation(x): return activation(x) - activation(torch.zeros_like(x)) return shifted_activation def cauchy_softplus(x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np from torch.utils.data import Dataset as Dat...
JunLi-Galios/CP-Flow
Softplus
false
11,599
[ "MIT" ]
0
69272636c8c644ce3c96bbc4d610591756b8e3ff
https://github.com/JunLi-Galios/CP-Flow/tree/69272636c8c644ce3c96bbc4d610591756b8e3ff
PosConv2d
import torch from torch import Tensor from torch.utils.data import Dataset as Dataset import torch.nn.init as init import torch.utils.data class PosConv2d(torch.nn.Conv2d): def reset_parameters(self) ->None: super().reset_parameters() self.fan_in, _ = init._calculate_fan_in_and_fan_out(self.weigh...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
JunLi-Galios/CP-Flow
PosConv2d
false
11,600
[ "MIT" ]
0
69272636c8c644ce3c96bbc4d610591756b8e3ff
https://github.com/JunLi-Galios/CP-Flow/tree/69272636c8c644ce3c96bbc4d610591756b8e3ff
EqualConv2d
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
KUMartin77/AAA738_StyleGAN_pytorch
EqualConv2d
false
11,601
[ "BSD-2-Clause" ]
0
ed0689102c922d336f53e374e8be2ab532a84ccd
https://github.com/KUMartin77/AAA738_StyleGAN_pytorch/tree/ed0689102c922d336f53e374e8be2ab532a84ccd
SoftCrossEntropyLoss
import torch import torch.utils.data class SoftCrossEntropyLoss(torch.nn.Module): """SoftCrossEntropyLoss (useful for label smoothing and mixup). Identical to torch.nn.CrossEntropyLoss if used with one-hot labels.""" def __init__(self): super(SoftCrossEntropyLoss, self).__init__() def forwar...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
KateHaeun/pycls
SoftCrossEntropyLoss
false
11,602
[ "MIT" ]
0
f3d87a36cb0a8adead31c7ad98f43facf7fe4c47
https://github.com/KateHaeun/pycls/tree/f3d87a36cb0a8adead31c7ad98f43facf7fe4c47
FusedUpsample
import torch from torch import nn from torch.nn import functional as F from math import sqrt class FusedUpsample(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, padding=0): super().__init__() weight = torch.randn(in_channel, out_channel, kernel_size, kernel_size) bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
KUMartin77/AAA738_StyleGAN_pytorch
FusedUpsample
false
11,603
[ "BSD-2-Clause" ]
0
ed0689102c922d336f53e374e8be2ab532a84ccd
https://github.com/KUMartin77/AAA738_StyleGAN_pytorch/tree/ed0689102c922d336f53e374e8be2ab532a84ccd
AdaptiveInstanceNorm
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
KUMartin77/AAA738_StyleGAN_pytorch
AdaptiveInstanceNorm
false
11,604
[ "BSD-2-Clause" ]
0
ed0689102c922d336f53e374e8be2ab532a84ccd
https://github.com/KUMartin77/AAA738_StyleGAN_pytorch/tree/ed0689102c922d336f53e374e8be2ab532a84ccd
ResHead
from torch.nn import Module import torch import torch.utils.data import torch.nn as nn def gap2d(_w_in): """Helper for building a gap2d layer.""" return nn.AdaptiveAvgPool2d((1, 1)) def gap2d_cx(cx, _w_in): """Accumulates complexity of gap2d into cx = (h, w, flops, params, acts).""" flops, params, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import torch.utils.data import torch.nn as nn assert...
KateHaeun/pycls
ResHead
false
11,605
[ "MIT" ]
0
f3d87a36cb0a8adead31c7ad98f43facf7fe4c47
https://github.com/KateHaeun/pycls/tree/f3d87a36cb0a8adead31c7ad98f43facf7fe4c47
EqualLinear
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
KUMartin77/AAA738_StyleGAN_pytorch
EqualLinear
false
11,606
[ "BSD-2-Clause" ]
0
ed0689102c922d336f53e374e8be2ab532a84ccd
https://github.com/KUMartin77/AAA738_StyleGAN_pytorch/tree/ed0689102c922d336f53e374e8be2ab532a84ccd
TransformerEncoderLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerEncoderLayer(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IA3005/NLP_ens
TransformerEncoderLayer
false
11,607
[ "MIT" ]
0
794ebbff46d5e6d5476f29b577b40bbb52991246
https://github.com/IA3005/NLP_ens/tree/794ebbff46d5e6d5476f29b577b40bbb52991246
ConvInRelu
import torch import numpy as np from torch import nn import torch.onnx class ConvInRelu(nn.Module): def __init__(self, channels_in, channels_out, kernel_size, stride=1): super(ConvInRelu, self).__init__() self.n_params = 0 self.channels = channels_out self.reflection_pad = nn.Refl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JuanFuriaz/donkey_share
ConvInRelu
false
11,608
[ "MIT" ]
0
caad831ca21094f05f9084f881ca3bbfa4168e4c
https://github.com/JuanFuriaz/donkey_share/tree/caad831ca21094f05f9084f881ca3bbfa4168e4c
FCNet
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class FCNet(nn.Module): def __init__(self, input_size, output_size): super().__init__() self.l1 = nn.Linear(input_size, 5) self.relu = nn.ReLU() self.l2 = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Johnsonms/NNI_master
FCNet
false
11,609
[ "MIT" ]
0
e5e5c7aed89cf3189cffe1056464833c15eb54ff
https://github.com/Johnsonms/NNI_master/tree/e5e5c7aed89cf3189cffe1056464833c15eb54ff
Classifier
import torch import torch.nn as nn class Classifier(nn.Module): def __init__(self, n_hid, n_out): super(Classifier, self).__init__() self.n_hid = n_hid self.n_out = n_out self.linear = nn.Linear(n_hid, n_out) def forward(self, x): tx = self.linear(x) return to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KathleenQ/context-aware-doc-analysis
Classifier
false
11,610
[ "MIT" ]
0
93af994b2dee09f5fe6bfcc2e76e47e74708d3fe
https://github.com/KathleenQ/context-aware-doc-analysis/tree/93af994b2dee09f5fe6bfcc2e76e47e74708d3fe
AdaptiveCatAvgMaxPool2d
import torch import torch.nn as nn import torch.utils.data import torchvision.transforms.functional as F import torch.nn.functional as F import torch.nn.parallel from torch import optim as optim def adaptive_catavgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_m...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torchvision.transforms.functional as...
DifferentSC/pytorch-image-models
AdaptiveCatAvgMaxPool2d
false
11,611
[ "Apache-2.0" ]
0
ccfb5751abc70d80add4f197464190c4a2637c6c
https://github.com/DifferentSC/pytorch-image-models/tree/ccfb5751abc70d80add4f197464190c4a2637c6c
GlobalAttention
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional as F def sequence_mask(lengths, max_len=None): """ Creates a boolean mask from sequence lengths. """ batch_size = lengths.numel() max_len = max_len or lengths.max() return torch.arange(0, max_le...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Katarina11/PreSumm
GlobalAttention
false
11,612
[ "MIT" ]
0
616e72f038d512e9e9112af375d66a0b2e3db6cd
https://github.com/Katarina11/PreSumm/tree/616e72f038d512e9e9112af375d66a0b2e3db6cd
UnbalancedLoss
import torch import torch.nn as nn import torch.utils.data class UnbalancedLoss(nn.Module): NUM_LABELS = 2 def __init__(self): super().__init__() self.crit = nn.BCEWithLogitsLoss() def forward(self, logits, label): return self.crit(logits, label) def get_inputs(): return [t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Kwonyoung-Ryu/DeepGlobalRegistration
UnbalancedLoss
false
11,613
[ "MIT" ]
0
0045118d96182047f4c09c4c4fe2a1b2b527cc5f
https://github.com/Kwonyoung-Ryu/DeepGlobalRegistration/tree/0045118d96182047f4c09c4c4fe2a1b2b527cc5f
Network
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data class Network(nn.Module): def __init__(self): super(Network, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Karansutradhar/Convolution-Neural-Network-Objection-Recognition-Dogs-Cats
Network
false
11,614
[ "MIT" ]
0
85dfab2e8758a5cf49368938b03720f197a06b18
https://github.com/Karansutradhar/Convolution-Neural-Network-Objection-Recognition-Dogs-Cats/tree/85dfab2e8758a5cf49368938b03720f197a06b18
ConformerFeedForward
import torch from torch import nn import torch.utils.data import torch.optim class Swish(nn.Module): """ Swish activation function introduced in 'https://arxiv.org/abs/1710.05941' """ def forward(self, x): return x * torch.sigmoid(x) class ConformerFeedForward(nn.Module): """ feed-f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.optim assert_size_stri...
JINHXu/NeMo
ConformerFeedForward
false
11,615
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
AngleSimpleLinear
import torch import torch.nn.functional as F import torch.nn as nn from torch.nn import Parameter import torch.utils.data class AngleSimpleLinear(nn.Module): """Computes cos of angles between input vectors and weights vectors""" def __init__(self, in_features, out_features): super(AngleSimpleLinear, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KhurramPirov/Twins-recognition
AngleSimpleLinear
false
11,616
[ "MIT" ]
0
f99ba1128afb3674a49db6a4b19afd5108c3fdf9
https://github.com/KhurramPirov/Twins-recognition/tree/f99ba1128afb3674a49db6a4b19afd5108c3fdf9
ScalarMix
import torch import torch.nn as nn class ScalarMix(nn.Module): """ Computes a parameterised scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)` where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters. Args: n_layers (...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
KoichiYasuoka/SuPar
ScalarMix
false
11,617
[ "MIT" ]
0
9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
https://github.com/KoichiYasuoka/SuPar/tree/9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
ConvGLU
import torch from torch import nn import torch.utils.data import torch.optim def str2act(txt): """Translates text to neural network activation""" return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn. Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu': nn.SELU()}[txt. lower()] class C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.optim assert_size_stri...
JINHXu/NeMo
ConvGLU
false
11,618
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
AdaptiveAvgMaxPool2d
import torch import torch.nn as nn import torch.utils.data import torchvision.transforms.functional as F import torch.nn.functional as F import torch.nn.parallel from torch import optim as optim def adaptive_avgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torchvision.transforms.functional as...
DifferentSC/pytorch-image-models
AdaptiveAvgMaxPool2d
false
11,619
[ "Apache-2.0" ]
0
ccfb5751abc70d80add4f197464190c4a2637c6c
https://github.com/DifferentSC/pytorch-image-models/tree/ccfb5751abc70d80add4f197464190c4a2637c6c
DuelingQNetwork
import torch import torch.nn.functional as F import torch.nn as nn class DuelingQNetwork(nn.Module): """Dueling Q-network (https://arxiv.org/abs/1511.06581)""" def __init__(self, state_size, action_size, hidsize1=128, hidsize2=128): super(DuelingQNetwork, self).__init__() self.fc1_val = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
KantiCodes/flatland-rl
DuelingQNetwork
false
11,620
[ "MIT" ]
0
fcc10e83d2548470ebaa5540b967db0940eb30dd
https://github.com/KantiCodes/flatland-rl/tree/fcc10e83d2548470ebaa5540b967db0940eb30dd
AsymmetricLossOptimized
import torch import torch.nn as nn class AsymmetricLossOptimized(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations https://github.com/Alibaba-MIIL/ASL/blob/main/src/loss_functions/losses.py """ def __init__(self, gamma_neg=4, gamm...
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...
LanXiangExcavator/python-classifier-2021
AsymmetricLossOptimized
false
11,621
[ "BSD-2-Clause" ]
0
851079e76db8e5070132d1120dba941967e1245b
https://github.com/LanXiangExcavator/python-classifier-2021/tree/851079e76db8e5070132d1120dba941967e1245b
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, input, target, logits=True): if logits: input = nn.Sigmoid()(input) N = target.size(0) smooth = 1 input_flat = input.view(N...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
LanXiangExcavator/python-classifier-2021
DiceLoss
false
11,622
[ "BSD-2-Clause" ]
0
851079e76db8e5070132d1120dba941967e1245b
https://github.com/LanXiangExcavator/python-classifier-2021/tree/851079e76db8e5070132d1120dba941967e1245b
MultiLayerPerceptron
import torch import torch.utils.data import torch.optim class MultiLayerPerceptron(torch.nn.Module): """ A simple MLP that can either be used independently or put on top of pretrained models (such as BERT) and act as a classifier. Args: hidden_size (int): the size of each layer num_cla...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JINHXu/NeMo
MultiLayerPerceptron
false
11,623
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
TransformerDecoderLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerDecoderLayer(nn.Module): """Decoder layer block. Follows an implementation in fairseq with args.decoder_normalize_before=True, i.e. order of operation...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IA3005/NLP_ens
TransformerDecoderLayer
false
11,624
[ "MIT" ]
0
794ebbff46d5e6d5476f29b577b40bbb52991246
https://github.com/IA3005/NLP_ens/tree/794ebbff46d5e6d5476f29b577b40bbb52991246
FixedSubnetConv
import math import torch import torch.multiprocessing import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class FixedSubnetConv(nn.Conv2d): def __init__(self, *args, **kwargs): super().__init__(*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 math import torch.multiprocessing import torch.nn as nn import torch.nn.p...
Lasitha-93/CRTIDL_2021
FixedSubnetConv
false
11,625
[ "Apache-2.0" ]
0
d6bc6fbe08161c3574511623230a7aa4895f65e1
https://github.com/Lasitha-93/CRTIDL_2021/tree/d6bc6fbe08161c3574511623230a7aa4895f65e1
AttentionBlock
import math import torch from torch.nn import functional as F from torch import nn import torch.utils.data import torch.optim def convert_pad_shape(pad_shape): """ Used to get arguments for F.pad """ l = pad_shape[::-1] pad_shape = [item for sublist in l for item in sublist] return pad_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....
JINHXu/NeMo
AttentionBlock
false
11,626
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
LayerNorm
import torch from torch import nn from torch.nn import LayerNorm import torch.utils.data import torch.optim class LayerNorm(nn.Module): def __init__(self, channels, eps=0.0001): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channel...
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.utils.data import torch.optim assert_size_str...
JINHXu/NeMo
LayerNorm
false
11,627
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
FusedDownsample
import torch from torch import nn from torch.nn import functional as F from math import sqrt class FusedDownsample(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, padding=0): super().__init__() weight = torch.randn(out_channel, in_channel, kernel_size, kernel_size) bi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
KUMartin77/AAA738_StyleGAN_pytorch
FusedDownsample
false
11,628
[ "BSD-2-Clause" ]
0
ed0689102c922d336f53e374e8be2ab532a84ccd
https://github.com/KUMartin77/AAA738_StyleGAN_pytorch/tree/ed0689102c922d336f53e374e8be2ab532a84ccd
Biaffine
import torch import torch.nn as nn class Biaffine(nn.Module): """ Biaffine layer for first-order scoring. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y)` of the vector pair :math:`(x, y)` is computed as :math:`x^T W y`, in which :math:`x` and :m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
KoichiYasuoka/SuPar
Biaffine
false
11,629
[ "MIT" ]
0
9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
https://github.com/KoichiYasuoka/SuPar/tree/9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
MulticlassDiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, input, target, logits=True): if logits: input = nn.Sigmoid()(input) N = target.size(0) smooth = 1 input_flat = input.view(N...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
LanXiangExcavator/python-classifier-2021
MulticlassDiceLoss
false
11,630
[ "BSD-2-Clause" ]
0
851079e76db8e5070132d1120dba941967e1245b
https://github.com/LanXiangExcavator/python-classifier-2021/tree/851079e76db8e5070132d1120dba941967e1245b
Triaffine
import torch import torch.nn as nn class Triaffine(nn.Module): """ Triaffine layer for second-order scoring. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y, z)` of the vector triple :math:`(x, y, z)` is computed as :math:`x^T z^T W y`. Usually, :...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
KoichiYasuoka/SuPar
Triaffine
false
11,631
[ "MIT" ]
0
9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
https://github.com/KoichiYasuoka/SuPar/tree/9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
InvConvNear
import torch from torch.nn import functional as F from torch import nn import torch.utils.data import torch.optim class InvConvNear(nn.Module): def __init__(self, channels, n_split=4, no_jacobian=False, **kwargs): super().__init__() assert n_split % 2 == 0 self.channels = channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.optim assert_size_stri...
JINHXu/NeMo
InvConvNear
false
11,632
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
TVLoss
import torch from torch import nn import torch.utils.data from torchvision.transforms import * class TVLoss(nn.Module): def __init__(self, tv_loss_weight=1): super(TVLoss, self).__init__() self.tv_loss_weight = tv_loss_weight def forward(self, x): batch_size = x.size()[0] h_x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data from torchvision.transforms import * assert_size_stride = torch._C._dynamo.guards.assert_size_s...
HamsterBiz/iSeeBetter
TVLoss
false
11,633
[ "MIT" ]
0
a71cee61583bdedab1f3b368e2cb7dc5ad969aed
https://github.com/HamsterBiz/iSeeBetter/tree/a71cee61583bdedab1f3b368e2cb7dc5ad969aed
SpaceToDepth
import torch import torch.optim import torch.nn as nn import torch.utils.data class SpaceToDepth(nn.Module): def __init__(self, block_size): super(SpaceToDepth, self).__init__() self.block_size = block_size self.block_size_sq = block_size * block_size def forward(self, 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 import torch.optim import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
LeikvollE/pytorch-superpoint
SpaceToDepth
false
11,634
[ "MIT" ]
0
52144a760e0cc46259e57397a5a55f0585fe6d0b
https://github.com/LeikvollE/pytorch-superpoint/tree/52144a760e0cc46259e57397a5a55f0585fe6d0b
GEGLU
import torch import torch.nn as nn import torch.nn.functional as F class GEGLU(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x, gate = self.proj(x).chunk(2, dim=-1) return x * F.gelu(gate) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Lawliet19189/squad-1
GEGLU
false
11,635
[ "MIT" ]
0
75531054d74e20838d8acff81749f335973b9ae3
https://github.com/Lawliet19189/squad-1/tree/75531054d74e20838d8acff81749f335973b9ae3
ScaleNorm
import torch import torch.nn as nn class ScaleNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.eps = eps self.g = nn.Parameter(torch.ones(1)) def forward(self, x): n = torch.norm(x, dim=-1, keepdim=True).clamp(min=self.eps) return x / n * 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 libdevice import torch.nn as nn assert...
Lawliet19189/squad-1
ScaleNorm
false
11,636
[ "MIT" ]
0
75531054d74e20838d8acff81749f335973b9ae3
https://github.com/Lawliet19189/squad-1/tree/75531054d74e20838d8acff81749f335973b9ae3
MultiHeadAttention
import math import torch from torch import nn import torch.utils.data import torch.optim class MultiHeadAttention(nn.Module): """ Multi-head scaled dot-product attention layer. Args: hidden_size: size of the embeddings in the model, also known as d_model num_attention_heads: number of hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JINHXu/NeMo
MultiHeadAttention
false
11,637
[ "Apache-2.0" ]
0
835db62e39919436824ce022fd3b3f6bac301cd6
https://github.com/JINHXu/NeMo/tree/835db62e39919436824ce022fd3b3f6bac301cd6
Inception3
import torch import torch.nn as nn import torch.nn.functional as F class BasicConv2d(nn.Module): def __init__(self, in_channels, out_channels, **kwargs): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, bias=True, **kwargs) def forward(self, x): x ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Galaxies99/inception-cuda
Inception3
false
11,638
[ "MIT" ]
0
ed8fdbe3caef415e60b52e671273be90e9423e44
https://github.com/Galaxies99/inception-cuda/tree/ed8fdbe3caef415e60b52e671273be90e9423e44
MLP
import torch import torch.nn as nn class SharedDropout(nn.Module): """ SharedDropout differs from the vanilla dropout strategy in that the dropout mask is shared across one dimension. Args: p (float): The probability of an element to be zeroed. Default: 0.5. batch_first (b...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
KoichiYasuoka/SuPar
MLP
false
11,639
[ "MIT" ]
0
9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
https://github.com/KoichiYasuoka/SuPar/tree/9bcf10fb946cae75b6a311d4cd19bec5bb1a9487
D_UpBlock
import torch import torch.utils.data from torchvision.transforms import * class ConvBlock(torch.nn.Module): def __init__(self, input_size, output_size, kernel_size=3, stride=1, padding=1, bias=True, activation='prelu', norm=None): super(ConvBlock, self).__init__() self.conv = torch.nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torchvision.transforms import * assert_size_stride ...
HamsterBiz/iSeeBetter
D_UpBlock
false
11,640
[ "MIT" ]
0
a71cee61583bdedab1f3b368e2cb7dc5ad969aed
https://github.com/HamsterBiz/iSeeBetter/tree/a71cee61583bdedab1f3b368e2cb7dc5ad969aed
LSTMClassCriterion
import torch import torch.nn as nn def to_contiguous(tensor): if tensor.is_contiguous(): return tensor else: return tensor.contiguous() class LSTMClassCriterion(nn.Module): def __init__(self): super(LSTMClassCriterion, self).__init__() def forward(self, pred, target, mask):...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
LeoZDong/shape2prog
LSTMClassCriterion
false
11,641
[ "BSD-2-Clause" ]
0
2185d1d4eb7a1c4c55e644c6af477fd8e8e70241
https://github.com/LeoZDong/shape2prog/tree/2185d1d4eb7a1c4c55e644c6af477fd8e8e70241
LSTMRegressCriterion
import torch import torch.nn as nn class LSTMRegressCriterion(nn.Module): def __init__(self): super(LSTMRegressCriterion, self).__init__() def forward(self, pred, target, mask): pred = pred.clone() target = target.clone() mask = mask.clone() target = target[:, :pred.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...
LeoZDong/shape2prog
LSTMRegressCriterion
false
11,642
[ "BSD-2-Clause" ]
0
2185d1d4eb7a1c4c55e644c6af477fd8e8e70241
https://github.com/LeoZDong/shape2prog/tree/2185d1d4eb7a1c4c55e644c6af477fd8e8e70241
ViTStemPatchify
from torch.nn import Module import torch import torch.utils.data import torch.nn as nn def patchify2d(w_in, w_out, k, *, bias=True): """Helper for building a patchify layer as used by ViT models.""" return nn.Conv2d(w_in, w_out, k, stride=k, padding=0, bias=bias) def patchify2d_cx(cx, w_in, w_out, k, *, bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import torch.utils.data import torch.nn as nn assert...
LicharYuan/pycls
ViTStemPatchify
false
11,643
[ "MIT" ]
0
633529425f2c9ffadd892c1a0418b37891ee2d44
https://github.com/LicharYuan/pycls/tree/633529425f2c9ffadd892c1a0418b37891ee2d44
RegressionModel
import torch import torch.nn as nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReL...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Hyojin021/auto_labeling
RegressionModel
false
11,644
[ "Apache-2.0" ]
0
1ccf0cd1c5adf34692751553a988aa0fcf4efefb
https://github.com/Hyojin021/auto_labeling/tree/1ccf0cd1c5adf34692751553a988aa0fcf4efefb
NormedLinear
import torch import torch.nn.functional as F from torch import nn class NormedLinear(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
LiuXiaoxuanPKU/mmdetection
NormedLinear
false
11,645
[ "Apache-2.0" ]
0
05b46eccbe5c4953d5a406f545fe529ce4e146d3
https://github.com/LiuXiaoxuanPKU/mmdetection/tree/05b46eccbe5c4953d5a406f545fe529ce4e146d3
MergeGate
import torch import torch.nn as nn import torch.nn.functional as F class MergeGate(nn.Module): def __init__(self, hidden_size): super(MergeGate, self).__init__() self.hidden_size = hidden_size self.WSh = nn.Linear(hidden_size, hidden_size) self.WSc = nn.Linear(hidden_size, hidden_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
LeiShenVictoria/Static-Dynamic-Attention-CNNRNN
MergeGate
false
11,646
[ "MIT" ]
0
e2823717d22c9e543428d471ff19113bbb59ebfe
https://github.com/LeiShenVictoria/Static-Dynamic-Attention-CNNRNN/tree/e2823717d22c9e543428d471ff19113bbb59ebfe
Actor
import torch import torch.nn as nn import torch as t class Actor(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) self.action_range ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LeonLester/Machin-title-in-progress-
Actor
false
11,647
[ "MIT" ]
0
777479d47b520dcdc6b09c247591b5fe1d6cbe8c
https://github.com/LeonLester/Machin-title-in-progress-/tree/777479d47b520dcdc6b09c247591b5fe1d6cbe8c
Critic
import torch import torch.nn as nn import torch as t class Critic(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim + action_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state, actio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
LeonLester/Machin-title-in-progress-
Critic
false
11,648
[ "MIT" ]
0
777479d47b520dcdc6b09c247591b5fe1d6cbe8c
https://github.com/LeonLester/Machin-title-in-progress-/tree/777479d47b520dcdc6b09c247591b5fe1d6cbe8c
NormedConv2d
import torch from torch import nn class NormedConv2d(nn.Conv2d): """Normalized Conv2d Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of divisor to keep ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
LiuXiaoxuanPKU/mmdetection
NormedConv2d
false
11,649
[ "Apache-2.0" ]
0
05b46eccbe5c4953d5a406f545fe529ce4e146d3
https://github.com/LiuXiaoxuanPKU/mmdetection/tree/05b46eccbe5c4953d5a406f545fe529ce4e146d3
conv_head_pooling
import torch import torch.nn as nn import torch.autograd class conv_head_pooling(nn.Module): def __init__(self, in_feature, out_feature, stride, padding_mode='zeros'): super(conv_head_pooling, self).__init__() self.maxpool = nn.MaxPool2d(3, 2, 1) self.avgpool = nn.AvgPool2d(3, 2, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
LeiZhang1998/TransReID
conv_head_pooling
false
11,650
[ "MIT" ]
0
5a3f140633e3418c7cff2603ff2e814b9ab466ac
https://github.com/LeiZhang1998/TransReID/tree/5a3f140633e3418c7cff2603ff2e814b9ab466ac