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
NoiseInjection
import torch from torch import nn class NoiseInjection(nn.Module): def __init__(self): super().__init__() self.weight = nn.Parameter(torch.zeros(1)) def forward(self, image, noise=None): if noise is None: batch, _, height, width = image.shape noise = image.new...
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...
ArashVahabpour/encoder4editing-contrastive
NoiseInjection
false
13,271
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
SemanticComposite
import torch import torch.nn as nn class SemanticComposite(nn.Module): """ SemanticComposite module. Apply a self-attention layer and a semantic composite fuse gate to compute the encoding result of one tensor. :param in_features: Feature size of input. :param dropout_rate: The dropout rate....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ambitioner-c/MatchZoo-py
SemanticComposite
false
13,272
[ "Apache-2.0" ]
468
bb088edce8e01c2c2326ca1a8ac647f0d23f088d
https://github.com/Ambitioner-c/MatchZoo-py/tree/bb088edce8e01c2c2326ca1a8ac647f0d23f088d
MatchingTensor
import torch import torch.nn as nn import torch.nn.functional as F class MatchingTensor(nn.Module): """ Module that captures the basic interactions between two tensors. :param matching_dims: Word dimension of two interaction texts. :param channels: Number of word interaction tensor channels. :par...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ambitioner-c/MatchZoo-py
MatchingTensor
false
13,273
[ "Apache-2.0" ]
468
bb088edce8e01c2c2326ca1a8ac647f0d23f088d
https://github.com/Ambitioner-c/MatchZoo-py/tree/bb088edce8e01c2c2326ca1a8ac647f0d23f088d
EqualLinear
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) class FusedLeakyReLUFunctionBackward(Function): @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.autograd import Function import math from torch import nn assert_size...
ArashVahabpour/encoder4editing-contrastive
EqualLinear
false
13,274
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
MatchModule
import torch import torch.nn as nn import torch.nn.functional as F class MatchModule(nn.Module): """ Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> impo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Ambitioner-c/MatchZoo-py
MatchModule
false
13,275
[ "Apache-2.0" ]
468
bb088edce8e01c2c2326ca1a8ac647f0d23f088d
https://github.com/Ambitioner-c/MatchZoo-py/tree/bb088edce8e01c2c2326ca1a8ac647f0d23f088d
QKVAttentionLegacy
import math import torch import numpy as np import torch as th import torch.nn as nn def count_flops_attn(model, _x, y): """ A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.profile( model, 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._inductor.runtime....
AranKomat/Diff-DALLE
QKVAttentionLegacy
false
13,276
[ "MIT" ]
53
9418e98e97b599c5c65f16ee168fedf76a29095f
https://github.com/AranKomat/Diff-DALLE/tree/9418e98e97b599c5c65f16ee168fedf76a29095f
Greedy
import torch import torch.nn as nn class Greedy(nn.Module): def __init__(self): super().__init__() def forward(self, log_p): return torch.argmax(log_p, dim=1).long() 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...
ArChiiii/TSP_DRL_PtrNet
Greedy
false
13,277
[ "MIT" ]
59
8218a508c563d9641b341dff5a6241d90e4e031b
https://github.com/ArChiiii/TSP_DRL_PtrNet/tree/8218a508c563d9641b341dff5a6241d90e4e031b
CentralizedCritic
import torch import torch.nn as nn import torch.nn.functional as F class CentralizedCritic(nn.Module): def __init__(self, obs_dim, action_dim): super(CentralizedCritic, self).__init__() self.obs_dim = obs_dim self.action_dim = action_dim self.linear1 = nn.Linear(self.obs_dim, 1024...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
AYUSHKABIRVERMA/Multi-agent-reinforcement-learning
CentralizedCritic
false
13,278
[ "MIT" ]
62
cd7c13d723cd74dc278939d81d5dd1b0906cee7c
https://github.com/AYUSHKABIRVERMA/Multi-agent-reinforcement-learning/tree/cd7c13d723cd74dc278939d81d5dd1b0906cee7c
PixelNorm
import torch from torch import nn class PixelNorm(nn.Module): def __init__(self): super().__init__() def forward(self, input): return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim= True) + 1e-08) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ArashVahabpour/encoder4editing-contrastive
PixelNorm
false
13,279
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
BCELoss2d
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data class BCELoss2d(nn.Module): """ Binary Cross Entropy loss function """ def __init__(self): super(BCELoss2d, self).__init__() self.bce_loss = nn.BCEWithLogitsLoss() def forward(self, logits, lab...
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...
ArmenGhambaryan/kaggle_carvana_segmentation
BCELoss2d
false
13,280
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
Downsample
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
AranKomat/Diff-DALLE
Downsample
false
13,281
[ "MIT" ]
53
9418e98e97b599c5c65f16ee168fedf76a29095f
https://github.com/AranKomat/Diff-DALLE/tree/9418e98e97b599c5c65f16ee168fedf76a29095f
EqualConv2d
import math import torch from torch import nn import torch.nn.functional as F class EqualConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True): super().__init__() self.weight = nn.Parameter(torch.randn(out_channel, in_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 import math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
ArashVahabpour/encoder4editing-contrastive
EqualConv2d
false
13,282
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
GeLU2
import torch import torch.nn as nn class GeLU2(nn.Module): def forward(self, x): return (1.702 * x).sigmoid() * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
AshBT/VideoGPT
GeLU2
false
13,283
[ "MIT" ]
396
a823bc734af3387129f3bd624caad3db270707f2
https://github.com/AshBT/VideoGPT/tree/a823bc734af3387129f3bd624caad3db270707f2
Upsample
import torch import torch.nn as nn import torch.nn.functional as F def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AranKomat/Diff-DALLE
Upsample
false
13,284
[ "MIT" ]
53
9418e98e97b599c5c65f16ee168fedf76a29095f
https://github.com/AranKomat/Diff-DALLE/tree/9418e98e97b599c5c65f16ee168fedf76a29095f
SpectrogramMasker
import torch import torch.nn as nn import torch.nn.functional as F class SpectrogramMasker(nn.Module): """ Helper class transforming wave-level mask to spectrogram-level mask """ def __init__(self, win_length: 'int', hop_length: 'int'): super().__init__() self.win_length = win_length ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AppleHolic/pytorch_sound
SpectrogramMasker
false
13,285
[ "BSD-2-Clause" ]
86
2320516d21d70c406d1dee74927e238972c96106
https://github.com/AppleHolic/pytorch_sound/tree/2320516d21d70c406d1dee74927e238972c96106
TransformerFFN
import math import torch import torch.nn as nn import torch.nn.functional as F def Linear(in_features, out_features, bias=True): m = nn.Linear(in_features, out_features, bias) return m def gelu(x): """ GELU activation https://arxiv.org/abs/1606.08415 https://github.com/huggingface/pytorch-op...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
AlexShypula/CodeGen
TransformerFFN
false
13,286
[ "MIT" ]
241
2e5f8090c4369fd3f0ebec4a867503edc1362d5d
https://github.com/AlexShypula/CodeGen/tree/2e5f8090c4369fd3f0ebec4a867503edc1362d5d
SEModule
from torch.nn import Module import torch from torch.nn import Conv2d from torch.nn import ReLU from torch.nn import Sigmoid from torch.nn import AdaptiveAvgPool2d class SEModule(Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() self.avg_pool = AdaptiveAvgPool2d(1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module f...
ArashVahabpour/encoder4editing-contrastive
SEModule
false
13,287
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
Conv3BN
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Conv3BN(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) 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.triton_helpers import libdevice import torch.nn as ...
ArmenGhambaryan/kaggle_carvana_segmentation
Conv3BN
false
13,288
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
LayerNorm32
import torch import torch.nn as nn class LayerNorm32(nn.LayerNorm): def forward(self, x): return super().forward(x.float().transpose(1, 2)).type(x.dtype ).transpose(1, 2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'normalized_shape': 4}...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AranKomat/Diff-DALLE
LayerNorm32
false
13,289
[ "MIT" ]
53
9418e98e97b599c5c65f16ee168fedf76a29095f
https://github.com/AranKomat/Diff-DALLE/tree/9418e98e97b599c5c65f16ee168fedf76a29095f
BCEDiceLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data def dice_loss(preds, trues, weight=None, is_average=True): num = preds.size(0) preds = preds.view(num, -1) trues = trues.view(num, -1) if weight is not None: w = torch.autogra...
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...
ArmenGhambaryan/kaggle_carvana_segmentation
BCEDiceLoss
false
13,290
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
DiceLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data def dice_loss(preds, trues, weight=None, is_average=True): num = preds.size(0) preds = preds.view(num, -1) trues = trues.view(num, -1) if weight is not None: w = torch.autogra...
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.backends.cudnn import torch.utils.data assert_size_str...
ArmenGhambaryan/kaggle_carvana_segmentation
DiceLoss
false
13,291
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
DiceScore
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class DiceScore(nn.Module): def __init__(self, threshold=0.5): super(DiceScore, self).__init__() self.threshold = threshold def forward(self, logits, labels): probs ...
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.backends.cudnn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
ArmenGhambaryan/kaggle_carvana_segmentation
DiceScore
false
13,292
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
Expand
import torch import torch.nn as nn import torch.utils.data class Expand(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, s, s, C // s ** 2, H, W) x = x.permute(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.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Arui66/FPSAutomaticAiming
Expand
false
13,293
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
Hardswish
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Hardswish(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
Arui66/FPSAutomaticAiming
Hardswish
false
13,294
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
MemoryEfficientMish
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class MemoryEfficientMish(nn.Module): class F(torch.autograd.Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) return x.mul(torch.tanh(F.softplus(x))) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.nn.functional as F import t...
Arui66/FPSAutomaticAiming
MemoryEfficientMish
false
13,295
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
UNetModule
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Conv3BN(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) 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.triton_helpers import libdevice import torch.nn as ...
ArmenGhambaryan/kaggle_carvana_segmentation
UNetModule
false
13,296
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
WeightedSoftDiceLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class WeightedSoftDiceLoss(nn.Module): def __init__(self): super(WeightedSoftDiceLoss, self).__init__() def forward(self, logits, labels, weights): probs = F.sigmoid(logits)...
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.backends.cudnn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
ArmenGhambaryan/kaggle_carvana_segmentation
WeightedSoftDiceLoss
false
13,297
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
WeightedBCELoss2d
import torch import torch.nn as nn import torch.backends.cudnn import torch.utils.data class WeightedBCELoss2d(nn.Module): def __init__(self): super(WeightedBCELoss2d, self).__init__() def forward(self, logits, labels, weights): w = weights.view(-1) logits = logits.view(-1) g...
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 ...
ArmenGhambaryan/kaggle_carvana_segmentation
WeightedBCELoss2d
false
13,298
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
SoftDiceLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch.backends.cudnn import torch.utils.data class SoftDiceLoss(nn.Module): def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, labels): probs = F.sigmoid(logits) num = labels.siz...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.backends.cudnn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
ArmenGhambaryan/kaggle_carvana_segmentation
SoftDiceLoss
false
13,299
[ "MIT" ]
447
648a6b5c807cb69011316fe6501241dacc027db2
https://github.com/ArmenGhambaryan/kaggle_carvana_segmentation/tree/648a6b5c807cb69011316fe6501241dacc027db2
LocationLayer
import torch import torch.utils.data from torch import nn class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(LinearNorm, self).__init__() self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) torch.nn.init.xavier_unifor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch import nn assert_size_stride = torch._C._dyna...
AeroXi/Tacotron2-Mandarin
LocationLayer
false
13,300
[ "MIT" ]
67
b7bc213d1c1a9c3e2f2e11f69f586c2582010668
https://github.com/AeroXi/Tacotron2-Mandarin/tree/b7bc213d1c1a9c3e2f2e11f69f586c2582010668
BCEBlurWithLogitsLoss
import torch import torch.nn as nn import torch.utils.data class BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super(BCEBlurWithLogitsLoss, self).__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Arui66/FPSAutomaticAiming
BCEBlurWithLogitsLoss
false
13,301
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
Sum
import torch import torch.nn as nn import torch.utils.data class Sum(nn.Module): def __init__(self, n, weight=False): super(Sum, self).__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=Tru...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Arui66/FPSAutomaticAiming
Sum
false
13,302
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
Contract
import torch import torch.nn as nn import torch.utils.data class Contract(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, C, H // s, s, W // s, s) x = x.permute...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Arui66/FPSAutomaticAiming
Contract
false
13,303
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
Classify
import torch import torch.nn as nn import torch.utils.data 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 Classify(nn.Module): def __init__(self, c1, c2, k=1, s=1, p=None, g=1): super(Classify, self).__init__() 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 import torch.utils.data assert_size_stride = torch._C._dyn...
Arui66/FPSAutomaticAiming
Classify
false
13,304
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
BinaryReg
import torch from typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.parallel class BinaryReg(nn.Module): """Regularization for encouraging the outputs to be binary. Args: pred (torch.Tensor): foreground logits. mask (Optional[torch.Tensor], optional): weight...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
Atharva-Peshkar/pytorch_connectomics
BinaryReg
false
13,305
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
AddBroadcastPosEmbed
import torch import torch.nn as nn def tensor_slice(x, begin, size): assert all([(b >= 0) for b in begin]) size = [(l - b if s == -1 else s) for s, b, l in zip(size, begin, x.shape)] assert all([(s >= 0) for s in size]) slices = [slice(b, b + s) for b, s in zip(begin, size)] return x[slices] cla...
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...
AshBT/VideoGPT
AddBroadcastPosEmbed
false
13,306
[ "MIT" ]
396
a823bc734af3387129f3bd624caad3db270707f2
https://github.com/AshBT/VideoGPT/tree/a823bc734af3387129f3bd624caad3db270707f2
WeightedBCE
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedBCE(nn.Module): """Weighted binary cross-entropy. """ def __init__(self, size_average=True, reduce=True): super().__init__() self.size_average = size_average ...
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...
Atharva-Peshkar/pytorch_connectomics
WeightedBCE
false
13,307
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
ContourDTConsistency
import torch from typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.parallel class ContourDTConsistency(nn.Module): """Consistency regularization between the instance contour map and signed distance transform. Args: pred1 (torch.Tensor): contour logits. ...
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...
Atharva-Peshkar/pytorch_connectomics
ContourDTConsistency
false
13,308
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
outconv
import torch import torch.nn as nn class outconv(nn.Module): def __init__(self, in_ch, out_ch): super(outconv, self).__init__() self.conv = nn.Conv2d(in_ch, out_ch, 1) def forward(self, x): x = self.conv(x) return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
AnonymousAuthors444/VEC_VAD
outconv
false
13,309
[ "MIT" ]
67
0072bf857030e621e2f9c12689407b81e45ed603
https://github.com/AnonymousAuthors444/VEC_VAD/tree/0072bf857030e621e2f9c12689407b81e45ed603
ModulatedConv2d
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) def make_kernel(k): k = torch.tensor(k, dtype=torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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.autograd...
ArashVahabpour/encoder4editing-contrastive
ModulatedConv2d
false
13,310
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
LayerNorm
import torch import torch.nn as nn import torch.optim class LayerNorm(nn.Module): """Construct a layernorm module in the OpenAI style (epsilon inside the square root).""" def __init__(self, n_state, e=1e-05): super(LayerNorm, self).__init__() self.g = nn.Parameter(torch.ones(n_state)) ...
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.optim assert_size_stride = torch._C._dynamo....
Arsenaut/comet-commonsense
LayerNorm
false
13,311
[ "Apache-2.0" ]
521
ffa4691ba6bfcb46ea2ed4ce91de5c6815f66e52
https://github.com/Arsenaut/comet-commonsense/tree/ffa4691ba6bfcb46ea2ed4ce91de5c6815f66e52
SamePadConvTranspose3d
import torch import torch.nn as nn import torch.nn.functional as F class SamePadConvTranspose3d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, bias=True): super().__init__() if isinstance(kernel_size, int): kernel_size = (kernel_size,) * 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AshBT/VideoGPT
SamePadConvTranspose3d
false
13,312
[ "MIT" ]
396
a823bc734af3387129f3bd624caad3db270707f2
https://github.com/AshBT/VideoGPT/tree/a823bc734af3387129f3bd624caad3db270707f2
SamePadConv3d
import torch import torch.nn as nn import torch.nn.functional as F class SamePadConv3d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, bias=True): super().__init__() if isinstance(kernel_size, int): kernel_size = (kernel_size,) * 3 if i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AshBT/VideoGPT
SamePadConv3d
false
13,313
[ "MIT" ]
396
a823bc734af3387129f3bd624caad3db270707f2
https://github.com/AshBT/VideoGPT/tree/a823bc734af3387129f3bd624caad3db270707f2
NonoverlapReg
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class NonoverlapReg(nn.Module): """Regularization to prevent overlapping prediction of pre- and post-synaptic masks in synaptic polarity prediction ("1" in MODEL.TARGET_OPT). Args: fg_masked (bool): mask the regul...
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.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
Atharva-Peshkar/pytorch_connectomics
NonoverlapReg
false
13,314
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
ForegroundDTConsistency
import torch from typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class ForegroundDTConsistency(nn.Module): """Consistency regularization between the binary foreground mask and signed distance transform. Args: pred1 (to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Atharva-Peshkar/pytorch_connectomics
ForegroundDTConsistency
false
13,315
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
DiaynDiscrimNet
import torch import torch.nn as nn from torch.nn.init import kaiming_uniform_ import torch.utils.data def weight_init(m): if m.__class__.__name__ == 'Linear': m.weight.data.copy_(kaiming_uniform_(m.weight.data)) m.bias.data.fill_(0) class DiaynDiscrimNet(nn.Module): def __init__(self, f_spa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
AswinRetnakumar/Machina
DiaynDiscrimNet
false
13,316
[ "MIT" ]
302
6519935ca4553192ac99fc1c7c1e7cab9dd72693
https://github.com/AswinRetnakumar/Machina/tree/6519935ca4553192ac99fc1c7c1e7cab9dd72693
MultiHeadAttention
import torch from typing import Tuple import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ Multi Head Attention module. https://arxiv.org/abs/1706.03762 This version has no normalization module and suppose self-attention """ def __init__(self, hidden_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....
AppleHolic/pytorch_sound
MultiHeadAttention
false
13,317
[ "BSD-2-Clause" ]
86
2320516d21d70c406d1dee74927e238972c96106
https://github.com/AppleHolic/pytorch_sound/tree/2320516d21d70c406d1dee74927e238972c96106
DiceLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class DiceLoss(nn.Module): """DICE loss. """ def __init__(self, reduce=True, smooth=100.0, power=1): super(DiceLoss, self).__init__() self.smooth = smooth self.reduce = reduce self.power = ...
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.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
Atharva-Peshkar/pytorch_connectomics
DiceLoss
false
13,318
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
Fp32LayerNorm
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32LayerNorm(nn.LayerNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
AppleHolic/fairseq
Fp32LayerNorm
false
13,319
[ "MIT" ]
429
c5b32cb2bde59a7bb7987b22864731fe927523d4
https://github.com/AppleHolic/fairseq/tree/c5b32cb2bde59a7bb7987b22864731fe927523d4
TransformerLayer
import torch import torch.nn as nn import torch.utils.data class TransformerLayer(nn.Module): def __init__(self, c, num_heads): super().__init__() self.q = nn.Linear(c, c, bias=False) self.k = nn.Linear(c, c, bias=False) self.v = nn.Linear(c, c, bias=False) self.ma = nn.Mu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Arui66/FPSAutomaticAiming
TransformerLayer
false
13,320
[ "Apache-2.0" ]
129
87674385d42b065b984b38a2ff59e7f2d4f07dc9
https://github.com/Arui66/FPSAutomaticAiming/tree/87674385d42b065b984b38a2ff59e7f2d4f07dc9
ZeroPad1d
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler assert_size_str...
AppleHolic/fairseq
ZeroPad1d
false
13,321
[ "MIT" ]
429
c5b32cb2bde59a7bb7987b22864731fe927523d4
https://github.com/AppleHolic/fairseq/tree/c5b32cb2bde59a7bb7987b22864731fe927523d4
ToRGB
from torch.autograd import Function import math import torch from torch import nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) def make_kernel(k): k = torch.tensor(k, dtype=torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.autograd import Function import math from torch import nn import torc...
ArashVahabpour/encoder4editing-contrastive
ToRGB
false
13,322
[ "MIT" ]
1,051
1b91afe1693e01a41118e1ce2451b7d14bec51f4
https://github.com/ArashVahabpour/encoder4editing-contrastive/tree/1b91afe1693e01a41118e1ce2451b7d14bec51f4
Fp32GroupNorm
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32GroupNorm(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
AppleHolic/fairseq
Fp32GroupNorm
false
13,323
[ "MIT" ]
429
c5b32cb2bde59a7bb7987b22864731fe927523d4
https://github.com/AppleHolic/fairseq/tree/c5b32cb2bde59a7bb7987b22864731fe927523d4
WeightedCE
import torch from typing import Optional from typing import List import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedCE(nn.Module): """Mask weighted multi-class cross-entropy (CE) loss. """ def __init__(self, class_weight: 'Optional[List[fl...
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 typing import Opt...
Atharva-Peshkar/pytorch_connectomics
WeightedCE
false
13,324
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
DiscrimNet
import torch import torch.nn as nn from torch.nn.init import kaiming_uniform_ import torch.utils.data def weight_init(m): if m.__class__.__name__ == 'Linear': m.weight.data.copy_(kaiming_uniform_(m.weight.data)) m.bias.data.fill_(0) class DiscrimNet(nn.Module): def __init__(self, observatio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AswinRetnakumar/Machina
DiscrimNet
false
13,325
[ "MIT" ]
302
6519935ca4553192ac99fc1c7c1e7cab9dd72693
https://github.com/AswinRetnakumar/Machina/tree/6519935ca4553192ac99fc1c7c1e7cab9dd72693
VNet
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.init import kaiming_uniform_ import torch.utils.data def weight_init(m): if m.__class__.__name__ == 'Linear': m.weight.data.copy_(kaiming_uniform_(m.weight.data)) m.bias.data.fill_(0) class VNet(nn.Module): def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
AswinRetnakumar/Machina
VNet
false
13,326
[ "MIT" ]
302
6519935ca4553192ac99fc1c7c1e7cab9dd72693
https://github.com/AswinRetnakumar/Machina/tree/6519935ca4553192ac99fc1c7c1e7cab9dd72693
FocalLoss
import torch from torch import nn class FocalLoss(nn.Module): """Implementation of Focal Loss. Focal loss was proposed in `Focal Loss for Dense Object Detection_. <https://arxiv.org/abs/1708.02002>`_. Args: gamma : The focal parameter. Defaults to 0. eps : Constant for comput...
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...
Atharva-Phatak/torchflare
FocalLoss
false
13,327
[ "Apache-2.0" ]
86
945f4bee73a855edd8cb19cd646731155499a27f
https://github.com/Atharva-Phatak/torchflare/tree/945f4bee73a855edd8cb19cd646731155499a27f
RSoftmax
import torch from torch.nn import functional as F import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class RSoftmax(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Atten4Vis/DemystifyLocalViT
RSoftmax
false
13,328
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
WeightedBCEWithLogitsLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedBCEWithLogitsLoss(nn.Module): """Weighted binary cross-entropy with logits. """ def __init__(self, size_average=True, reduce=True, eps=0.0): 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Atharva-Peshkar/pytorch_connectomics
WeightedBCEWithLogitsLoss
false
13,329
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
BCEFocalLoss
import torch from torch import nn class BCEFocalLoss(nn.Module): """Implementation of Focal Loss for Binary Classification Problems. Focal loss was proposed in `Focal Loss for Dense Object Detection_. <https://arxiv.org/abs/1708.02002>`_. """ def __init__(self, gamma=0, eps=1e-07, reduction='mea...
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 ...
Atharva-Phatak/torchflare
BCEFocalLoss
false
13,330
[ "Apache-2.0" ]
86
945f4bee73a855edd8cb19cd646731155499a27f
https://github.com/Atharva-Phatak/torchflare/tree/945f4bee73a855edd8cb19cd646731155499a27f
QNet
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.init import kaiming_uniform_ from torch.nn.init import uniform_ import torch.utils.data def mini_weight_init(m): if m.__class__.__name__ == 'Linear': m.weight.data.copy_(uniform_(m.weight.data, -0.003, 0.003)) m.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 torch.nn as nn from to...
AswinRetnakumar/Machina
QNet
false
13,331
[ "MIT" ]
302
6519935ca4553192ac99fc1c7c1e7cab9dd72693
https://github.com/AswinRetnakumar/Machina/tree/6519935ca4553192ac99fc1c7c1e7cab9dd72693
WeightedBCEFocalLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedBCEFocalLoss(nn.Module): """Weighted binary focal loss with logits. """ def __init__(self, gamma=2.0, alpha=0.25, eps=0.0): super().__init__() self.eps = eps ...
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...
Atharva-Peshkar/pytorch_connectomics
WeightedBCEFocalLoss
false
13,332
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
SSE
import torch from torch import nn class SSE(nn.Module): """SSE : Channel Squeeze and Spatial Excitation block. Paper : https://arxiv.org/abs/1803.02579 Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178 """ def __init__(self, in_channels): """Co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Atharva-Phatak/torchflare
SSE
false
13,333
[ "Apache-2.0" ]
86
945f4bee73a855edd8cb19cd646731155499a27f
https://github.com/Atharva-Phatak/torchflare/tree/945f4bee73a855edd8cb19cd646731155499a27f
ModelNet
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.init import kaiming_uniform_ import torch.utils.data def weight_init(m): if m.__class__.__name__ == 'Linear': m.weight.data.copy_(kaiming_uniform_(m.weight.data)) m.bias.data.fill_(0) class ModelNet(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
AswinRetnakumar/Machina
ModelNet
false
13,334
[ "MIT" ]
302
6519935ca4553192ac99fc1c7c1e7cab9dd72693
https://github.com/AswinRetnakumar/Machina/tree/6519935ca4553192ac99fc1c7c1e7cab9dd72693
TVLoss
import torch import torch.nn as nn class TVLoss(nn.Module): def __init__(self, TVLoss_weight=1): super(TVLoss, self).__init__() self.TVLoss_weight = TVLoss_weight def forward(self, x): batch_size = x.size()[0] h_x = x.size()[2] w_x = x.size()[3] count_h = (x.s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Axrid/cv_template
TVLoss
false
13,335
[ "MIT" ]
69
5c344692a1fcfb08b75d7104bcc78307b5640ecf
https://github.com/Axrid/cv_template/tree/5c344692a1fcfb08b75d7104bcc78307b5640ecf
WSDiceLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class WSDiceLoss(nn.Module): def __init__(self, smooth=100.0, power=2.0, v2=0.85, v1=0.15): super().__init__() self.smooth = smooth self.power = power self.v2 = v2 self.v1 = v1 def dic...
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.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
Atharva-Peshkar/pytorch_connectomics
WSDiceLoss
false
13,336
[ "MIT" ]
99
8eccd9640a9a454d4df095a3529a030e58f882f5
https://github.com/Atharva-Peshkar/pytorch_connectomics/tree/8eccd9640a9a454d4df095a3529a030e58f882f5
InputInjection
import torch import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class InputInjection(nn.Module): """Downsampling module for CGNet.""" def __init__(self, num_downsampling): super(InputInjection, self).__init__() self.pool = nn.ModuleList() ...
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 from torch import optim as optim assert_size_stride = torch._C._dynamo.guar...
Atten4Vis/DemystifyLocalViT
InputInjection
false
13,337
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
MSELoss
import functools import torch from torch.nn import functional as F import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Op...
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 from torch.nn import functional as F import torch.nn as nn import torch....
Atten4Vis/DemystifyLocalViT
MSELoss
false
13,338
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
ConvEncoder
import torch import torch.nn as nn class ConvEncoder(nn.Module): """ A simple Convolutional Encoder Model """ def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 16, (3, 3), padding=(1, 1)) self.relu1 = nn.ReLU(inplace=True) self.maxpool1 = nn.MaxPool2d((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_...
Alexander-Minyushkin/image_similarity
ConvEncoder
false
13,339
[ "Apache-2.0" ]
160
99bb68f0ccf226c068c43ad4feb47b76f7a5f180
https://github.com/Alexander-Minyushkin/image_similarity/tree/99bb68f0ccf226c068c43ad4feb47b76f7a5f180
CrossEntropyLoss2d
import torch from torch import nn class CrossEntropyLoss2d(nn.Module): """This criterion combines nn.LogSoftmax() and nn.NLLLoss() in one single class.""" def __init__(self, weight=None, ignore_index=-100): super().__init__() self.CE = nn.CrossEntropyLoss(weight=weight, ignore_index=ignore_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
AtlasGooo2/WoodScape
CrossEntropyLoss2d
false
13,340
[ "MIT" ]
348
597d9dda472c09bafea58ea69853948d63197eca
https://github.com/AtlasGooo2/WoodScape/tree/597d9dda472c09bafea58ea69853948d63197eca
Hsigmoid
import torch import torch.nn as nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(1.2 * x + 3.0, inplace=self.inplace) / 6.0 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._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
BHD233/PaddleOCR2Pytorch
Hsigmoid
false
13,341
[ "Apache-2.0" ]
364
f114069b3e2669c6adf0adf9596756205f184c9c
https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c
ExampleBackbone
import torch import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class ExampleBackbone(nn.Module): def __init__(self): super(ExampleBackbone, self).__init__() self.conv = nn.Conv2d(3, 3, 3) def init_weights(self, pretrained=None): pass ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch impo...
Atten4Vis/DemystifyLocalViT
ExampleBackbone
false
13,342
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
ConvDecoder
import torch import torch.nn as nn class ConvDecoder(nn.Module): """ A simple Convolutional Decoder Model """ def __init__(self): super().__init__() self.deconv1 = nn.ConvTranspose2d(256, 128, (2, 2), stride=(2, 2)) self.relu1 = nn.ReLU(inplace=True) self.deconv2 = 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 assert_...
Alexander-Minyushkin/image_similarity
ConvDecoder
false
13,343
[ "Apache-2.0" ]
160
99bb68f0ccf226c068c43ad4feb47b76f7a5f180
https://github.com/Alexander-Minyushkin/image_similarity/tree/99bb68f0ccf226c068c43ad4feb47b76f7a5f180
CrossEntropyLoss
import torch from torch.nn import functional as F import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim 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 from torch.nn import f...
Atten4Vis/DemystifyLocalViT
CrossEntropyLoss
false
13,344
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
SimpleModel
import torch import torch.nn as nn class SimpleModel(nn.Module): def __init__(self): super(SimpleModel, self).__init__() def forward(self, x): return 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...
AyushExel/tensorboardX
SimpleModel
false
13,345
[ "MIT" ]
5,378
34552d52d9154013d36772e4c32e9b189a3b9217
https://github.com/AyushExel/tensorboardX/tree/34552d52d9154013d36772e4c32e9b189a3b9217
SpatialGatherModule
import torch from torch.nn import functional as F import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class SpatialGatherModule(nn.Module): """Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Atten4Vis/DemystifyLocalViT
SpatialGatherModule
false
13,346
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
AdaptiveAvgMaxPool2d
import torch import torch.nn as nn def pooling_factor(pool_type='avg'): return 2 if pool_type == 'avgmaxc' else 1 class AdaptiveAvgMaxPool2d(torch.nn.Module): """Selectable global pooling layer with dynamic input kernel size """ def __init__(self, output_size=1, pool_type='avg'): super(Adap...
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...
BCV-Uniandes/DMS
AdaptiveAvgMaxPool2d
false
13,347
[ "MIT" ]
66
9fa3a3a2ef5980dd17e21b73234a4cd0b3d00e16
https://github.com/BCV-Uniandes/DMS/tree/9fa3a3a2ef5980dd17e21b73234a4cd0b3d00e16
TripletLoss
import torch import torch.nn.functional as F from torch import nn def cosine_dist(x, y): """Computes Cosine Distance.""" x = F.normalize(x, dim=1) y = F.normalize(y, dim=1) dist = 2 - 2 * torch.mm(x, y.t()) return dist def euclidean_dist(x, y): """Computes Euclidean distance.""" m, n = x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Atharva-Phatak/torchflare
TripletLoss
false
13,348
[ "Apache-2.0" ]
86
945f4bee73a855edd8cb19cd646731155499a27f
https://github.com/Atharva-Phatak/torchflare/tree/945f4bee73a855edd8cb19cd646731155499a27f
AttentionPool2d
import math import torch import numpy as np import torch as th import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif 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....
AranKomat/Diff-DALLE
AttentionPool2d
false
13,349
[ "MIT" ]
53
9418e98e97b599c5c65f16ee168fedf76a29095f
https://github.com/AranKomat/Diff-DALLE/tree/9418e98e97b599c5c65f16ee168fedf76a29095f
IoULoss
import torch import torch.nn as nn import torch.nn.functional as F class IoULoss(nn.Module): """ Creates a criterion that computes the Intersection over Union (IoU) between a segmentation mask and its ground truth. Rahman, M.A. and Wang, Y: Optimizing Intersection-Over-Union in Deep Neural Networ...
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...
BCV-Uniandes/DMS
IoULoss
false
13,350
[ "MIT" ]
66
9fa3a3a2ef5980dd17e21b73234a4cd0b3d00e16
https://github.com/BCV-Uniandes/DMS/tree/9fa3a3a2ef5980dd17e21b73234a4cd0b3d00e16
GHMR
import torch import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper `Gradient Harmonized Single-stage Detector <https://arxiv.org/abs/1811.05181>`_. Args: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Atten4Vis/DemystifyLocalViT
GHMR
false
13,351
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
RepeatChannel
import torch import torch.nn as nn import torch.nn.parallel class RepeatChannel(nn.Module): def __init__(self, repeat): super(RepeatChannel, self).__init__() self.repeat = repeat def forward(self, img): return img.repeat(1, self.repeat, 1, 1) def get_inputs(): return [torch.ran...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
AyushExel/GANSketching
RepeatChannel
false
13,352
[ "MIT" ]
598
c72524ac4425de898087af7a4c554b777a4e2218
https://github.com/AyushExel/GANSketching/tree/c72524ac4425de898087af7a4c554b777a4e2218
PixelShuffleICNR
import torch from torch import nn def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) class PixelShuffleICNR(nn.Module): def __init__(self, in_planes, out_planes, scale=2): super().__init__...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
AtlasGooo2/WoodScape
PixelShuffleICNR
false
13,353
[ "MIT" ]
348
597d9dda472c09bafea58ea69853948d63197eca
https://github.com/AtlasGooo2/WoodScape/tree/597d9dda472c09bafea58ea69853948d63197eca
Mlp
import torch import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim 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_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Atten4Vis/DemystifyLocalViT
Mlp
false
13,354
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
MonoLinearHyperNet
import torch from abc import abstractmethod from torch import nn from torch.nn.utils import weight_norm class HyperNet(nn.Module): """This module is responsible for taking the losses from all tasks and return a single loss term. We can think of this as our learnable loss criterion """ def __init__(s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from abc import abs...
AvivNavon/AuxiLearn
MonoLinearHyperNet
false
13,355
[ "MIT" ]
58
2c32f5cb548714ad3efe5c804003a30d6f012e2b
https://github.com/AvivNavon/AuxiLearn/tree/2c32f5cb548714ad3efe5c804003a30d6f012e2b
L2Norm
import torch import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class L2Norm(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): """L2 normalization layer. Args: n_dims (int): Number of dimensions to be normalized ...
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._C import torch.serialization from torch imp...
Atten4Vis/DemystifyLocalViT
L2Norm
false
13,356
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
Hswish
import torch import torch.nn as nn import torch.nn.functional as F class Hswish(nn.Module): def __init__(self, inplace=True): super(Hswish, self).__init__() self.inplace = inplace def forward(self, x): return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.0 def get_inputs(): re...
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...
BHD233/PaddleOCR2Pytorch
Hswish
false
13,357
[ "Apache-2.0" ]
364
f114069b3e2669c6adf0adf9596756205f184c9c
https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c
ClsHead
import torch import torch.nn as nn import torch.nn.functional as F class ClsHead(nn.Module): """ Class orientation Args: params(dict): super parameters for build Class network """ def __init__(self, in_channels, class_dim, **kwargs): super(ClsHead, self).__init__() self.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
BHD233/PaddleOCR2Pytorch
ClsHead
false
13,358
[ "Apache-2.0" ]
364
f114069b3e2669c6adf0adf9596756205f184c9c
https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c
FFN
import torch import torch.nn as nn import torch.nn.functional as F class FFN(nn.Module): """ Feed-Forward Network """ def __init__(self, d_inner_hid, d_model, dropout_rate): super(FFN, self).__init__() self.dropout_rate = dropout_rate self.fc1 = torch.nn.Linear(in_features=d_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 import torch.nn as nn assert_...
BHD233/PaddleOCR2Pytorch
FFN
false
13,359
[ "Apache-2.0" ]
364
f114069b3e2669c6adf0adf9596756205f184c9c
https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c
LinearZeros
import torch import torch.nn as nn class LinearZeros(nn.Linear): def __init__(self, in_channels, out_channels, logscale_factor=3): super().__init__(in_channels, out_channels) self.logscale_factor = logscale_factor self.register_parameter('logs', nn.Parameter(torch.zeros(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 math as tl_math import torch....
BQZic/glow-pytorch
LinearZeros
false
13,360
[ "MIT" ]
479
4b43042326bbe644ccfda3c81a138375321808ed
https://github.com/BQZic/glow-pytorch/tree/4b43042326bbe644ccfda3c81a138375321808ed
Conv2dWithFastWeight
import torch from torch import Tensor from typing import Tuple from typing import Union import torch.nn as nn import torch.nn.functional as F class Conv2dWithFastWeight(nn.Conv2d): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'Union[int, Tuple]', stride: 'Union[int, Tuple]'=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 typing import Tuple from typing import Union import torch.nn as nn assert_s...
BIGWangYuDong/mmfewshot
Conv2dWithFastWeight
false
13,361
[ "Apache-2.0" ]
376
dac097afc92df176bc2de76b7c90968584865197
https://github.com/BIGWangYuDong/mmfewshot/tree/dac097afc92df176bc2de76b7c90968584865197
WShift
import torch import torch.nn as nn import torch.nn.parallel class WShift(nn.Module): def __init__(self, style_dim): super().__init__() self.w_shift = nn.Parameter(torch.zeros(1, style_dim)) def forward(self, input): out = input + self.w_shift return out 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 import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
AyushExel/GANSketching
WShift
false
13,362
[ "MIT" ]
598
c72524ac4425de898087af7a4c554b777a4e2218
https://github.com/AyushExel/GANSketching/tree/c72524ac4425de898087af7a4c554b777a4e2218
CTCHead
import torch import torch.nn as nn import torch.nn.functional as F class CTCHead(nn.Module): def __init__(self, in_channels, out_channels=6625, fc_decay=0.0004, mid_channels=None, **kwargs): super(CTCHead, self).__init__() if mid_channels is None: self.fc = nn.Linear(in_channe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
BHD233/PaddleOCR2Pytorch
CTCHead
false
13,363
[ "Apache-2.0" ]
364
f114069b3e2669c6adf0adf9596756205f184c9c
https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ Multi-Head Attention """ def __init__(self, d_key, d_value, d_model, n_head=1, dropout_rate=0.0): super(MultiHeadAttention, self).__init__() self.n_head = n_head self.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 from torch._inductor.runtime....
BHD233/PaddleOCR2Pytorch
MultiHeadAttention
false
13,364
[ "Apache-2.0" ]
364
f114069b3e2669c6adf0adf9596756205f184c9c
https://github.com/BHD233/PaddleOCR2Pytorch/tree/f114069b3e2669c6adf0adf9596756205f184c9c
Encoding
import torch from torch.nn import functional as F import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim class Encoding(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (bat...
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 ...
Atten4Vis/DemystifyLocalViT
Encoding
false
13,365
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
BertLayerNorm
import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_si...
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...
BIT-ENGD/eeqa
BertLayerNorm
false
13,366
[ "MIT" ]
142
2995abbaff1fb47131246a247ee7ed62aa94f4c3
https://github.com/BIT-ENGD/eeqa/tree/2995abbaff1fb47131246a247ee7ed62aa94f4c3
RelationCrossing
import torch import torch.nn as nn import torch.nn.functional as F class RelationCrossing(nn.Module): def __init__(self, in_feats: 'int', out_feats: 'int', num_heads: 'int', dropout: 'float'=0.0, negative_slope: 'float'=0.2): """ Description ---------- Relation crossing l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
BUPT-GAMMA/OpenHGNN
RelationCrossing
false
13,367
[ "Apache-2.0" ]
235
5f218dad4ed1415aa6d842bc20785c61e74e5405
https://github.com/BUPT-GAMMA/OpenHGNN/tree/5f218dad4ed1415aa6d842bc20785c61e74e5405
GHMC
import torch from torch.nn import functional as F import torch.nn as nn import torch._C import torch.serialization from torch import optim as optim def _expand_onehot_labels(labels, label_weights, target_shape, ignore_index): """Expand onehot labels to match the size of prediction.""" bin_labels = labels.new_...
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 ...
Atten4Vis/DemystifyLocalViT
GHMC
false
13,368
[ "MIT" ]
64
2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
https://github.com/Atten4Vis/DemystifyLocalViT/tree/2e2327caec6d56ae2c8aa861b32bb62f3cdb786e
AvgReadout
import torch import torch.nn as nn class AvgReadout(nn.Module): """ Considering the efficiency of the method, we simply employ average pooling, computing the average of the set of embedding matrices .. math:: \\begin{equation} \\mathbf{H}=\\mathcal{Q}\\left(\\left\\{\\mathbf{H}^{(r)} \\mid ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
BUPT-GAMMA/OpenHGNN
AvgReadout
false
13,369
[ "Apache-2.0" ]
235
5f218dad4ed1415aa6d842bc20785c61e74e5405
https://github.com/BUPT-GAMMA/OpenHGNN/tree/5f218dad4ed1415aa6d842bc20785c61e74e5405
GDL
import torch import numpy as np from torch import nn import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=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 import numpy as np from torch import nn import torch.nn.functional assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
BRAIN-Lab-UNC/BrainExtraction-TissueSegmentation-Macaque
GDL
false
13,370
[ "MIT" ]
770
b5329035d9e32c8a27151cf2396eaf209396a334
https://github.com/BRAIN-Lab-UNC/BrainExtraction-TissueSegmentation-Macaque/tree/b5329035d9e32c8a27151cf2396eaf209396a334