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
Reorg
import torch import torch.nn as nn class Reorg(nn.Module): """ This layer reorganizes a tensor according to a stride. The dimensions 2,3 will be sliced by the stride and then stacked in dimension 1. (input must have 4 dimensions) Args: stride (int): stride to divide the input tensor """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
IrisDinge/YoloV3_DOTA
Reorg
false
5,352
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
L2Norm
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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_...
IrisDinge/YoloV3_DOTA
L2Norm
false
5,353
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
Block
import torch import torch.nn as nn from functools import partial class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Huzhen757/Conformer
Block
false
5,354
[ "Apache-2.0" ]
1
4f7a80cec28b9ced8c0225a85a32997f7cd2b93c
https://github.com/Huzhen757/Conformer/tree/4f7a80cec28b9ced8c0225a85a32997f7cd2b93c
ScaleReLU
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
ScaleReLU
false
5,355
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
GCN
from torch.nn import Module import math import torch from torch import nn from torch.nn import functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Implementatio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
IsmailKent/updown-baseline
GCN
false
5,356
[ "MIT" ]
1
17a09a48e4f30a4a3edc7924f982eb129c583b41
https://github.com/IsmailKent/updown-baseline/tree/17a09a48e4f30a4a3edc7924f982eb129c583b41
PPReLU
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
PPReLU
false
5,357
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
Scale
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
Scale
false
5,358
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
PaddedMaxPool2d
import torch import torch.nn as nn import torch.nn.functional as F class PaddedMaxPool2d(nn.Module): """ Maxpool layer with a replicating padding. Args: kernel_size (int or tuple): Kernel size for maxpooling stride (int or tuple, optional): The stride of the window; Default ``kernel_size`` ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IrisDinge/YoloV3_DOTA
PaddedMaxPool2d
false
5,359
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
GramMatrix
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, y): b, ch, h, w = y.size() features = y.view(b, ch, w * h) features_t = features.transpose(1, 2) gram = features.bmm(features_t) / (ch * h * w) return gram def get_inputs(): return [tor...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
IvoryCandy/neural-style
GramMatrix
false
5,360
[ "Apache-2.0" ]
1
d9d73676479e36c1cbd6c9af36d857f80099504b
https://github.com/IvoryCandy/neural-style/tree/d9d73676479e36c1cbd6c9af36d857f80099504b
Normalize
import torch from torch import nn class Normalize(nn.Module): """normalization layer""" def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(...
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...
JJuOn/Few-shot_Class_Incremental_Learning
Normalize
false
5,362
[ "MIT" ]
1
a2178051a6fefcd73b60f5e4236116bf828a801c
https://github.com/JJuOn/Few-shot_Class_Incremental_Learning/tree/a2178051a6fefcd73b60f5e4236116bf828a801c
Readout
import torch import torch.nn as nn import torch.utils.data class Readout(nn.Module): """ This module learns a single graph level representation for a molecule given GraphSAGE generated embeddings """ def __init__(self, attr_dim, embedding_dim, hidden_dim, output_dim, num_cats): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
JW9MsjwjnpdRLFw/TSFL
Readout
false
5,363
[ "MIT" ]
1
ccca391348fde270c9d43149a3397ac3cad4c6e0
https://github.com/JW9MsjwjnpdRLFw/TSFL/tree/ccca391348fde270c9d43149a3397ac3cad4c6e0
GCN
import torch import torch.nn as nn import torch.utils.data class GCN(nn.Module): """ Graph Convolutional Network based on https://arxiv.org/abs/1609.02907 """ def __init__(self, feat_dim, hidden_dim1, hidden_dim2, dropout, is_sparse=False): """Dense version of GAT.""" super(G...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
JW9MsjwjnpdRLFw/TSFL
GCN
false
5,364
[ "MIT" ]
1
ccca391348fde270c9d43149a3397ac3cad4c6e0
https://github.com/JW9MsjwjnpdRLFw/TSFL/tree/ccca391348fde270c9d43149a3397ac3cad4c6e0
Decoder
import torch import torch.nn as nn class Decoder(nn.Module): def __init__(self, dim_encoding, vocab_size): super().__init__() self.E = nn.Embedding(dim_encoding, vocab_size) self.b = nn.Parameter(torch.zeros(1, vocab_size)) def forward(self, Z, targets): scores = Z @ self.E.w...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
J-zin/Semantic-Hashing-Models
Decoder
false
5,365
[ "MIT" ]
1
2e4a2348bc8399a9739016e1a1a5e25a77babbbd
https://github.com/J-zin/Semantic-Hashing-Models/tree/2e4a2348bc8399a9739016e1a1a5e25a77babbbd
CenteredLayer
import torch from torch import nn class CenteredLayer(nn.Module): def __init__(self, **kwargs): super(CenteredLayer, self).__init__(**kwargs) def forward(self, x): return x - x.mean() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
JamesWang007/Dive-into-DL-PyTorch
CenteredLayer
false
5,366
[ "Apache-2.0" ]
1
267b54168322ab37da44e83008fba4f24b70fa9f
https://github.com/JamesWang007/Dive-into-DL-PyTorch/tree/267b54168322ab37da44e83008fba4f24b70fa9f
ConvBlock
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super(ConvBlock, self).__init__() self.Mconv = nn.Conv2d(in_channels=in_channels, out_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.onnx import torch import torch.nn as nn import torch.utils.data ass...
IrohXu/Infant-Pose-pytorch
ConvBlock
false
5,367
[ "MIT" ]
1
148c43fbfefe06ec2fffa7055049c3ff341154f8
https://github.com/IrohXu/Infant-Pose-pytorch/tree/148c43fbfefe06ec2fffa7055049c3ff341154f8
StageBlock
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super(ConvBlock, self).__init__() self.Mconv = nn.Conv2d(in_channels=in_channels, out_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.onnx import torch import torch.nn as nn import torch.utils.data ass...
IrohXu/Infant-Pose-pytorch
StageBlock
false
5,368
[ "MIT" ]
1
148c43fbfefe06ec2fffa7055049c3ff341154f8
https://github.com/IrohXu/Infant-Pose-pytorch/tree/148c43fbfefe06ec2fffa7055049c3ff341154f8
DistillKL
import torch import torch.nn.functional as F from torch import nn class DistillKL(nn.Module): """KL divergence for distillation""" def __init__(self, T): super(DistillKL, self).__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_softmax(y_s / self.T, dim=1) 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
JJuOn/Few-shot_Class_Incremental_Learning
DistillKL
false
5,369
[ "MIT" ]
1
a2178051a6fefcd73b60f5e4236116bf828a801c
https://github.com/JJuOn/Few-shot_Class_Incremental_Learning/tree/a2178051a6fefcd73b60f5e4236116bf828a801c
FastRCNNPredictor
import torch import torch.nn.functional as F from torch import nn class FastRCNNPredictor(nn.Module): def __init__(self, in_channels, mid_channels, num_classes): super().__init__() self.fc1 = nn.Linear(in_channels, mid_channels) self.fc2 = nn.Linear(mid_channels, mid_channels) 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 from torch import nn assert_s...
Jaramies/PyTorch-Simple-MaskRCNN
FastRCNNPredictor
false
5,370
[ "MIT" ]
1
21e6c6983b34061800280573ebe705ae17212972
https://github.com/Jaramies/PyTorch-Simple-MaskRCNN/tree/21e6c6983b34061800280573ebe705ae17212972
RPNHead
import torch import torch.nn.functional as F from torch import nn class RPNHead(nn.Module): def __init__(self, in_channels, num_anchors): super().__init__() self.conv = nn.Conv2d(in_channels, in_channels, 3, 1, 1) self.cls_logits = nn.Conv2d(in_channels, num_anchors, 1) self.bbox_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Jaramies/PyTorch-Simple-MaskRCNN
RPNHead
false
5,371
[ "MIT" ]
1
21e6c6983b34061800280573ebe705ae17212972
https://github.com/Jaramies/PyTorch-Simple-MaskRCNN/tree/21e6c6983b34061800280573ebe705ae17212972
GlobalAvgPool2d
import torch from torch import nn import torch.nn.functional as F class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): return F.avg_pool2d(x, kernel_size=x.size()[2:]) def get_inputs(): return [torch.rand([4, 4, 4, 4])] d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
JamesWang007/Dive-into-DL-PyTorch
GlobalAvgPool2d
false
5,372
[ "Apache-2.0" ]
1
267b54168322ab37da44e83008fba4f24b70fa9f
https://github.com/JamesWang007/Dive-into-DL-PyTorch/tree/267b54168322ab37da44e83008fba4f24b70fa9f
ShapePriorLoss
import torch import torch.nn as nn import torch.cuda.comm class ShapePriorLoss(nn.Module): """Prior loss for body shape parameters. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.cuda.comm assert_size_stride = torch._C._dynamo.guards...
JasonBoy1/mmhuman3d
ShapePriorLoss
false
5,373
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
stage_block
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class dilation_layer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding= 'same_padding', dilation=1): super(dilation_layer, self).__init__() if padding == 'same_padding'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.onnx import torc...
IrohXu/Infant-Pose-pytorch
stage_block
false
5,374
[ "MIT" ]
1
148c43fbfefe06ec2fffa7055049c3ff341154f8
https://github.com/IrohXu/Infant-Pose-pytorch/tree/148c43fbfefe06ec2fffa7055049c3ff341154f8
DBlock
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] return k class Conv2d(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 import numpy as np import torch.nn as nn import torch.nn.functional as F assert_...
Iceland-Leo/StyleGAN2_PyTorch
DBlock
false
5,375
[ "MIT" ]
1
3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
CameraPriorLoss
import torch import torch.nn as nn import torch.cuda.comm class CameraPriorLoss(nn.Module): """Prior loss for predicted camera. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". scale (float, optional): The scale c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda.comm assert_size_stride = torch._...
JasonBoy1/mmhuman3d
CameraPriorLoss
false
5,376
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
LearnedPositionalEncoding
import torch from torch import nn class LayerNorm(nn.Module): """A layernorm module in the TF style (epsilon inside the square root).""" def __init__(self, d_model, variance_epsilon=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torc...
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...
JamesNgo3781/vietocr
LearnedPositionalEncoding
false
5,377
[ "Apache-2.0" ]
1
9d311bbeb18c51c8ff90022f07c0463b204407dc
https://github.com/JamesNgo3781/vietocr/tree/9d311bbeb18c51c8ff90022f07c0463b204407dc
L1Loss
import functools import torch import torch.nn as nn import torch.cuda.comm from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
JasonBoy1/mmhuman3d
L1Loss
false
5,378
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
MediatorNet
import torch import torch.nn as nn class MediatorNet(nn.Module): def __init__(self, input_dim): super(MediatorNet, self).__init__() self.fc1 = nn.Linear(input_dim, input_dim * 3) self.fc2 = nn.Linear(input_dim * 3, input_dim * 3) self.fc_last = nn.Linear(input_dim * 3, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
JasonZuu/Frame-Selection
MediatorNet
false
5,379
[ "BSD-3-Clause" ]
1
3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
https://github.com/JasonZuu/Frame-Selection/tree/3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
HSigmoid
import torch import torch.nn as nn import torch.nn.functional as F class HSigmoid(nn.Module): def forward(self, x): out = F.relu6(x + 3, inplace=True) / 6 return out def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
JasonZuu/Frame-Selection
HSigmoid
false
5,380
[ "BSD-3-Clause" ]
1
3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
https://github.com/JasonZuu/Frame-Selection/tree/3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
SmoothTranslationLoss
import torch import torch.nn as nn import torch.cuda.comm class SmoothTranslationLoss(nn.Module): """Smooth loss for translations. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): Th...
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.cuda.comm assert_size_stride = torch._...
JasonBoy1/mmhuman3d
SmoothTranslationLoss
false
5,381
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
GatedConv2d
import torch from torch import nn from torch.nn import functional as F class GatedConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation=1): super(GatedConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, 2 * out_channels, kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
JamesRitchie/nsf
GatedConv2d
false
5,382
[ "MIT" ]
1
5628a6f8190c9e3840208da8baf5cf403ca9b892
https://github.com/JamesRitchie/nsf/tree/5628a6f8190c9e3840208da8baf5cf403ca9b892
MSELoss
import functools import torch import torch.nn as nn import torch.cuda.comm from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import functools import torch.nn as nn import torch.cuda.comm from torch.nn import functi...
JasonBoy1/mmhuman3d
MSELoss
false
5,383
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
GCNClassification
import torch import torch.nn as nn import torch.utils.data class Readout(nn.Module): """ This module learns a single graph level representation for a molecule given GraphSAGE generated embeddings """ def __init__(self, attr_dim, embedding_dim, hidden_dim, output_dim, num_cats): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
JW9MsjwjnpdRLFw/TSFL
GCNClassification
false
5,384
[ "MIT" ]
1
ccca391348fde270c9d43149a3397ac3cad4c6e0
https://github.com/JW9MsjwjnpdRLFw/TSFL/tree/ccca391348fde270c9d43149a3397ac3cad4c6e0
RBF_Kernel
import torch import numpy as np def norm_sq(X, Y): XX = X.matmul(X.t()) XY = X.matmul(Y.t()) YY = Y.matmul(Y.t()) return -2 * XY + XX.diag().unsqueeze(1) + YY.diag().unsqueeze(0) class RBF_Kernel(torch.nn.Module): """ RBF kernel :math:`K(x, y) = exp(||x-v||^2 / (2h)) """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
JeremyAlain/meta_learning_pacoh
RBF_Kernel
false
5,385
[ "MIT" ]
1
b4c2c37d9715e74542bab556ac1f5d778cc3409c
https://github.com/JeremyAlain/meta_learning_pacoh/tree/b4c2c37d9715e74542bab556ac1f5d778cc3409c
CustomNet
import torch import torch.nn as nn class CustomNet(nn.Module): """ A network with a fully connected layer followed by a sigmoid layer. This is used for testing customized operation handles. """ def __init__(self, input_dim: 'int', output_dim: 'int') ->None: super(CustomNet, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Jennifer-Rigdon/fvcore
CustomNet
false
5,386
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
Decoder
import math import torch from torch import nn import torch.hub def overlap_and_add(signal, frame_step): outer_dimensions = signal.size()[:-2] frames, frame_length = signal.size()[-2:] subframe_length = math.gcd(frame_length, frame_step) subframe_step = frame_step // subframe_length subframes_per_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 import math from torch import nn import torch.hub assert_size_stride = torch._C....
JavierCane/demucs
Decoder
false
5,387
[ "MIT" ]
1
01d14844a71be7b5d86adf06a8501a951157c3fe
https://github.com/JavierCane/demucs/tree/01d14844a71be7b5d86adf06a8501a951157c3fe
IMQSteinKernel
import math import torch def norm_sq(X, Y): XX = X.matmul(X.t()) XY = X.matmul(Y.t()) YY = Y.matmul(Y.t()) return -2 * XY + XX.diag().unsqueeze(1) + YY.diag().unsqueeze(0) class IMQSteinKernel(torch.nn.Module): """ IMQ (inverse multi-quadratic) kernel :math:`K(x, y) = (\\alpha + ||x-y||...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda...
JeremyAlain/meta_learning_pacoh
IMQSteinKernel
false
5,388
[ "MIT" ]
1
b4c2c37d9715e74542bab556ac1f5d778cc3409c
https://github.com/JeremyAlain/meta_learning_pacoh/tree/b4c2c37d9715e74542bab556ac1f5d778cc3409c
Actor
import torch import numpy as np import torch.nn as nn def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class Actor(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300, init_w=0.003): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JackYangzg/pytorch-ddpg
Actor
false
5,389
[ "Apache-2.0" ]
1
96838a40dd6992a0a18065a5edafbefc6bb0ac69
https://github.com/JackYangzg/pytorch-ddpg/tree/96838a40dd6992a0a18065a5edafbefc6bb0ac69
MuSigmaEncoder
import torch import torch.nn as nn class MuSigmaEncoder(nn.Module): """ Maps a representation r to mu and sigma which will define the normal distribution from which we sample the latent variable z. Parameters ---------- r_dim : int Dimension of output representation r. z_dim : in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
JeremyAlain/meta_learning_pacoh
MuSigmaEncoder
false
5,390
[ "MIT" ]
1
b4c2c37d9715e74542bab556ac1f5d778cc3409c
https://github.com/JeremyAlain/meta_learning_pacoh/tree/b4c2c37d9715e74542bab556ac1f5d778cc3409c
SmallConvNet
import torch import torch.nn as nn from numpy import prod class SmallConvNet(nn.Module): """ A network with three conv layers. This is used for testing convolution layers for activation count. """ def __init__(self, input_dim: 'int') ->None: super(SmallConvNet, self).__init__() co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from numpy import prod assert_size_stride = torch._C._dyna...
Jennifer-Rigdon/fvcore
SmallConvNet
false
5,391
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
Encoder
import torch from torch import nn import torch.hub import torch.nn.functional as F class Encoder(nn.Module): """Estimation of the nonnegative mixture weight by a 1-D conv layer. """ def __init__(self, L, N, audio_channels): super(Encoder, self).__init__() self.L, self.N = L, N 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 from torch import nn import t...
JavierCane/demucs
Encoder
false
5,392
[ "MIT" ]
1
01d14844a71be7b5d86adf06a8501a951157c3fe
https://github.com/JavierCane/demucs/tree/01d14844a71be7b5d86adf06a8501a951157c3fe
DeConv2dBlock
import torch from torch import nn class DeConv2dBlock(nn.Module): """ Similar to a LeNet block 4x upsampling, dimension hard-coded """ def __init__(self, in_dim: 'int', hidden_dim: 'int', out_dim: 'int', stride: 'int'=2, kernel_size: 'int'=3, padding: 'int'=2, output_padding: 'int...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Jimmy-INL/fourier-transformer
DeConv2dBlock
false
5,393
[ "MIT" ]
1
44a6ebc68aef24a4eb9aaa2a8c518ede56ec47ce
https://github.com/Jimmy-INL/fourier-transformer/tree/44a6ebc68aef24a4eb9aaa2a8c518ede56ec47ce
DQN
import torch import torch.nn.functional as F import torch.nn as nn class DQN(nn.Module): """A simple deep Q network implementation. Computes Q values for each (action, object) tuple given an input state vector """ def __init__(self, state_dim, action_dim, object_dim, hidden_size=100): super(D...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Jerimat/MITx-6.86-MachineLearning_EdX
DQN
false
5,394
[ "MIT" ]
1
e454e0646cd923d689d3946ea2ff3432dec920ac
https://github.com/Jerimat/MITx-6.86-MachineLearning_EdX/tree/e454e0646cd923d689d3946ea2ff3432dec920ac
Actor
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, state_dim: 'int', action_dim: 'int'): """ Initialize the network param: state_dim : Size of the state space param: action_dim: Size of the action space ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JiangengDong/ECE276C
Actor
false
5,395
[ "MIT" ]
1
2338b5226d6fed8858402e8d67db7f2eead98221
https://github.com/JiangengDong/ECE276C/tree/2338b5226d6fed8858402e8d67db7f2eead98221
FreqUpsample
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class FreqUpsample(nn.Module): def __init__(self, factor: 'int', mode='nearest'): super().__init__() self.f = float(factor) self.mode = mode def forward(self, x: 'Tensor') ->Tensor: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
JinmingChe/DeepFilterNet
FreqUpsample
false
5,396
[ "ECL-2.0", "Apache-2.0", "MIT" ]
1
0e35a24c33c091b4c34afb3599f2945bf5e87adf
https://github.com/JinmingChe/DeepFilterNet/tree/0e35a24c33c091b4c34afb3599f2945bf5e87adf
ResidualBlock
import torch import numpy as np import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = int(np.floor(kernel_size / 2)) self.reflection_pad = nn.ReflectionPad2d(reflection_p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IvoryCandy/neural-style
ResidualBlock
false
5,397
[ "Apache-2.0" ]
1
d9d73676479e36c1cbd6c9af36d857f80099504b
https://github.com/IvoryCandy/neural-style/tree/d9d73676479e36c1cbd6c9af36d857f80099504b
SoftDetectionModule
import torch import torch.nn.functional as F import torch.nn as nn class SoftDetectionModule(nn.Module): def __init__(self, soft_local_max_size=3): super(SoftDetectionModule, self).__init__() self.soft_local_max_size = soft_local_max_size self.pad = self.soft_local_max_size // 2 def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
JimmyYourHonor/D2-net-fast-ap
SoftDetectionModule
false
5,398
[ "BSD-3-Clause-Clear" ]
1
c4c0db23eae3aa4e3079b80b57887b4cb963b1e8
https://github.com/JimmyYourHonor/D2-net-fast-ap/tree/c4c0db23eae3aa4e3079b80b57887b4cb963b1e8
ConvNet
import torch import torch.nn as nn class ConvNet(nn.Module): """ A network with a single convolution layer. This is used for testing flop count for convolution layers. """ def __init__(self, conv_dim: 'int', input_dim: 'int', output_dim: 'int', kernel_size: 'int', spatial_dim: 'int', stri...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jennifer-Rigdon/fvcore
ConvNet
false
5,399
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
SiSdr
import torch from torch import Tensor from torch import nn class SiSdr(nn.Module): def __init__(self): super().__init__() def forward(self, input: 'Tensor', target: 'Tensor'): eps = torch.finfo(input.dtype).eps Rss: 'Tensor' = torch.einsum('bi,bi->b', target, target).unsqueeze(-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.triton_helpers import libdevice from torch import n...
JinmingChe/DeepFilterNet
SiSdr
false
5,400
[ "ECL-2.0", "Apache-2.0", "MIT" ]
1
0e35a24c33c091b4c34afb3599f2945bf5e87adf
https://github.com/JinmingChe/DeepFilterNet/tree/0e35a24c33c091b4c34afb3599f2945bf5e87adf
QuickGELU
import torch from torch import nn class QuickGELU(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Jinsu-L/KELIP
QuickGELU
false
5,401
[ "Apache-2.0" ]
1
d3261cbb9ba3c3ad474dd560a5add8b69ed78477
https://github.com/Jinsu-L/KELIP/tree/d3261cbb9ba3c3ad474dd560a5add8b69ed78477
DfAlphaLoss
import torch from torch import Tensor from typing import Optional from torch import nn from typing import Final class DfAlphaLoss(nn.Module): """Add a penalty to use DF for very noisy segments. Starting from lsnr_thresh, the penalty is increased and has its maximum at lsnr_min. """ factor: 'Final[flo...
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 Tens...
JinmingChe/DeepFilterNet
DfAlphaLoss
false
5,402
[ "ECL-2.0", "Apache-2.0", "MIT" ]
1
0e35a24c33c091b4c34afb3599f2945bf5e87adf
https://github.com/JinmingChe/DeepFilterNet/tree/0e35a24c33c091b4c34afb3599f2945bf5e87adf
LogsticRegression
import torch import torch.nn as nn import torch.nn.functional as F class LogsticRegression(nn.Module): def __init__(self, in_dim, n_class): super().__init__() self.fc1 = nn.Linear(in_dim, in_dim // 2) self.fc2 = nn.Linear(in_dim // 2, n_class) def forward(self, x): x = F.relu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Jie-Yuan/Torchappy
LogsticRegression
false
5,403
[ "Apache-2.0" ]
1
e722db1085fa2ff8e0267f7e6745875531c00f8b
https://github.com/Jie-Yuan/Torchappy/tree/e722db1085fa2ff8e0267f7e6745875531c00f8b
ThreeNet
import torch import torch.nn as nn class ThreeNet(nn.Module): """ A network with three layers. This is used for testing a network with more than one operation. The network has a convolution layer followed by two fully connected layers. """ def __init__(self, input_dim: 'int', conv_dim: 'int',...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Jennifer-Rigdon/fvcore
ThreeNet
false
5,404
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
FeatureL2Norm
import torch import torch.nn as nn import torch.nn class FeatureL2Norm(nn.Module): """ Implementation by Ignacio Rocco paper: https://arxiv.org/abs/1703.05593 project: https://github.com/ignacio-rocco/cnngeometric_pytorch """ def __init__(self): super(FeatureL2Norm, 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._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.gua...
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
FeatureL2Norm
false
5,405
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
Flip
import torch import torch.nn as nn import torch.nn.init class Flip(nn.Module): """Does horizontal or vertical flip on a BCHW tensor. Args: horizontal (bool): If True, applies horizontal flip. Else, vertical flip is applied. Default = True ** Not recommended for CPU (Pillow/OpenCV bas...
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.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
Johnson-yue/TensorMONK
Flip
false
5,406
[ "MIT" ]
1
1785132b82c685c3b3fc05b00dec46b1fccfc948
https://github.com/Johnson-yue/TensorMONK/tree/1785132b82c685c3b3fc05b00dec46b1fccfc948
CorrelationVolume
import torch import torch.nn as nn import torch.nn class CorrelationVolume(nn.Module): """ Implementation by Ignacio Rocco paper: https://arxiv.org/abs/1703.05593 project: https://github.com/ignacio-rocco/cnngeometric_pytorch """ def __init__(self): super(CorrelationVolume, self).__in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guar...
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
CorrelationVolume
false
5,407
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
FeatureCorrelation
import torch import torch.nn as nn import torch.nn def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class FeatureCorrelation(torch.nn.Module): def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
FeatureCorrelation
false
5,408
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
GaussianFocalLoss
import functools import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
JunHyungKang/SAROD_ICIP
GaussianFocalLoss
false
5,409
[ "MIT" ]
1
71585951f64dc1cc22ed72900eff81f747edec77
https://github.com/JunHyungKang/SAROD_ICIP/tree/71585951f64dc1cc22ed72900eff81f747edec77
PCENlr
import torch import torch.nn as nn class PCENlr(nn.Module): """ A Low-rank version for per-channel energy normalization. """ def __init__(self, N, T): super(PCENlr, self).__init__() self.N = N self.T = T self.lr_enc = nn.Linear(self.T, 1, bias=False) self.l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Js-Mim/wagner_vad
PCENlr
false
5,410
[ "MIT" ]
1
cc682bd7a8f496a26fe4be39ea2b2d68e493c5ba
https://github.com/Js-Mim/wagner_vad/tree/cc682bd7a8f496a26fe4be39ea2b2d68e493c5ba
ConvHeadPooling
import torch import torch.nn as nn class ConvHeadPooling(nn.Module): """Adapted from https://github.com/naver-ai/pit/blob/9d97a62e6a2a72a86685003998fcae700f952e18/pit.py#L54-L69 """ def __init__(self, in_feature: 'int', out_feature: 'int', stride: 'int'): super(ConvHeadPooling, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Justin900429/vision-transformer
ConvHeadPooling
false
5,411
[ "MIT" ]
1
e149092efbb83c166449944137db0ee5200f9325
https://github.com/Justin900429/vision-transformer/tree/e149092efbb83c166449944137db0ee5200f9325
AffineGridGen
from torch.nn import Module import torch import torch.nn.functional as F import torch.nn from torch.nn.modules.module import Module class AffineGridGen(Module): def __init__(self, out_h=240, out_w=240, out_ch=3, use_cuda=True): super(AffineGridGen, self).__init__() self.out_h = out_h 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.nn import Module import torch.nn from torch.nn.modules.module import Module assert_size_stride = torch._C._dynamo.guards.assert_s...
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
AffineGridGen
false
5,412
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
CMDS_Loss
import torch from torch import nn from sklearn.preprocessing import scale as scale def Covariance(m, bias=False, rowvar=True, inplace=False): """ Estimate a covariance matrix given data(tensor). Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, `X = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
Gustoaxel/Statistical-autoencoder
CMDS_Loss
false
5,413
[ "MIT" ]
1
f3328f9c2a45ef0f7fe4adf98af4a64d02d34afc
https://github.com/Gustoaxel/Statistical-autoencoder/tree/f3328f9c2a45ef0f7fe4adf98af4a64d02d34afc
NNMerge
import torch import torch.nn as nn class NNMerge(nn.Module): def __init__(self): super(NNMerge, self).__init__() def forward(self, x): """ (k,D) -> (D,) """ return torch.sum(x, -2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Justin-Yuan/learn-to-interact
NNMerge
false
5,414
[ "MIT" ]
1
eb013bb3bab269bda8a8075e64fe3bcd2964d8ae
https://github.com/Justin-Yuan/learn-to-interact/tree/eb013bb3bab269bda8a8075e64fe3bcd2964d8ae
InputInjection
import torch import torch.nn as nn import torch._C import torch.serialization class InputInjection(nn.Module): """Downsampling module for CGNet.""" def __init__(self, num_downsampling): super(InputInjection, self).__init__() self.pool = nn.ModuleList() for i in range(num_downsampling)...
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._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
Jun-jieChen/real-time-segmentation
InputInjection
false
5,415
[ "Apache-2.0" ]
1
22d0cb1a8a0dfa3b38f25bcd05db15f345be291a
https://github.com/Jun-jieChen/real-time-segmentation/tree/22d0cb1a8a0dfa3b38f25bcd05db15f345be291a
FCN8VGG16
import torch import numpy as np from torch import nn import torch.utils.model_zoo as model_zoo def conv3x3(in_planes, out_planes, stride=1, padding=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=(3, 3), stride=( stride, stride), padding=(padding, padding)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
DoranLyong/DeepFish
FCN8VGG16
false
5,416
[ "MIT" ]
1
3ea3e13653f708d4a8dcb54b990dcc2997edf4e9
https://github.com/DoranLyong/DeepFish/tree/3ea3e13653f708d4a8dcb54b990dcc2997edf4e9
CyclicShift
import torch import torch.nn as nn def to_2tuple(value): return value, value class CyclicShift(nn.Module): def __init__(self, displacement): super().__init__() if isinstance(displacement, int): self.displacement = to_2tuple(displacement) else: self.displaceme...
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...
Justin900429/vision-transformer
CyclicShift
false
5,417
[ "MIT" ]
1
e149092efbb83c166449944137db0ee5200f9325
https://github.com/Justin900429/vision-transformer/tree/e149092efbb83c166449944137db0ee5200f9325
AttentionPool2d
import torch import torch.nn.functional as F from torch import 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(torch.randn(spacial_dim ** ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Jinsu-L/KELIP
AttentionPool2d
false
5,418
[ "Apache-2.0" ]
1
d3261cbb9ba3c3ad474dd560a5add8b69ed78477
https://github.com/Jinsu-L/KELIP/tree/d3261cbb9ba3c3ad474dd560a5add8b69ed78477
TracedModule
import torch import torch.quantization import torch.onnx import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class TracedModule(torch.nn.Module): def forward(self, x): x = x.type(torch.float32) return torch.floor(torch.sqrt(x) / 5.0) def get_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 libdevice import torch.quantization import torch.onnx import torch.nn.parallel import tor...
Justin-A/PyTorch-tutorials-kr
TracedModule
false
5,419
[ "BSD-3-Clause" ]
1
0d8e407523e5e75de0081becf800b82b37eb912f
https://github.com/Justin-A/PyTorch-tutorials-kr/tree/0d8e407523e5e75de0081becf800b82b37eb912f
PixelWise
import torch import torch.nn.init class PixelWise(torch.nn.Module): """ Implemented - https://arxiv.org/pdf/1710.10196.pdf """ def __init__(self, eps=1e-06): super(PixelWise, self).__init__() self.eps = eps def forward(self, tensor): return tensor.div(tensor.pow(2).mean(1, True)....
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.init assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Johnson-yue/TensorMONK
PixelWise
false
5,420
[ "MIT" ]
1
1785132b82c685c3b3fc05b00dec46b1fccfc948
https://github.com/Johnson-yue/TensorMONK/tree/1785132b82c685c3b3fc05b00dec46b1fccfc948
Connect2Model
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Connect2Model(nn.Module): def __init__(self, board_size, action_size, device): super(Connect2Model, self).__init__() self.device = device self.size = board_size self.action_size = action_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JoshVarty/ConnectX
Connect2Model
false
5,421
[ "MIT" ]
1
05478e250a149df46bf93a6b85282ded34afadc3
https://github.com/JoshVarty/ConnectX/tree/05478e250a149df46bf93a6b85282ded34afadc3
RON
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class RON(nn.Module): def __init__(self, lat_inC, top_inC, outC): super(RON, self).__init__() self.latlayer = nn.Conv2d(lat_inC, outC, 3, 1, padding=1) self.toplayer = nn.ConvTranspos...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 math import sqrt as sqrt from itertools import produc...
KaiOtter/pytorch_DSOD_variants
RON
false
5,422
[ "MIT" ]
1
f29088b13b24f24e2cf20e9a2dc800cd6dbde145
https://github.com/KaiOtter/pytorch_DSOD_variants/tree/f29088b13b24f24e2cf20e9a2dc800cd6dbde145
PairwiseRankingLoss
import torch import torch.nn as nn import torch.utils.data class PairwiseRankingLoss(nn.Module): """ Pairwise ranking loss """ def __init__(self, margin): super(PairwiseRankingLoss, self).__init__() self.margin = margin def forward(self, anchor1, anchor2, img_sentc, sent_imgc): ...
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 assert_size_stride = torch._C._dynamo.guard...
KarmaJun/nlp
PairwiseRankingLoss
false
5,423
[ "MIT" ]
1
ef14634f45483415205d2738b4e11594a380f082
https://github.com/KarmaJun/nlp/tree/ef14634f45483415205d2738b4e11594a380f082
PatchEmbedding
import torch import torch.nn as nn class PatchEmbedding(nn.Module): """ small patches embedding image(B, C, H, W) -> projection(B, emb_dims, H/P, W/P) -> flatten & transpose(B, {(H/P) * (W/P)}, embed_dims) """ def __init__(self, image_size=224, patch_size=16, in_channels=3, embed_dims=768...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Junhojuno/vision-transformer
PatchEmbedding
false
5,424
[ "MIT" ]
1
38f8a17967e91e98f767c8e5754081ee8bcd72b4
https://github.com/Junhojuno/vision-transformer/tree/38f8a17967e91e98f767c8e5754081ee8bcd72b4
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, n_obs, n_actions, hidden_size, init_w=0.003): super(Actor, self).__init__() self.linear1 = nn.Linear(n_obs, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
KOWKO1/reinforcement-learning-tutorials
Actor
false
5,425
[ "MIT" ]
1
5f29d6eba8b580041f3e82d88dc3e1cd8e4cae10
https://github.com/KOWKO1/reinforcement-learning-tutorials/tree/5f29d6eba8b580041f3e82d88dc3e1cd8e4cae10
ResidualAttentionBlock
import torch from collections import OrderedDict from torch import nn class LayerNorm(nn.LayerNorm): """Subclass torch's LayerNorm to handle fp16.""" def forward(self, x: 'torch.Tensor'): orig_type = x.dtype ret = super().forward(x.type(torch.float32)) return ret.type(orig_type) 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....
Jinsu-L/KELIP
ResidualAttentionBlock
false
5,426
[ "Apache-2.0" ]
1
d3261cbb9ba3c3ad474dd560a5add8b69ed78477
https://github.com/Jinsu-L/KELIP/tree/d3261cbb9ba3c3ad474dd560a5add8b69ed78477
Mnist_CNN
import torch import torch.nn as nn import torch.nn.functional as F import torch.quantization import torch.onnx import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Mnist_CNN(nn.Module): def __init__(self): super().__init__() self.conv1 = 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 ...
Justin-A/PyTorch-tutorials-kr
Mnist_CNN
false
5,427
[ "BSD-3-Clause" ]
1
0d8e407523e5e75de0081becf800b82b37eb912f
https://github.com/Justin-A/PyTorch-tutorials-kr/tree/0d8e407523e5e75de0081becf800b82b37eb912f
FPN
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product import torch.nn.functional as F class FPN(nn.Module): def __init__(self, lat_inC, top_inC, outC, mode='nearest'): super(FPN, self).__init__() assert mode in ['nearest', 'bilinear'] 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 import torch.nn as nn from math import sqrt as sqrt from itertools import produc...
KaiOtter/pytorch_DSOD_variants
FPN
false
5,428
[ "MIT" ]
1
f29088b13b24f24e2cf20e9a2dc800cd6dbde145
https://github.com/KaiOtter/pytorch_DSOD_variants/tree/f29088b13b24f24e2cf20e9a2dc800cd6dbde145
StandardizedConv2d
import torch import torch.nn as nn import torch.nn.functional as F class StandardizedConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(StandardizedConv2d, self).__init__(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.triton_helpers import libdevice import torch.nn as ...
KKallidromitis/vissl
StandardizedConv2d
false
5,429
[ "MIT" ]
1
c553e7f6b13c5fa951e3f989beb129899eb8cc80
https://github.com/KKallidromitis/vissl/tree/c553e7f6b13c5fa951e3f989beb129899eb8cc80
SameBlock2d
import torch import torch.nn.functional as F from torch import nn class SameBlock2d(nn.Module): """ Simple block, preserve spatial resolution. """ def __init__(self, in_features, out_features, groups=1, kernel_size=3, padding=1): super(SameBlock2d, self).__init__() self.conv =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
KangweiiLiu/Thin-Plate-Spline-Motion-Model
SameBlock2d
false
5,430
[ "MIT" ]
1
0ec14f6c06f5beeef159340142ec5182a1be9bc7
https://github.com/KangweiiLiu/Thin-Plate-Spline-Motion-Model/tree/0ec14f6c06f5beeef159340142ec5182a1be9bc7
NeuralNetwork
import torch class NeuralNetwork(torch.nn.Module): """ Neural network class of fully connected layers Args: n_input_feature : int number of input features n_output : int number of output classes """ def __init__(self, n_input_feature, n_output): su...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Kani712/CMSI-535
NeuralNetwork
false
5,431
[ "MIT" ]
1
605e7812ee0e5294b6bf3ecb8fadaed4e85a7dd3
https://github.com/Kani712/CMSI-535/tree/605e7812ee0e5294b6bf3ecb8fadaed4e85a7dd3
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): """ 全连接网络""" def __init__(self, state_dim): super(MLP, self).__init__() self.fc1 = nn.Linear(state_dim, 36) self.fc2 = nn.Linear(36, 36) self.fc3 = nn.Linear(36, 1) def forward(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_...
KOWKO1/reinforcement-learning-tutorials
MLP
false
5,432
[ "MIT" ]
1
5f29d6eba8b580041f3e82d88dc3e1cd8e4cae10
https://github.com/KOWKO1/reinforcement-learning-tutorials/tree/5f29d6eba8b580041f3e82d88dc3e1cd8e4cae10
UpBlock2d
import torch import torch.nn.functional as F from torch import nn class UpBlock2d(nn.Module): """ Upsampling block for use in decoder. """ def __init__(self, in_features, out_features, kernel_size=3, padding=1, groups=1): super(UpBlock2d, self).__init__() self.conv = nn.Conv2d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KangweiiLiu/Thin-Plate-Spline-Motion-Model
UpBlock2d
false
5,433
[ "MIT" ]
1
0ec14f6c06f5beeef159340142ec5182a1be9bc7
https://github.com/KangweiiLiu/Thin-Plate-Spline-Motion-Model/tree/0ec14f6c06f5beeef159340142ec5182a1be9bc7
FCNet
import torch import torch.utils.data import torch.nn as nn from torch.nn.utils import weight_norm class FCNet(nn.Module): def __init__(self, in_size, out_size, activate=None, drop=0.0): super(FCNet, self).__init__() self.lin = weight_norm(nn.Linear(in_size, out_size), dim=None) self.drop_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
KaihuaTang/scene-graph-benchmark.pytorch
FCNet
false
5,434
[ "MIT" ]
1
45cd54f7465b81d3154e94fcab2b554a09637f6f
https://github.com/KaihuaTang/scene-graph-benchmark.pytorch/tree/45cd54f7465b81d3154e94fcab2b554a09637f6f
DownBlock2d
import torch import torch.nn.functional as F from torch import nn class DownBlock2d(nn.Module): """ Downsampling block for use in encoder. """ def __init__(self, in_features, out_features, kernel_size=3, padding=1, groups=1): super(DownBlock2d, self).__init__() self.conv = 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 from torch._inductor.runtime....
KangweiiLiu/Thin-Plate-Spline-Motion-Model
DownBlock2d
false
5,435
[ "MIT" ]
1
0ec14f6c06f5beeef159340142ec5182a1be9bc7
https://github.com/KangweiiLiu/Thin-Plate-Spline-Motion-Model/tree/0ec14f6c06f5beeef159340142ec5182a1be9bc7
GateContextSelectionLayer
import torch import torch.nn as nn class GateContextSelectionLayer(nn.Module): def __init__(self, dim_model, dim_ff, prob_dropout): super(GateContextSelectionLayer, self).__init__() self.source = nn.Linear(dim_model, dim_model) self.context = nn.Linear(dim_model, dim_model) def forwa...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
KirkGuo/HCN
GateContextSelectionLayer
false
5,437
[ "MIT" ]
1
7d8020c8d76413b6ca3a359fb2e9b34652949e17
https://github.com/KirkGuo/HCN/tree/7d8020c8d76413b6ca3a359fb2e9b34652949e17
SiamFC
import torch import torch.nn as nn import torch.nn.functional as F class SiamFC(nn.Module): def __init__(self, out_scale=0.001): super(SiamFC, self).__init__() self.out_scale = out_scale def forward(self, z, x): return self._fast_xcorr(z, x) * self.out_scale def _fast_xcorr(self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
Kingzerd/siamfc_pytorch
SiamFC
false
5,438
[ "MIT" ]
1
fd1dbeb12dd7e2b9190876a1de7ea4b71a7a1166
https://github.com/Kingzerd/siamfc_pytorch/tree/fd1dbeb12dd7e2b9190876a1de7ea4b71a7a1166
BalancedLoss
import torch import torch.nn as nn import torch.nn.functional as F class BalancedLoss(nn.Module): def __init__(self, neg_weight=1.0): super(BalancedLoss, self).__init__() self.neg_weight = neg_weight def forward(self, input, target): pos_mask = target == 1 neg_mask = 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 libdevice, math as tl_math import torc...
Kingzerd/siamfc_pytorch
BalancedLoss
false
5,439
[ "MIT" ]
1
fd1dbeb12dd7e2b9190876a1de7ea4b71a7a1166
https://github.com/Kingzerd/siamfc_pytorch/tree/fd1dbeb12dd7e2b9190876a1de7ea4b71a7a1166
Block
import torch import torch.nn as 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....
Junhojuno/vision-transformer
Block
false
5,440
[ "MIT" ]
1
38f8a17967e91e98f767c8e5754081ee8bcd72b4
https://github.com/Junhojuno/vision-transformer/tree/38f8a17967e91e98f767c8e5754081ee8bcd72b4
ConcatFusionLayer
import torch import torch.nn as nn import torch.nn.functional as F class ConcatFusionLayer(nn.Module): def __init__(self, dim_model, voc_size, dout_p): super(ConcatFusionLayer, self).__init__() self.linear = nn.Linear(dim_model, voc_size) self.dropout = nn.Dropout(dout_p) self.lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KirkGuo/HCN
ConcatFusionLayer
false
5,441
[ "MIT" ]
1
7d8020c8d76413b6ca3a359fb2e9b34652949e17
https://github.com/KirkGuo/HCN/tree/7d8020c8d76413b6ca3a359fb2e9b34652949e17
FeatureEmbeddingLayer
import torch import numpy as np import torch.nn as nn class FeatureEmbeddingLayer(nn.Module): def __init__(self, dim_feature, dim_model): super(FeatureEmbeddingLayer, self).__init__() self.dim_model = dim_model self.embed = nn.Linear(dim_feature, dim_model) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
KirkGuo/HCN
FeatureEmbeddingLayer
false
5,442
[ "MIT" ]
1
7d8020c8d76413b6ca3a359fb2e9b34652949e17
https://github.com/KirkGuo/HCN/tree/7d8020c8d76413b6ca3a359fb2e9b34652949e17
BiAttention
import torch from torchvision.transforms import functional as F import torch.utils.data import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import weight_norm class FCNet(nn.Module): def __init__(self, in_size, out_size, activate=None, drop=0.0): super(FCNet, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
KaihuaTang/scene-graph-benchmark.pytorch
BiAttention
false
5,443
[ "MIT" ]
1
45cd54f7465b81d3154e94fcab2b554a09637f6f
https://github.com/KaihuaTang/scene-graph-benchmark.pytorch/tree/45cd54f7465b81d3154e94fcab2b554a09637f6f
PositionwiseFeedForward
import torch from torchvision.transforms import functional as F import torch.utils.data import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.1): super().__init__() self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
KaihuaTang/scene-graph-benchmark.pytorch
PositionwiseFeedForward
false
5,444
[ "MIT" ]
1
45cd54f7465b81d3154e94fcab2b554a09637f6f
https://github.com/KaihuaTang/scene-graph-benchmark.pytorch/tree/45cd54f7465b81d3154e94fcab2b554a09637f6f
PatchEmbed
import torch import torch.nn as nn from typing import Optional class PatchEmbed(nn.Module): def __init__(self, img_size: 'int'=224, patch_size: 'int'=16, stride: 'int'=None, in_channels: 'int'=3, embed_dim: 'int'=768, multi_conv: 'bool'=False, norm_layer: 'Optional'=nn.LayerNorm): super(P...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Justin900429/vision-transformer
PatchEmbed
false
5,446
[ "MIT" ]
1
e149092efbb83c166449944137db0ee5200f9325
https://github.com/Justin900429/vision-transformer/tree/e149092efbb83c166449944137db0ee5200f9325
AvgPool2d
from torch.nn import Module import torch import torch as th class AvgPool2d(Module): """ This class is the beginning of an exact python port of the torch.nn.AvgPool2d module. Because PySyft cannot hook into layers which are implemented in C++, our special functionalities (such as encrypted computation...
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.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._em...
Kritikalcoder/PySyft
AvgPool2d
false
5,447
[ "Apache-2.0" ]
1
4c418084607de74cac7b7795f91168992c555f50
https://github.com/Kritikalcoder/PySyft/tree/4c418084607de74cac7b7795f91168992c555f50
LinearActor
import torch import torch.nn as nn class LinearActor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(LinearActor, self).__init__() self.l1 = nn.Linear(state_dim, action_dim) self.max_action = max_action def forward(self, x): return self.max_action * 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
KuangenZhang/StructuredRL
LinearActor
false
5,448
[ "MIT" ]
1
9b05e5034ff0e045aabf83786efb0859f08e989a
https://github.com/KuangenZhang/StructuredRL/tree/9b05e5034ff0e045aabf83786efb0859f08e989a
SelfGating
import torch import torch.nn as nn import torch.utils.data import torch as th import torch.nn.parallel import torch.optim import torch.utils.data.distributed import torch.cuda class SelfGating(nn.Module): def __init__(self, input_dim): super(SelfGating, self).__init__() self.fc = nn.Linear(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 import torch.nn as nn import torch.utils.data import torch.nn.parallel import to...
KoDohwan/MIL-NCE_HowTo100M
SelfGating
false
5,449
[ "Apache-2.0" ]
1
459f32b40aeb6f00da1315f957d02cd0c82f9307
https://github.com/KoDohwan/MIL-NCE_HowTo100M/tree/459f32b40aeb6f00da1315f957d02cd0c82f9307
GateGRUSelectionLayer
import torch import torch.nn as nn class GateGRUSelectionLayer(nn.Module): def __init__(self, dim_model, dim_ff, prob_dropout): super(GateGRUSelectionLayer, self).__init__() self.reset = nn.Linear(dim_model * 2, dim_model) self.update = nn.Linear(dim_model * 2, dim_model) self.pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
KirkGuo/HCN
GateGRUSelectionLayer
false
5,450
[ "MIT" ]
1
7d8020c8d76413b6ca3a359fb2e9b34652949e17
https://github.com/KirkGuo/HCN/tree/7d8020c8d76413b6ca3a359fb2e9b34652949e17
PAM_Module
from torch.nn import Module import torch from torch.nn import Conv2d from torch.nn import Parameter from torch.nn import Softmax class PAM_Module(Module): """ Position attention module""" def __init__(self, in_dim): super(PAM_Module, self).__init__() self.chanel_in = in_dim self.query...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KonarkPaul/COVID_Adv_attack_vulnerability_study
PAM_Module
false
5,452
[ "MIT" ]
1
f0d1256d0d57a933dd86ccd5fe12d83f9f79ca9c
https://github.com/KonarkPaul/COVID_Adv_attack_vulnerability_study/tree/f0d1256d0d57a933dd86ccd5fe12d83f9f79ca9c
ActionMapper
import torch import torch.nn as nn import torch.nn.functional as F class ActionMapper(nn.Module): def __init__(self, feature_dim, action_dim, max_action): super(ActionMapper, self).__init__() self.l1 = nn.Linear(feature_dim, 300) self.l2 = nn.Linear(300, action_dim) self.max_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 from torch._inductor.runtime....
KuangenZhang/StructuredRL
ActionMapper
false
5,453
[ "MIT" ]
1
9b05e5034ff0e045aabf83786efb0859f08e989a
https://github.com/KuangenZhang/StructuredRL/tree/9b05e5034ff0e045aabf83786efb0859f08e989a
Block
import torch import torch.nn as 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). """ if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.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....
KKallidromitis/vissl
Block
false
5,454
[ "MIT" ]
1
c553e7f6b13c5fa951e3f989beb129899eb8cc80
https://github.com/KKallidromitis/vissl/tree/c553e7f6b13c5fa951e3f989beb129899eb8cc80
SA_Module
import torch import torch.nn as nn class SA_Module(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super(SA_Module, self).__init__() self.chanel_in = in_dim self.activation = activation self.query_conv = nn.Conv2d(in_channels=in_dim, out_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
KonarkPaul/COVID_Adv_attack_vulnerability_study
SA_Module
false
5,455
[ "MIT" ]
1
f0d1256d0d57a933dd86ccd5fe12d83f9f79ca9c
https://github.com/KonarkPaul/COVID_Adv_attack_vulnerability_study/tree/f0d1256d0d57a933dd86ccd5fe12d83f9f79ca9c