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
PIENet
import torch import numpy as np import torch.nn as nn import torch.nn.init import torch.nn.parallel class MultiHeadSelfAttention(nn.Module): """Self-attention module by Lin, Zhouhan, et al. ICLR 2017""" def __init__(self, n_head, d_in, d_hidden): super(MultiHeadSelfAttention, 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....
CLT29/pvse
PIENet
false
13,471
[ "MIT" ]
119
bf5232148396ee5051564ef68a48538de0ddbc84
https://github.com/CLT29/pvse/tree/bf5232148396ee5051564ef68a48538de0ddbc84
HR2O_NL
import torch import torch.nn as nn class HR2O_NL(nn.Module): def __init__(self, hidden_dim=512, kernel_size=3, mlp_1x1=False): super(HR2O_NL, self).__init__() self.hidden_dim = hidden_dim padding = kernel_size // 2 self.conv_q = nn.Conv2d(hidden_dim, hidden_dim, kernel_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AlexandreDh/ACAR-Net
HR2O_NL
false
13,472
[ "Apache-2.0" ]
162
db28009388512e31cb6ff8e86725dc9b026886b6
https://github.com/AlexandreDh/ACAR-Net/tree/db28009388512e31cb6ff8e86725dc9b026886b6
BiAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class BiAttention(nn.Module): def __init__(self, input_size, dropout): super().__init__() self.dropout = nn.Dropout(p=dropout) self.input_linear = nn.Linear(input_size, 1, bias=False) self.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ChenZhongFu/KOBE
BiAttention
false
13,473
[ "MIT" ]
176
710d7556516bdbd9ad971e6ff8b8f625a1a55e5a
https://github.com/ChenZhongFu/KOBE/tree/710d7556516bdbd9ad971e6ff8b8f625a1a55e5a
RankCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class RankCrossEntropyLoss(nn.Module): """Creates a criterion that measures rank cross entropy loss.""" __constants__ = ['num_neg'] def __init__(self, num_neg: 'int'=1): """ :class:`RankCrossEntropyLoss` constructor. ...
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 ...
ChrisRBXiong/MatchZoo-py
RankCrossEntropyLoss
false
13,474
[ "Apache-2.0" ]
468
8883d0933a62610d71fec0215dce643630e03b1c
https://github.com/ChrisRBXiong/MatchZoo-py/tree/8883d0933a62610d71fec0215dce643630e03b1c
Model
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, n_actions, input_len): super(Model, self).__init__() self.fc1 = nn.Linear(input_len, 100) self.fc2 = nn.Linear(100, 100) self.out_policy = nn.Linear(100, n_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....
ChengUVa/ptan
Model
false
13,475
[ "MIT" ]
492
f9b3ef2680ff64fad52e600d73ff2bf42eee310d
https://github.com/ChengUVa/ptan/tree/f9b3ef2680ff64fad52e600d73ff2bf42eee310d
ConvMeanPool
import torch import torch.nn as nn class CustomConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, bias=True, residual_init=True): super(CustomConv2d, self).__init__() self.residual_init = residual_init if padding is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ChiragCD/NR-GAN
ConvMeanPool
false
13,476
[ "MIT" ]
54
fc455c6219b09bc8bf605715504b78b2bb801e48
https://github.com/ChiragCD/NR-GAN/tree/fc455c6219b09bc8bf605715504b78b2bb801e48
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init class MultiHeadAttention(nn.Module): def __init__(self, heads, d_model, dropout=0.1): super().__init__() self.d_model = d_model self.d_k = d_model // heads self.h = heads 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....
Chenny0808/tatk
MultiHeadAttention
false
13,477
[ "Apache-2.0" ]
81
1c1a3cb557ba84bbfdbd1f6d8b8ea43ed8b9d7c5
https://github.com/Chenny0808/tatk/tree/1c1a3cb557ba84bbfdbd1f6d8b8ea43ed8b9d7c5
SoftEntropy
import torch from torch import nn import torch.nn.functional as F from torch.nn import * from torch.optim.lr_scheduler import * class SoftEntropy(nn.Module): def __init__(self): super(SoftEntropy, self).__init__() self.logsoftmax = nn.LogSoftmax(dim=1) def forward(self, inputs, targets): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn f...
ChienHsuan/MMT
SoftEntropy
false
13,478
[ "MIT" ]
425
fe4a559b8af3ec93242b24acb4c8e962a00a1248
https://github.com/ChienHsuan/MMT/tree/fe4a559b8af3ec93242b24acb4c8e962a00a1248
Accuracy
import torch import torch.nn as nn class Accuracy(nn.Module): """ This class implements the accuracy computation. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied """...
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...
ChristophReich1996/Cell-DETR
Accuracy
false
13,479
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
CustomConv2d
import torch import torch.nn as nn class CustomConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, bias=True, residual_init=True): super(CustomConv2d, self).__init__() self.residual_init = residual_init if padding is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ChiragCD/NR-GAN
CustomConv2d
false
13,480
[ "MIT" ]
54
fc455c6219b09bc8bf605715504b78b2bb801e48
https://github.com/ChiragCD/NR-GAN/tree/fc455c6219b09bc8bf605715504b78b2bb801e48
Relation
import torch import torch.utils.data import torch.nn as nn from torch.nn import functional as F class Relation(nn.Module): def __init__(self, C, H, out_size): super(Relation, self).__init__() self.out_size = out_size self.M = torch.nn.Parameter(torch.randn(H, H, out_size)) self.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 import torch.utils.data impor...
ChenZhannnnn/chenzhan
Relation
false
13,481
[ "Apache-2.0" ]
45
b26a9512bbd1efe86c35c91a625da40b6f94dfc7
https://github.com/ChenZhannnnn/chenzhan/tree/b26a9512bbd1efe86c35c91a625da40b6f94dfc7
TripletLoss
import torch from torch import nn import torch.nn.functional as F from torch.nn import * from torch.optim.lr_scheduler import * def _batch_hard(mat_distance, mat_similarity, indice=False): sorted_mat_distance, positive_indices = torch.sort(mat_distance + - 9999999.0 * (1 - mat_similarity), dim=1, descendi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ChienHsuan/MMT
TripletLoss
false
13,482
[ "MIT" ]
425
fe4a559b8af3ec93242b24acb4c8e962a00a1248
https://github.com/ChienHsuan/MMT/tree/fe4a559b8af3ec93242b24acb4c8e962a00a1248
MeanPoolConv
import torch import torch.nn as nn class CustomConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, bias=True, residual_init=True): super(CustomConv2d, self).__init__() self.residual_init = residual_init if padding is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ChiragCD/NR-GAN
MeanPoolConv
false
13,483
[ "MIT" ]
54
fc455c6219b09bc8bf605715504b78b2bb801e48
https://github.com/ChiragCD/NR-GAN/tree/fc455c6219b09bc8bf605715504b78b2bb801e48
Net
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 32, (3, 3)) self.pool1 = nn.MaxPool2d((2, 2)) self.conv2 = nn.Conv2d(32, 32, (3, 3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
CSCfi/machine-learning-scripts
Net
false
13,484
[ "MIT" ]
59
005f9343fb703ca2b6b11b5c2369e19efcaa5f62
https://github.com/CSCfi/machine-learning-scripts/tree/005f9343fb703ca2b6b11b5c2369e19efcaa5f62
UpSampleConv
import torch import torch.nn as nn class CustomConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, bias=True, residual_init=True): super(CustomConv2d, self).__init__() self.residual_init = residual_init if padding is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ChiragCD/NR-GAN
UpSampleConv
false
13,485
[ "MIT" ]
54
fc455c6219b09bc8bf605715504b78b2bb801e48
https://github.com/ChiragCD/NR-GAN/tree/fc455c6219b09bc8bf605715504b78b2bb801e48
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): """ This class implements the dice loss for multiple instances """ def __init__(self, smooth_factor: 'float'=1.0) ->None: super(DiceLoss, self).__init__() self.smooth_factor = smooth_factor def __repr__(self): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ChristophReich1996/Cell-DETR
DiceLoss
false
13,486
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
InstancesAccuracy
import torch import torch.nn as nn class InstancesAccuracy(nn.Module): """ This class implements the accuracy computation. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied ...
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...
ChristophReich1996/Cell-DETR
InstancesAccuracy
false
13,487
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
FocalLoss
import torch import torch.nn as nn class FocalLoss(nn.Module): """ This class implements the segmentation focal loss. https://arxiv.org/abs/1708.02002 """ def __init__(self, alpha: 'float'=0.25, gamma: 'float'=2.0) ->None: """ Constructor method :param alpha: (float) Alpha...
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 ...
ChristophReich1996/Cell-DETR
FocalLoss
false
13,488
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
Dice
import torch import torch.nn as nn class Dice(nn.Module): """ This class implements the dice score for validation. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied ""...
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...
ChristophReich1996/Cell-DETR
Dice
false
13,489
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
IoU
import torch import torch.nn as nn class IoU(nn.Module): """ This class implements the IoU for validation. Not gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied """ ...
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...
ChristophReich1996/Cell-DETR
IoU
false
13,490
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
ClassificationAccuracy
import torch import torch.nn as nn class ClassificationAccuracy(nn.Module): """ This class implements the classification accuracy computation. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Thresh...
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...
ChristophReich1996/Cell-DETR
ClassificationAccuracy
false
13,491
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
Attention
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.nn.init class Attention(nn.Module): def __init__(self, query_size, value_size, hid_size, init_range): super(Attention, self).__init__() self.value2hid = nn.Linear(value_size, hid_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....
Chenny0808/tatk
Attention
false
13,492
[ "Apache-2.0" ]
81
1c1a3cb557ba84bbfdbd1f6d8b8ea43ed8b9d7c5
https://github.com/Chenny0808/tatk/tree/1c1a3cb557ba84bbfdbd1f6d8b8ea43ed8b9d7c5
KeyValueAttention
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.nn.init class KeyValueAttention(nn.Module): def __init__(self, query_size, key_size, value_size, hid_size, init_range): super(KeyValueAttention, self).__init__() self.key2hid = nn.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....
Chenny0808/tatk
KeyValueAttention
false
13,493
[ "Apache-2.0" ]
81
1c1a3cb557ba84bbfdbd1f6d8b8ea43ed8b9d7c5
https://github.com/Chenny0808/tatk/tree/1c1a3cb557ba84bbfdbd1f6d8b8ea43ed8b9d7c5
TorchModule
import torch import torch.nn class TorchLinearModule(torch.nn.Module): def __init__(self, in_size, out_size): super(TorchLinearModule, self).__init__() self._linear = torch.nn.Linear(in_size, out_size) def forward(self, x): return self._linear(x) class TorchModule(torch.nn.Module):...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn ass...
Cher-B/ivy
TorchModule
false
13,494
[ "Apache-2.0" ]
161
95273172201071ebf7b83d56bb314450ebe41071
https://github.com/Cher-B/ivy/tree/95273172201071ebf7b83d56bb314450ebe41071
Recall
import torch import torch.nn as nn class Recall(nn.Module): """ This class implements the recall score. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied """ 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...
ChristophReich1996/Cell-DETR
Recall
false
13,495
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
Precision
import torch import torch.nn as nn class Precision(nn.Module): """ This class implements the precision score. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied """ ...
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...
ChristophReich1996/Cell-DETR
Precision
false
13,496
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
MIoU
import torch import torch.nn as nn class MIoU(nn.Module): """ This class implements the mean IoU for validation. Not gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied """...
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...
ChristophReich1996/Cell-DETR
MIoU
false
13,497
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
EncoderImage
import torch import numpy as np from collections import OrderedDict import torch.nn as nn def l2norm(X, dim=-1, eps=1e-08): """L2-normalize columns of X""" norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class EncoderImage(nn.Module): """ Build ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
Chris-cbc/SGRAF
EncoderImage
false
13,498
[ "Apache-2.0" ]
110
785535168ad417dda523888f2f047359231fcbf7
https://github.com/Chris-cbc/SGRAF/tree/785535168ad417dda523888f2f047359231fcbf7
Normalize
import torch from torch import nn import torch.nn.functional as F import torch.utils.data.distributed from torch.cuda.amp import autocast as autocast class Normalize(nn.Module): def __init__(self, p=2): super(Normalize, self).__init__() self.p = p def forward(self, x): return F.norma...
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 from torch import nn import ...
ChongjianGE/CARE
Normalize
false
13,499
[ "MIT" ]
57
3187afb0a2e56d40684bd5a83bf4eda145431e7b
https://github.com/ChongjianGE/CARE/tree/3187afb0a2e56d40684bd5a83bf4eda145431e7b
OptimizedResidualBlock
import torch import torch.nn as nn class CustomConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, bias=True, residual_init=True): super(CustomConv2d, self).__init__() self.residual_init = residual_init if padding is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ChiragCD/NR-GAN
OptimizedResidualBlock
false
13,500
[ "MIT" ]
54
fc455c6219b09bc8bf605715504b78b2bb801e48
https://github.com/ChiragCD/NR-GAN/tree/fc455c6219b09bc8bf605715504b78b2bb801e48
F1
import torch import torch.nn as nn class Recall(nn.Module): """ This class implements the recall score. No gradients supported. """ def __init__(self, threshold: 'float'=0.5) ->None: """ Constructor method :param threshold: (float) Threshold to be applied """ 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...
ChristophReich1996/Cell-DETR
F1
false
13,501
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
BlendLinear
import torch import torch.nn as nn import torch.utils.data class BlendLinear(nn.Module): def __init__(self, dim_in, dim_out, layer_type=nn.Linear, **unused_kwargs): super(BlendLinear, self).__init__() self._layer0 = layer_type(dim_in, dim_out) self._layer1 = layer_type(dim_in, dim_out) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
BlendLinear
false
13,502
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
ResidualBlock
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class ResidualBlock(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Chrisa142857/CompressAI
ResidualBlock
false
13,503
[ "Apache-2.0" ]
62
75760096b9700a58d346351251d544050f3418fb
https://github.com/Chrisa142857/CompressAI/tree/75760096b9700a58d346351251d544050f3418fb
ConcatSquashLinear
import torch import torch.nn as nn import torch.utils.data class ConcatSquashLinear(nn.Module): def __init__(self, dim_in, dim_out): super(ConcatSquashLinear, self).__init__() self._layer = nn.Linear(dim_in, dim_out) self._hyper_bias = nn.Linear(1, dim_out, bias=False) self._hyper...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
ConcatSquashLinear
false
13,504
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
FocalLossMultiClass
import torch import torch.nn as nn class FocalLossMultiClass(nn.Module): """ Implementation of the multi class focal loss. https://arxiv.org/abs/1708.02002 """ def __init__(self, alpha: 'float'=0.25, gamma: 'float'=2.0) ->None: """ Constructor method :param alpha: (float) ...
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 ...
ChristophReich1996/Cell-DETR
FocalLossMultiClass
false
13,505
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
ConcatConv2d
import torch import torch.nn as nn import torch.utils.data class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() module = nn.ConvTranspose2d if transpose else...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
ConcatConv2d
false
13,506
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
GraphReasoning
import torch import numpy as np import torch.nn as nn class GraphReasoning(nn.Module): """ Perform the similarity graph reasoning with a full-connected graph Args: - sim_emb: global and local alignments, shape: (batch_size, L+1, 256) Returns; - sim_sgr: reasoned graph nodes after several steps, 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....
Chris-cbc/SGRAF
GraphReasoning
false
13,507
[ "Apache-2.0" ]
110
785535168ad417dda523888f2f047359231fcbf7
https://github.com/Chris-cbc/SGRAF/tree/785535168ad417dda523888f2f047359231fcbf7
LayerScaling1d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class LayerScaling1d(nn.Module): """Scales inputs by the root of the second moment for groups. .. math:: y_g = \\frac{x_g}{\\sqrt{\\mathrm{E}[x_g^2] + \\epsil...
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.parallel import torch.optim import torch....
ClashLuke/online-normalization
LayerScaling1d
false
13,508
[ "BSD-3-Clause" ]
55
fe08b9f8e288d628eee4f9991e562cdb4f9e997b
https://github.com/ClashLuke/online-normalization/tree/fe08b9f8e288d628eee4f9991e562cdb4f9e997b
ConcatSquashConv2d
import torch import torch.nn as nn import torch.utils.data class ConcatSquashConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatSquashConv2d, self).__init__() module = nn.ConvTranspose2d if tr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
ConcatSquashConv2d
false
13,509
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
BlendConv2d
import torch import torch.nn as nn import torch.utils.data class BlendConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False, **unused_kwargs): super(BlendConv2d, self).__init__() module = nn.ConvTranspose2d if...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
BlendConv2d
false
13,510
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
ActivationClamp
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ActivationClamp(nn.Module): """Clips the output of CN. .. math:: y = clip(x, -clamp_value, clamp_value) Args: clamp_value: the value to which a...
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...
ClashLuke/online-normalization
ActivationClamp
false
13,511
[ "BSD-3-Clause" ]
55
fe08b9f8e288d628eee4f9991e562cdb4f9e997b
https://github.com/ClashLuke/online-normalization/tree/fe08b9f8e288d628eee4f9991e562cdb4f9e997b
ClippedLinearQuantization
import torch from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.onnx def linear_dequantize(input, scale_factor, inplace=False): if inplace: input.div_(scale_factor) return input return input / scale_fact...
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 from torch.optim.lr_schedule...
Chih-Ling-Hsu/distiller
ClippedLinearQuantization
false
13,512
[ "Apache-2.0" ]
94
33d1697298c6e3a7f7bfa615741fd0cda61d2794
https://github.com/Chih-Ling-Hsu/distiller/tree/33d1697298c6e3a7f7bfa615741fd0cda61d2794
MultiClassSegmentationLoss
import torch import torch.nn as nn from torch.autograd import Variable class DiceLoss(nn.Module): """ This class implements the dice loss for multiple instances """ def __init__(self, smooth_factor: 'float'=1.0) ->None: super(DiceLoss, self).__init__() self.smooth_factor = smooth_fact...
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 ...
ChristophReich1996/Cell-DETR
MultiClassSegmentationLoss
false
13,513
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
GatedConv
import torch import torch.nn as nn import torch.utils.data class GatedConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1): super(GatedConv, self).__init__() self.layer_f = nn.Conv2d(in_channels, out_channels, kernel_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
GatedConv
false
13,514
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
LayerScaling
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class LayerScaling(nn.Module): """Scales inputs by the root of the second moment for groups of channels. .. math:: y_g = \\frac{x_g}{\\sqrt{\\mathrm{E}[x_g^2]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.optim import torch....
ClashLuke/online-normalization
LayerScaling
false
13,515
[ "BSD-3-Clause" ]
55
fe08b9f8e288d628eee4f9991e562cdb4f9e997b
https://github.com/ClashLuke/online-normalization/tree/fe08b9f8e288d628eee4f9991e562cdb4f9e997b
HyperConv2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1 or classname.find('Conv') != -1: nn.init.constant_(m.weight, 0) nn.init.normal_(m.bias, 0, 0.01) class HyperConv2...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.utils.data as...
ClaraBing/ffjord
HyperConv2d
false
13,516
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
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...
CryhanFang/CLIP2Video
QuickGELU
false
13,517
[ "MIT" ]
113
e94131800a3a1434f6d00b89b7301d741db8ba06
https://github.com/CryhanFang/CLIP2Video/tree/e94131800a3a1434f6d00b89b7301d741db8ba06
Snake
import torch import torch.nn as nn class Snake(nn.Module): """ Implementation of the snake activation function as a torch nn module The result of the activation function a(x) is calculated by a(x) = x + sin^2(x) With alpha is a trainab """ def __init__(self, frequency=10): """Constructor...
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...
ComputationalRadiationPhysics/NeuralSolvers
Snake
false
13,518
[ "MIT" ]
59
cc62b5a91d9eb70ffafdcca6d1fbba16d3bf588d
https://github.com/ComputationalRadiationPhysics/NeuralSolvers/tree/cc62b5a91d9eb70ffafdcca6d1fbba16d3bf588d
PADEACTIVATION_Function_based
import torch import numpy as np import torch.nn as nn from numpy.random.mtrand import RandomState def get_constants_for_inits(name, seed=17): if name == 'pade_sigmoid_3': return (1 / 2, 1 / 4, 1 / 20, 1 / 240), (0.0, 1 / 10), (0,) elif name == 'pade_sigmoid_5': return (1 / 2, 1 / 4, 17 / 336, ...
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 numpy as np import torch.nn as nn from numpy.random.mtrand import ...
ChristophReich1996/Cell-DETR
PADEACTIVATION_Function_based
false
13,519
[ "MIT" ]
55
4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
https://github.com/ChristophReich1996/Cell-DETR/tree/4d0c3a2d3ffd19184c8443e5b3a6dccc053c77ea
GatedConvTranspose
import torch import torch.nn as nn import torch.utils.data class GatedConvTranspose(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, groups=1): super(GatedConvTranspose, self).__init__() self.layer_f = nn.ConvTranspose2d(in_chan...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
GatedConvTranspose
false
13,520
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
GatedLinear
import torch import torch.nn as nn import torch.utils.data class GatedLinear(nn.Module): def __init__(self, in_features, out_features): super(GatedLinear, self).__init__() self.layer_f = nn.Linear(in_features, out_features) self.layer_g = nn.Linear(in_features, out_features) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ClaraBing/ffjord
GatedLinear
false
13,521
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
BasicBlock
import torch import torch.nn as nn import torch.utils.data class BasicBlock(nn.Module): expansion = 1 def __init__(self, dim): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1, bias=False) self.bn1 = nn.GroupNorm(2, dim, eps=0.0001) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ClaraBing/ffjord
BasicBlock
false
13,522
[ "MIT" ]
518
a97c34ff546a063316828f53bd041555e663428d
https://github.com/ClaraBing/ffjord/tree/a97c34ff546a063316828f53bd041555e663428d
ConvModule
import torch import warnings import torch.nn as nn def kaiming_init(module, mode='fan_out', nonlinearity='relu', bias=0, distribution='normal'): assert distribution in ['uniform', 'normal'] if distribution == 'uniform': nn.init.kaiming_uniform_(module.weight, mode=mode, nonlinearity= n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import warnings import torch....
CrazySherman/mmdetection
ConvModule
false
13,523
[ "Apache-2.0" ]
82
3ba66ef0d377086996d2765f1cec3aa3577039aa
https://github.com/CrazySherman/mmdetection/tree/3ba66ef0d377086996d2765f1cec3aa3577039aa
PriorDiscriminator
import torch import torch.nn.functional as F import torch.nn as nn class PriorDiscriminator(nn.Module): def __init__(self, input_dim): super().__init__() self.l0 = nn.Linear(input_dim, input_dim) self.l1 = nn.Linear(input_dim, input_dim) self.l2 = nn.Linear(input_dim, 1) def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Crazy-Jack/HCL
PriorDiscriminator
false
13,524
[ "MIT" ]
275
dd2aae0c525859c8498205a791058287f86ab111
https://github.com/Crazy-Jack/HCL/tree/dd2aae0c525859c8498205a791058287f86ab111
ArgsNet
import torch import torch.nn as nn import torch.nn.functional as F class ArgsNet(nn.Module): def __init__(self, input_size, hidden_size): super(ArgsNet, self).__init__() self.hidden_size = hidden_size self.input_size = input_size self.gru = nn.GRUCell(self.input_size, self.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 import triton_helpers import torch.nn as nn assert_...
ConstantinHvber/ilf
ArgsNet
false
13,525
[ "Apache-2.0" ]
84
b706f81191508998d443c1c89e8d10028ce4e5d8
https://github.com/ConstantinHvber/ilf/tree/b706f81191508998d443c1c89e8d10028ce4e5d8
_BoundaryRefineModule
import torch from torch import nn class _BoundaryRefineModule(nn.Module): def __init__(self, dim): super(_BoundaryRefineModule, self).__init__() self.relu = nn.ReLU(inplace=True) self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1) self.conv2 = nn.Conv2d(dim, dim, 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._inductor.runtime import triton_helpers from torch import nn assert_s...
CuthbertCai/pytorch-semantic-segmentation
_BoundaryRefineModule
false
13,526
[ "MIT" ]
1,328
aa2a47b73c1aa14555e1421e2366275254ea5376
https://github.com/CuthbertCai/pytorch-semantic-segmentation/tree/aa2a47b73c1aa14555e1421e2366275254ea5376
CrossEn
import torch from torch import nn import torch.nn.functional as F class CrossEn(nn.Module): """cross entroy loss""" def __init__(self): super(CrossEn, self).__init__() def forward(self, sim_matrix): logpt = F.log_softmax(sim_matrix, dim=-1) logpt = torch.diag(logpt) nce_l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
CryhanFang/CLIP2Video
CrossEn
false
13,527
[ "MIT" ]
113
e94131800a3a1434f6d00b89b7301d741db8ba06
https://github.com/CryhanFang/CLIP2Video/tree/e94131800a3a1434f6d00b89b7301d741db8ba06
Unfold
import torch class Unfold(torch.nn.Module): """Module for unfolding tensor. Performs strided crops on 2d (image) tensors. Stride is assumed to be half the crop size. """ def __init__(self, img_size, fold_size): """ Args: img_size: Input size. fold_size: Crop...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda reinterpret...
Crazy-Jack/HCL
Unfold
false
13,528
[ "MIT" ]
275
dd2aae0c525859c8498205a791058287f86ab111
https://github.com/Crazy-Jack/HCL/tree/dd2aae0c525859c8498205a791058287f86ab111
Vgg16
import torch import torch.nn as nn import torch.nn.functional as F class Vgg16(nn.Module): def __init__(self): super(Vgg16, self).__init__() self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1) 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_...
Boyiliee/PONO
Vgg16
false
13,529
[ "MIT" ]
133
b9108e8bf8ba0228635532ba5bdc973b7393d045
https://github.com/Boyiliee/PONO/tree/b9108e8bf8ba0228635532ba5bdc973b7393d045
ImgLayerNorm
from torch.nn import Module import torch import torch.nn import torch.utils.data class ImgLayerNorm(Module): """ LayerNorm for images with channel axis 1 (this is necessary because PyTorch's LayerNorm operates on the last axis) """ def __init__(self, in_dim, eps=1e-05): super().__init__()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module import torch.nn import torch.utils.data assert_size...
CrhistyanSilva/localbitsback
ImgLayerNorm
false
13,530
[ "MIT" ]
100
bdf66b41b2120c5b35edac4e4efda0fda3f2db4d
https://github.com/CrhistyanSilva/localbitsback/tree/bdf66b41b2120c5b35edac4e4efda0fda3f2db4d
L1Loss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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...
CvlabAssignment/AlignPS
L1Loss
false
13,531
[ "Apache-2.0" ]
144
297f4166921d2095f9381e38e04129a103069406
https://github.com/CvlabAssignment/AlignPS/tree/297f4166921d2095f9381e38e04129a103069406
Fusion
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Fusion(nn.Module): """ Crazy multi-modal fusion: negative squared difference minus relu'd sum """ def __init__(self): super().__init__() def forward(self, x, y): return -(x - y) ** 2 + F....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
Cyanogenoid/vqa-counting
Fusion
false
13,532
[ "MIT" ]
205
4042b1295ae2f648670e8c1baef8581be0346da2
https://github.com/Cyanogenoid/vqa-counting/tree/4042b1295ae2f648670e8c1baef8581be0346da2
KLDLoss
import torch import torch.nn as nn class KLDLoss(nn.Module): def forward(self, mu, logvar): return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
DaShi-Git/simsg
KLDLoss
false
13,533
[ "Apache-2.0" ]
58
31df608cd04facb2b8b546cc6f53d84716117bdf
https://github.com/DaShi-Git/simsg/tree/31df608cd04facb2b8b546cc6f53d84716117bdf
HGNN_conv
import math import torch from torch import nn from torch.nn.parameter import Parameter class HGNN_conv(nn.Module): def __init__(self, in_ft, out_ft, bias=True): super(HGNN_conv, self).__init__() self.weight = Parameter(torch.Tensor(in_ft, out_ft)) if bias: self.bias = Paramete...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch.nn.parameter import Parameter assert...
DCMMC/HGNN
HGNN_conv
false
13,534
[ "MIT" ]
124
4315f27faaffb8f2cf1463049a4dc596694e44e1
https://github.com/DCMMC/HGNN/tree/4315f27faaffb8f2cf1463049a4dc596694e44e1
GaussianFocalLoss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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...
CvlabAssignment/AlignPS
GaussianFocalLoss
false
13,535
[ "Apache-2.0" ]
144
297f4166921d2095f9381e38e04129a103069406
https://github.com/CvlabAssignment/AlignPS/tree/297f4166921d2095f9381e38e04129a103069406
GlobalAvgPool
import torch import torch.nn as nn class GlobalAvgPool(nn.Module): def forward(self, x): N, C = x.size(0), x.size(1) return x.view(N, C, -1).mean(dim=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...
DaShi-Git/simsg
GlobalAvgPool
false
13,536
[ "Apache-2.0" ]
58
31df608cd04facb2b8b546cc6f53d84716117bdf
https://github.com/DaShi-Git/simsg/tree/31df608cd04facb2b8b546cc6f53d84716117bdf
EmbedGCN
from torch.nn import Module import math import torch import torch.nn as nn import torch.nn.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 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
ConstantinHvber/ilf
EmbedGCN
false
13,537
[ "Apache-2.0" ]
84
b706f81191508998d443c1c89e8d10028ce4e5d8
https://github.com/ConstantinHvber/ilf/tree/b706f81191508998d443c1c89e8d10028ce4e5d8
DiceLoss
import functools import torch import numpy as np import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "...
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...
CuttlefishXuan/mmsegmentation-1
DiceLoss
false
13,538
[ "Apache-2.0" ]
789
13771312da1a66d5cd642df6aa370affd3f5ceac
https://github.com/CuttlefishXuan/mmsegmentation-1/tree/13771312da1a66d5cd642df6aa370affd3f5ceac
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_...
CraigWang1/EfficientDet-PyTorch
RegressionModel
false
13,539
[ "Apache-2.0" ]
66
531d3c83338f03aa5c6f0615839c0ea5c03025f6
https://github.com/CraigWang1/EfficientDet-PyTorch/tree/531d3c83338f03aa5c6f0615839c0ea5c03025f6
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, input, target): smooth = 1e-05 input = input.float() target = target.float() iflat = input.view(-1) tflat = target.view(-1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DIAL-RPI/PIPO-FAN
DiceLoss
false
13,540
[ "MIT" ]
53
126c17fbdc4c62806a9d249be355542f3990f305
https://github.com/DIAL-RPI/PIPO-FAN/tree/126c17fbdc4c62806a9d249be355542f3990f305
BasicNN
import torch import numpy as np from torch import nn from torch.autograd import Variable import torch.nn.functional as F class BasicNN(nn.Module): def __init__(self): super(BasicNN, self).__init__() self.net = nn.Linear(28 * 28, 2) def forward(self, x): if isinstance(x, np.ndarray): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DNCoelho/clipper
BasicNN
false
13,541
[ "Apache-2.0" ]
1,403
0144078c9da757ee319d60b362d9f51538657ca8
https://github.com/DNCoelho/clipper/tree/0144078c9da757ee319d60b362d9f51538657ca8
Simplenet
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.onnx class Simplenet(nn.Module): def __init__(self): super(Simplenet, self).__init__() self.conv1 = 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.optim.lr_scheduler...
Chih-Ling-Hsu/distiller
Simplenet
false
13,543
[ "Apache-2.0" ]
94
33d1697298c6e3a7f7bfa615741fd0cda61d2794
https://github.com/Chih-Ling-Hsu/distiller/tree/33d1697298c6e3a7f7bfa615741fd0cda61d2794
Conv2dSamePadding
import torch from torch import nn import torch.nn.functional as F def conv2d_same_padding(input, weight, bias=None, stride=1, dilation=1, groups=1): input_rows = input.size(2) filter_rows = weight.size(2) effective_filter_size_rows = (filter_rows - 1) * dilation[0] + 1 out_rows = (input_rows + str...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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.nn.functional as F assert_size_stride = torch....
DaikiOnodera/pycrop-yield-prediction
Conv2dSamePadding
false
13,544
[ "MIT" ]
93
335685d3aa6e609161737453c090f5c41b769213
https://github.com/DaikiOnodera/pycrop-yield-prediction/tree/335685d3aa6e609161737453c090f5c41b769213
HGNN_embedding
import math import torch from torch import nn import torch.nn.functional as F from torch.nn.parameter import Parameter class HGNN_conv(nn.Module): def __init__(self, in_ft, out_ft, bias=True): super(HGNN_conv, self).__init__() self.weight = Parameter(torch.Tensor(in_ft, out_ft)) if bias: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math from torch import...
DCMMC/HGNN
HGNN_embedding
false
13,545
[ "MIT" ]
124
4315f27faaffb8f2cf1463049a4dc596694e44e1
https://github.com/DCMMC/HGNN/tree/4315f27faaffb8f2cf1463049a4dc596694e44e1
DenseResidualBlock
import torch import torch.nn as nn class DenseResidualBlock(nn.Module): """ Wrapping a number of residual layers for residual block. Will be used as building block in FiLM hyper-networks. :param in_size: (int) Number of features for input representation. :param out_size: (int) Number of features for o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
DaikiSannoXC/simple-cnaps
DenseResidualBlock
false
13,546
[ "MIT" ]
62
be35c4522b180eaae8278633b1c6ca7e5bb56ebb
https://github.com/DaikiSannoXC/simple-cnaps/tree/be35c4522b180eaae8278633b1c6ca7e5bb56ebb
AvgPoolPad
import torch import torch.nn as nn class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=False) def forwa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Danish-VSL/deep-person-reid
AvgPoolPad
false
13,547
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
CPUForgetMult
import torch import torch.utils.data import torch.backends.cudnn import torch.nn from itertools import * class CPUForgetMult(torch.nn.Module): def __init__(self): super(CPUForgetMult, self).__init__() def forward(self, f, x, hidden_init=None): result = [] forgets = f.split(1, dim=0) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.backends.cudnn import torch.nn from itertools import * assert_size_stride = torch._C._dynamo.guards.ass...
DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
CPUForgetMult
false
13,548
[ "Apache-2.0" ]
3,266
7adab3877fc1d3f1d5f57e6c1743dae8f76f72c5
https://github.com/DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/tree/7adab3877fc1d3f1d5f57e6c1743dae8f76f72c5
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...
Dai-z/pytorch-superpoint
SpaceToDepth
false
13,549
[ "MIT" ]
390
90e71045238fdcce13f9f0d02bdd0e1126145a10
https://github.com/Dai-z/pytorch-superpoint/tree/90e71045238fdcce13f9f0d02bdd0e1126145a10
TSA_Fusion
import torch import torch.nn as nn import torch.nn.functional as F from torch.functional import F from torch.nn import functional as F class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
CM-BF/FeatureFlow
TSA_Fusion
false
13,550
[ "MIT" ]
161
06642697922f17211e5faa353e24b1a0946885b1
https://github.com/CM-BF/FeatureFlow/tree/06642697922f17211e5faa353e24b1a0946885b1
HardAttn
import torch import torch.nn as nn import torch.nn.functional as F class HardAttn(nn.Module): """Hard Attention (Sec. 3.1.II)""" def __init__(self, in_channels): super(HardAttn, self).__init__() self.fc = nn.Linear(in_channels, 4 * 2) self.init_params() def init_params(self): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Danish-VSL/deep-person-reid
HardAttn
false
13,551
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
Discriminator
import torch import torch.nn as nn def global_pooling(input, pooling='mean'): if pooling == 'mean': return input.mean(3).mean(2) elif pooling == 'sum': return input.sum(3).sum(2) else: raise NotImplementedError() class CustomConv2d(nn.Module): def __init__(self, in_channels,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ChiragCD/NR-GAN
Discriminator
false
13,552
[ "MIT" ]
54
fc455c6219b09bc8bf605715504b78b2bb801e48
https://github.com/ChiragCD/NR-GAN/tree/fc455c6219b09bc8bf605715504b78b2bb801e48
CosineClassifier
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter class CosineClassifier(Module): def __init__(self, in_features, n_classes, sigma=True): super(CosineClassifier, self).__init__() self.in_features = in_features 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._inductor.runtime....
Danden1/DER-ClassIL.pytorch
CosineClassifier
false
13,553
[ "MIT" ]
79
66ccdb45890d3da335f4dcb841160cbea8719c15
https://github.com/Danden1/DER-ClassIL.pytorch/tree/66ccdb45890d3da335f4dcb841160cbea8719c15
SimpleDropoutOptimizer
import torch import torch.nn as nn class SimpleDropoutOptimizer(nn.Module): def __init__(self, p): super().__init__() if p is not None: self.dropout = nn.Dropout(p=p) else: self.dropout = None def forward(self, x): if self.dropout is not None: ...
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...
Danish-VSL/deep-person-reid
SimpleDropoutOptimizer
false
13,554
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
DenseResidualLayer
import torch import torch.nn as nn class DenseResidualLayer(nn.Module): """ PyTorch like layer for standard linear layer with identity residual connection. :param num_features: (int) Number of input / output units for the layer. """ def __init__(self, num_features): super(DenseResidualLay...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
DaikiSannoXC/simple-cnaps
DenseResidualLayer
false
13,555
[ "MIT" ]
62
be35c4522b180eaae8278633b1c6ca7e5bb56ebb
https://github.com/DaikiSannoXC/simple-cnaps/tree/be35c4522b180eaae8278633b1c6ca7e5bb56ebb
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): def forward(self, query, key, value, mask=None): dk = query.size()[-1] scores = query.matmul(key.transpose(-2, -1)) / math.sqrt(dk) if mask is not None: s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
CyberZHG/torch-multi-head-attention
MultiHeadAttention
false
13,556
[ "MIT" ]
93
66f6ae801a6d2aea8994ef00af06fdfc67ec2026
https://github.com/CyberZHG/torch-multi-head-attention/tree/66f6ae801a6d2aea8994ef00af06fdfc67ec2026
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...
Danish-VSL/deep-person-reid
BinaryFocalLossWithLogits
false
13,557
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
HingeLoss
import torch import torch.nn as nn import torch.nn.functional as F class HingeLoss(nn.Module): """criterion for loss function y: 0/1 ground truth matrix of size: batch_size x output_size f: real number pred matrix of size: batch_size x output_size """ def __init__(self, margin=1.0, squared=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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DarshanPatel11/X-Transformer
HingeLoss
false
13,558
[ "BSD-3-Clause" ]
120
ee4436a5514b85692c3fb6a594f2e4ac3e8f7c6b
https://github.com/DarshanPatel11/X-Transformer/tree/ee4436a5514b85692c3fb6a594f2e4ac3e8f7c6b
GlobalAveragePool
import torch from torch import nn import torch.onnx class GlobalAveragePool(nn.Module): def forward(self, input: 'torch.Tensor'): spatial_shape = input.ndimension() - 2 dim = tuple(range(spatial_shape, spatial_shape + 2)) return torch.mean(input, dim=dim, keepdim=True) def get_inputs():...
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.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
Creation-Labs-AI/onnx2pytorch
GlobalAveragePool
false
13,559
[ "Apache-2.0" ]
147
eaf70c6b75009efa7d07c6042a62f336194c4786
https://github.com/Creation-Labs-AI/onnx2pytorch/tree/eaf70c6b75009efa7d07c6042a62f336194c4786
Classify
import torch import torch.nn as nn def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class Flatten(nn.Module): @staticmethod def forward(x): return x.view(x.size(0), -1) class Classify(nn.Module): def __init__(self, c1,...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
DataXujing/yolov5_prune
Classify
false
13,560
[ "Apache-2.0" ]
298
3a6a717b96131d484fe24c0ddbb1bce74ba117f2
https://github.com/DataXujing/yolov5_prune/tree/3a6a717b96131d484fe24c0ddbb1bce74ba117f2
Gather
import torch from torch import nn import torch.onnx class Gather(nn.Module): def __init__(self, dim=0): self.dim = dim self.selection = [slice(None) for _ in range(dim)] super().__init__() def forward(self, input: 'torch.Tensor', indices: 'torch.Tensor'): selection = self.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 import nn import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
Creation-Labs-AI/onnx2pytorch
Gather
false
13,561
[ "Apache-2.0" ]
147
eaf70c6b75009efa7d07c6042a62f336194c4786
https://github.com/Creation-Labs-AI/onnx2pytorch/tree/eaf70c6b75009efa7d07c6042a62f336194c4786
Fire
import torch import torch.nn as nn class Fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand1x1_planes, expand3x3_planes): super(Fire, self).__init__() self.inplanes = inplanes self.squeeze = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1) self.squeeze_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Danish-VSL/deep-person-reid
Fire
false
13,562
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
DownsampleA
import torch import torch.nn as nn class DownsampleA(nn.Module): def __init__(self, nIn, nOut, stride): super(DownsampleA, self).__init__() assert stride == 2 self.avg = nn.AvgPool2d(kernel_size=1, stride=stride) def forward(self, x): x = self.avg(x) return torch.cat(...
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...
Danden1/DER-ClassIL.pytorch
DownsampleA
false
13,563
[ "MIT" ]
79
66ccdb45890d3da335f4dcb841160cbea8719c15
https://github.com/Danden1/DER-ClassIL.pytorch/tree/66ccdb45890d3da335f4dcb841160cbea8719c15
MaxPoolPad
import torch import torch.nn as nn class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) x = self.pool(x) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Danish-VSL/deep-person-reid
MaxPoolPad
false
13,564
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
PcamPool
import torch from torch import nn class PcamPool(nn.Module): def __init__(self): super(PcamPool, self).__init__() def forward(self, feat_map, logit_map): assert logit_map is not None prob_map = torch.sigmoid(logit_map) weight_map = prob_map / prob_map.sum(dim=2, keepdim=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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
DavidChenL/Chexpert
PcamPool
false
13,565
[ "Apache-2.0" ]
202
0300057d3a51301cff35a65f79729436678b4a79
https://github.com/DavidChenL/Chexpert/tree/0300057d3a51301cff35a65f79729436678b4a79
SEModule
import torch import torch.nn as nn class SEModule(nn.Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, padding=0) self.relu = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Danish-VSL/deep-person-reid
SEModule
false
13,566
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93
ClassificationModel
import torch import torch.nn as nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
CraigWang1/EfficientDet-PyTorch
ClassificationModel
false
13,567
[ "Apache-2.0" ]
66
531d3c83338f03aa5c6f0615839c0ea5c03025f6
https://github.com/CraigWang1/EfficientDet-PyTorch/tree/531d3c83338f03aa5c6f0615839c0ea5c03025f6
VarianceNorm2d
import torch import torch.nn as nn class VarianceNorm2d(nn.Module): def __init__(self, num_features, bias=False): super().__init__() self.num_features = num_features self.bias = bias self.alpha = nn.Parameter(torch.zeros(num_features)) self.alpha.data.normal_(1, 0.02) ...
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_...
DeepTitan/PNDM
VarianceNorm2d
false
13,568
[ "Apache-2.0" ]
61
4037a4f40011c9a0d47b92303e64d47fcc7ed56a
https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a
LogSumExpPool
import torch from torch import nn class LogSumExpPool(nn.Module): def __init__(self, gamma): super(LogSumExpPool, self).__init__() self.gamma = gamma def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Te...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
DavidChenL/Chexpert
LogSumExpPool
false
13,569
[ "Apache-2.0" ]
202
0300057d3a51301cff35a65f79729436678b4a79
https://github.com/DavidChenL/Chexpert/tree/0300057d3a51301cff35a65f79729436678b4a79
ExpPool
import torch from torch import nn class ExpPool(nn.Module): def __init__(self): super(ExpPool, self).__init__() def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
DavidChenL/Chexpert
ExpPool
false
13,570
[ "Apache-2.0" ]
202
0300057d3a51301cff35a65f79729436678b4a79
https://github.com/DavidChenL/Chexpert/tree/0300057d3a51301cff35a65f79729436678b4a79
RingLoss
import torch import warnings import torch.nn as nn class RingLoss(nn.Module): """Ring loss. Reference: Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018. """ def __init__(self): super(RingLoss, self).__init__() warnings.warn('This method is ...
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 warnings import torch.nn as nn assert_size_stride = torch._C._dynamo.gua...
Danish-VSL/deep-person-reid
RingLoss
false
13,571
[ "MIT" ]
244
2e3a4b6706b84c77203f9905683b917ab0871b93
https://github.com/Danish-VSL/deep-person-reid/tree/2e3a4b6706b84c77203f9905683b917ab0871b93