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
PitchShift
import torch from torch import nn import torch.nn.functional as F class PitchShift(nn.Module): def __init__(self, shift): super(PitchShift, self).__init__() self.shift = shift def forward(self, x): if len(x.shape) == 2: x = x.unsqueeze(0) x = x.squeeze() m...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
shaun95/StarGANv2-VC
PitchShift
false
16,402
[ "MIT" ]
116
ed20538971a03d699351a349a3631767333baeb7
https://github.com/shaun95/StarGANv2-VC/tree/ed20538971a03d699351a349a3631767333baeb7
InjectNoise
import torch from torch import nn import torch.utils.data import torch.nn class InjectNoise(nn.Module): def __init__(self, channels): super().__init__() self.weight = nn.Parameter(torch.zeros(1, channels, 1, 1)) def forward(self, x): noise = torch.randn((x.shape[0], 1, x.shape[2], x....
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_si...
shimon-c/Machine-Learning-Collection
InjectNoise
false
16,403
[ "MIT" ]
3,094
ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
https://github.com/shimon-c/Machine-Learning-Collection/tree/ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
ResBlk
import math import torch from torch import nn import torch.nn.functional as F class DownSample(nn.Module): def __init__(self, layer_type): super().__init__() self.layer_type = layer_type def forward(self, x): if self.layer_type == 'none': return x elif self.layer_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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....
shaun95/StarGANv2-VC
ResBlk
false
16,404
[ "MIT" ]
116
ed20538971a03d699351a349a3631767333baeb7
https://github.com/shaun95/StarGANv2-VC/tree/ed20538971a03d699351a349a3631767333baeb7
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): """Norm to 0-mean 1-std , then do a learned diagonal affine transform.""" def __init__(self, features, eps=1e-05): super(LayerNorm, self).__init__() self.scale = nn.Parameter(torch.ones(features)) self.shift = nn.Parameter...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
shenyunlong/naru
LayerNorm
false
16,405
[ "Apache-2.0" ]
70
264cf4e9c96c9e34422f9eebc455a714aeef0b57
https://github.com/shenyunlong/naru/tree/264cf4e9c96c9e34422f9eebc455a714aeef0b57
AdaIN
import torch from torch import nn class AdaIN(nn.Module): def __init__(self, style_dim, num_features): super().__init__() self.norm = nn.InstanceNorm2d(num_features, affine=False) self.fc = nn.Linear(style_dim, num_features * 2) def forward(self, x, s): h = self.fc(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 torch import n...
shaun95/StarGANv2-VC
AdaIN
false
16,406
[ "MIT" ]
116
ed20538971a03d699351a349a3631767333baeb7
https://github.com/shaun95/StarGANv2-VC/tree/ed20538971a03d699351a349a3631767333baeb7
WSConv2d
import torch from torch import nn import torch.utils.data import torch.nn class WSConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, gain=2): super(WSConv2d, self).__init__() self.conv = 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 from torch import nn import torch.utils.data import torch.nn assert_size_stride ...
shimon-c/Machine-Learning-Collection
WSConv2d
false
16,407
[ "MIT" ]
3,094
ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
https://github.com/shimon-c/Machine-Learning-Collection/tree/ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
WSLinear
import torch from torch import nn import torch.utils.data import torch.nn class WSLinear(nn.Module): def __init__(self, in_features, out_features, gain=2): super(WSLinear, self).__init__() self.linear = nn.Linear(in_features, out_features) self.scale = (gain / in_features) ** 0.5 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.nn assert_size_stride ...
shimon-c/Machine-Learning-Collection
WSLinear
false
16,408
[ "MIT" ]
3,094
ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
https://github.com/shimon-c/Machine-Learning-Collection/tree/ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
WSConv2d
import torch from torchvision.transforms import functional as F from torch import nn from torch.nn import functional as F class WSConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, eps=1e-05): super().__init__(in_cha...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
rosinality/vision-transformers-pytorch
WSConv2d
false
16,409
[ "MIT" ]
77
b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f
https://github.com/rosinality/vision-transformers-pytorch/tree/b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f
DQN
import random import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class DQN(nn.Module): def __init__(self, state_dim, out_dim, capacity, bsz, epsilon): super().__init__() self.steps_done = 0 self.position = 0 self.pool = [] ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 random import torch.nn...
shinoyuki222/torch-light
DQN
false
16,410
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, dim, heads, dropout): super().__init__() self.heads = heads head_dim = dim // heads self.scale = head_dim ** -0.5 self.attn = None self.qkv = nn.Linear(dim, dim * 3) self.attn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
shampooma/segmenter
Attention
false
16,411
[ "MIT" ]
418
b08fd481da6758e37d108ba28676229b62f757aa
https://github.com/shampooma/segmenter/tree/b08fd481da6758e37d108ba28676229b62f757aa
Early_StyleConv_Block
import math import torch import torch.nn as nn def quick_scale(module, name='weight'): ScaleW.apply(module, name) return module class ScaleW: """ Constructor: name - name of attribute to be scaled """ def __init__(self, name): self.name = name def scale(self, module): 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.triton_helpers import libdevice import math import ...
sergkuzn148/stg
Early_StyleConv_Block
false
16,412
[ "MIT" ]
96
84d9f53ae3665c423836a4d0176dc3b22de62b19
https://github.com/sergkuzn148/stg/tree/84d9f53ae3665c423836a4d0176dc3b22de62b19
ConvBlock
import torch from torch import nn import torch.utils.data import torch.nn class WSConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, gain=2): super(WSConv2d, self).__init__() self.conv = 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 from torch import nn import torch.utils.data import torch.nn assert_size_stride ...
shimon-c/Machine-Learning-Collection
ConvBlock
false
16,413
[ "MIT" ]
3,094
ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
https://github.com/shimon-c/Machine-Learning-Collection/tree/ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
PaddedInstanceNorm1d
import torch import torch.nn as nn class PaddedInstanceNorm1d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False): super().__init__() self.num_features = num_features self.eps = eps self.momentum = momentum ...
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_...
shaun95/cotatron
PaddedInstanceNorm1d
false
16,414
[ "BSD-3-Clause" ]
202
2d0254399a3063ba1d2f77bef535cc148041236e
https://github.com/shaun95/cotatron/tree/2d0254399a3063ba1d2f77bef535cc148041236e
AtteMatchLay
import torch import torch.nn as nn from torch.nn.functional import cosine_similarity def multi_perspective_expand_for_2D(in_tensor, decompose_params): """ Return: [batch_size, decompse_dim, dim] """ in_tensor = in_tensor.unsqueeze(1) decompose_params = decompose_params.unsqueeze(0) return torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
shinoyuki222/torch-light
AtteMatchLay
false
16,415
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
InnerProductDecoder
import torch import torch.nn as nn import torch.nn.functional as F class InnerProductDecoder(nn.Module): def __init__(self, activation=torch.sigmoid, dropout=0.1): super(InnerProductDecoder, self).__init__() self.dropout = dropout self.activation = activation def forward(self, z): ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
shionhonda/graph_ae
InnerProductDecoder
false
16,416
[ "MIT" ]
48
b8284a85286eee1b16cb90c0dd139d8927e83648
https://github.com/shionhonda/graph_ae/tree/b8284a85286eee1b16cb90c0dd139d8927e83648
HyperpriorSynthesisDLMM
import torch import torch.nn as nn import torch.nn.functional as F def get_num_DLMM_channels(C, K=4, params=['mu', 'scale', 'mix']): """ C: Channels of latent representation (L3C uses 5). K: Number of mixture coefficients. """ return C * K * len(params) class HyperpriorSynthesisDLMM(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 import ...
sedrickkeh/high-fidelity-dual-image
HyperpriorSynthesisDLMM
false
16,417
[ "Apache-2.0" ]
266
9cefd378467826b91596653df38666e469bb23e0
https://github.com/sedrickkeh/high-fidelity-dual-image/tree/9cefd378467826b91596653df38666e469bb23e0
CrossEntropy
import torch import torch.nn as nn class CrossEntropy(nn.Module): def __init__(self): super().__init__() def forward(self, props, tgt): tgt_props = props.gather(2, tgt.unsqueeze(2)).squeeze() mask = (tgt > 0).float() return -(tgt_props * mask).sum() / mask.sum() def get_inp...
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...
shinoyuki222/torch-light
CrossEntropy
false
16,418
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
HyperpriorSynthesis
import torch import torch.nn as nn import torch.nn.functional as F class HyperpriorSynthesis(nn.Module): """ Hyperprior 'synthesis model' as proposed in [1]. Outputs distribution parameters of input latents. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
sedrickkeh/high-fidelity-dual-image
HyperpriorSynthesis
false
16,419
[ "Apache-2.0" ]
266
9cefd378467826b91596653df38666e469bb23e0
https://github.com/sedrickkeh/high-fidelity-dual-image/tree/9cefd378467826b91596653df38666e469bb23e0
BasicUNet
import torch from torch import nn import torch.nn.functional as F class BasicConvBlock(nn.Module): def __init__(self, in_channels, out_channels): super(BasicConvBlock, self).__init__() self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1) self.conv2 = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
royerloic/aydin
BasicUNet
false
16,420
[ "BSD-3-Clause" ]
78
f9c61a24030891d008c318b250da5faec69fcd7d
https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d
HSwish
import torch from torch import nn import torch.utils.data class HSwish(nn.Module): """Hard Swish activation function. See: https://arxiv.org/abs/1905.02244 """ def forward(self, x): return x * nn.functional.relu6(x + 3).div_(6) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def 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 import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards...
shiyuann/determined
HSwish
false
16,421
[ "Apache-2.0" ]
1,729
856123ae112759de7bded9bc7bd0e07055f2174b
https://github.com/shiyuann/determined/tree/856123ae112759de7bded9bc7bd0e07055f2174b
StyledConv
import math import torch import warnings import numpy as np from torch import nn from torch.nn import functional as F import torch.utils.cpp_extension def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): rest_dim = [1] * (input.ndim - bias.ndim - 1) input = input return F.leaky_relu(inpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
phygitalism/PTI
StyledConv
false
16,422
[ "MIT" ]
345
adab2eb1d0e36ac5714e663e1fec9f85a0d51fbf
https://github.com/phygitalism/PTI/tree/adab2eb1d0e36ac5714e663e1fec9f85a0d51fbf
AlphaEntropy
import torch import torch.nn as nn class AlphaEntropy(nn.Module): def __init__(self): super().__init__() self.v_loss = nn.MSELoss() def forward(self, props, v, pi, reward): v_loss = self.v_loss(v, reward) p_loss = -torch.mean(torch.sum(props * pi, 1)) return p_loss + ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
shinoyuki222/torch-light
AlphaEntropy
false
16,423
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
MLP
import math import torch from torch import nn import torch.nn.functional as F import torch.cuda import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Butterfly(nn.Module): """Product of log N butterfly factors, each is a block 2x2 of diagonal matrices. C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math from torch import...
sfox14/butterfly
MLP
false
16,424
[ "Apache-2.0" ]
52
13cc15cee5bdb7adaf376219aaf20fab0459e9ef
https://github.com/sfox14/butterfly/tree/13cc15cee5bdb7adaf376219aaf20fab0459e9ef
ActorCritic
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.distributions import Categorical class ActorCritic(nn.Module): def __init__(self): super().__init__() self.affine1 = nn.Linear(4, 128) self.action_head = nn.Linear(128, 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 from torch._inductor.runtime....
shinoyuki222/torch-light
ActorCritic
false
16,425
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
AdaIN
import torch from torch import nn import torch.utils.data import torch.nn class WSLinear(nn.Module): def __init__(self, in_features, out_features, gain=2): super(WSLinear, self).__init__() self.linear = nn.Linear(in_features, out_features) self.scale = (gain / in_features) ** 0.5 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
shimon-c/Machine-Learning-Collection
AdaIN
false
16,426
[ "MIT" ]
3,094
ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
https://github.com/shimon-c/Machine-Learning-Collection/tree/ac5dcd03a40a08a8af7e1a67ade37f28cf88db43
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...
shiyangc-intusurg/kornia
BinaryFocalLossWithLogits
false
16,427
[ "ECL-2.0", "Apache-2.0" ]
4,894
2e2512f8f20d300d8732e5873e16336b5a01f3bd
https://github.com/shiyangc-intusurg/kornia/tree/2e2512f8f20d300d8732e5873e16336b5a01f3bd
h_sigmoid
import torch from torch import nn class h_sigmoid(nn.Module): def __init__(self, inplace=True, h_max=1): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) self.h_max = h_max def forward(self, x): return self.relu(x + 3) * self.h_max / 6 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
shivamsnaik/dynamic-head-microsoft-fork
h_sigmoid
false
16,428
[ "MIT" ]
494
0f337eec44d262df2517be8f5617477c0b092fcc
https://github.com/shivamsnaik/dynamic-head-microsoft-fork/tree/0f337eec44d262df2517be8f5617477c0b092fcc
DilatedGatedConv1D
import torch import torch.nn as nn class DilatedGatedConv1D(nn.Module): def __init__(self, dilation_rate, dim): super().__init__() self.dim = dim self.dropout = nn.Dropout(p=0.1) self.cnn = nn.Conv1d(dim, dim * 2, 3, padding=dilation_rate, dilation=dilation_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
shinoyuki222/torch-light
DilatedGatedConv1D
false
16,429
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
MaskedMSELoss
import torch import torch.nn as nn class MaskedMSELoss(nn.Module): def __init__(self): super(MaskedMSELoss, self).__init__() self.loss = nn.BCEWithLogitsLoss(reduction='sum') def forward(self, pred, target, mask): """ pred -> batch*seq_len target -> batch*seq_len ...
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...
shrx11/M2H2-dataset
MaskedMSELoss
false
16,430
[ "MIT" ]
206
8be80041fc0de04f2a6113e305f09f3b8d6279f4
https://github.com/shrx11/M2H2-dataset/tree/8be80041fc0de04f2a6113e305f09f3b8d6279f4
CombineTensorPatches
import torch from typing import Optional from typing import Tuple import torch.nn as nn from typing import Union from torch.nn.modules.utils import _pair def combine_tensor_patches(patches: 'torch.Tensor', window_size: 'Tuple[int, int]'=(4, 4), stride: 'Tuple[int, int]'=(4, 4), unpadding: 'Optional[Tuple[int,...
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 typing import Optional from typing import Tuple import torch.nn as nn from typing import Union from torch.nn.modules.utils import _pair...
shiyangc-intusurg/kornia
CombineTensorPatches
false
16,431
[ "ECL-2.0", "Apache-2.0" ]
4,894
2e2512f8f20d300d8732e5873e16336b5a01f3bd
https://github.com/shiyangc-intusurg/kornia/tree/2e2512f8f20d300d8732e5873e16336b5a01f3bd
KLDivergence
import torch import torch.nn.functional as F import torch.nn as nn import torch.optim def kl_divergence(y, target, mask=None, reduce=True): loss = (target * torch.log(target) - target * F.log_softmax(y, 1)).sum(1) if mask is not None: loss = mask * loss if reduce: return loss.mean() el...
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.functi...
shrutimoy10/cords
KLDivergence
false
16,432
[ "MIT" ]
185
8f8d087098afafd352f793821911d80eb7b39a7d
https://github.com/shrutimoy10/cords/tree/8f8d087098afafd352f793821911d80eb7b39a7d
JointsMSELoss
import torch import torch.nn as nn import torch.utils.data class JointsMSELoss(nn.Module): def __init__(self): super(JointsMSELoss, self).__init__() self.criterion = nn.MSELoss(reduction='mean') def forward(self, output, target, target_weight=None): batch_size = output.size(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....
shunya-toyokawa/qanet_human_parts_segmentatiom
JointsMSELoss
false
16,433
[ "MIT" ]
72
5527b247acd65534b455c26e3692a14b31669602
https://github.com/shunya-toyokawa/qanet_human_parts_segmentatiom/tree/5527b247acd65534b455c26e3692a14b31669602
BoundedIoULoss
import torch import torch.nn as nn import torch.utils.data class BoundedIoULoss(nn.Module): def __init__(self, beta=0.2, eps=0.001): super(BoundedIoULoss, self).__init__() self.beta = beta self.eps = eps def forward(self, pred, target, weight=None): pred_ctr_2x = pred[:, :2] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
shunya-toyokawa/qanet_human_parts_segmentatiom
BoundedIoULoss
false
16,434
[ "MIT" ]
72
5527b247acd65534b455c26e3692a14b31669602
https://github.com/shunya-toyokawa/qanet_human_parts_segmentatiom/tree/5527b247acd65534b455c26e3692a14b31669602
HyperpriorAnalysis
import torch import torch.nn as nn import torch.nn.functional as F class HyperpriorAnalysis(nn.Module): """ Hyperprior 'analysis model' as proposed in [1]. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1802.01436 (2018). C: Number of input 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 from torch._inductor.runtime....
sedrickkeh/high-fidelity-dual-image
HyperpriorAnalysis
false
16,435
[ "Apache-2.0" ]
266
9cefd378467826b91596653df38666e469bb23e0
https://github.com/sedrickkeh/high-fidelity-dual-image/tree/9cefd378467826b91596653df38666e469bb23e0
NormalizeScale
import torch import torch.nn as nn import torch.nn.functional as F class NormalizeScale(nn.Module): def __init__(self, dim, init_norm=20): super(NormalizeScale, self).__init__() self.init_norm = init_norm self.weight = nn.Parameter(torch.ones(1, dim) * init_norm) def forward(self, bo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
sibeiyang/sgmn
NormalizeScale
false
16,436
[ "MIT" ]
130
00731b4f2202246d40a36d2a6727c599e6e649aa
https://github.com/sibeiyang/sgmn/tree/00731b4f2202246d40a36d2a6727c599e6e649aa
PrimaryCapsLayer
import torch import torch.nn as nn def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class PrimaryCapsLayer(nn.Module): def __init__(self, input_channels, output_caps, output_dim, kernel_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 import torch.nn as ...
shwetasrsh/MNIST-baselines
PrimaryCapsLayer
false
16,437
[ "MIT" ]
61
aa888e201a1dddda13e7b278cab8f940d57538db
https://github.com/shwetasrsh/MNIST-baselines/tree/aa888e201a1dddda13e7b278cab8f940d57538db
NormAttnMap
import torch import torch.nn as nn class NormAttnMap(nn.Module): def __init__(self, norm_type='cossim'): super(NormAttnMap, self).__init__() self.norm_type = norm_type def forward(self, attn_map): if self.norm_type != 'cosssim': norm = torch.max(attn_map, dim=1, keepdim=T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
sibeiyang/sgmn
NormAttnMap
false
16,438
[ "MIT" ]
130
00731b4f2202246d40a36d2a6727c599e6e649aa
https://github.com/sibeiyang/sgmn/tree/00731b4f2202246d40a36d2a6727c599e6e649aa
SwishX
import torch import torch.nn as nn import torch.utils.data class SwishX(nn.Module): def __init__(self, maxvalue=2.72): super(SwishX, self).__init__() self.maximal = nn.Parameter(torch.FloatTensor([maxvalue])) def forward(self, x): output = x * torch.sigmoid(x) output = output...
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...
shunya-toyokawa/qanet_human_parts_segmentatiom
SwishX
false
16,439
[ "MIT" ]
72
5527b247acd65534b455c26e3692a14b31669602
https://github.com/shunya-toyokawa/qanet_human_parts_segmentatiom/tree/5527b247acd65534b455c26e3692a14b31669602
Anomaly
import torch import torch.utils.data from torch import nn class Anomaly(nn.Module): def __init__(self, window=1024): self.window = window super(Anomaly, self).__init__() self.layer1 = nn.Conv1d(window, window, kernel_size=1, stride=1, padding=0) self.layer2 = nn.Conv1d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
sccc19/anomalydetector
Anomaly
false
16,440
[ "MIT" ]
180
a963ef8d7f30971e99d21a748d059e26f2163b09
https://github.com/sccc19/anomalydetector/tree/a963ef8d7f30971e99d21a748d059e26f2163b09
Log10Loss
import torch import numpy as np import torch.nn as nn import torch.nn.init from math import log def _mask_input(input, mask=None): if mask is not None: input = input * mask count = torch.sum(mask).data[0] else: count = np.prod(input.size(), dtype=np.float32).item() return input, co...
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 import torch.nn.init assert_size...
simonmeister/pytorch-mono-depth
Log10Loss
false
16,441
[ "MIT" ]
56
713c70e2fdae6d9d6e0322febadfedcaee9470d3
https://github.com/simonmeister/pytorch-mono-depth/tree/713c70e2fdae6d9d6e0322febadfedcaee9470d3
NormalizationLayer
import torch import torch.nn.init class NormalizationLayer(torch.nn.Module): """Class for normalization layer.""" def __init__(self, normalize_scale=1.0, learn_scale=True): super(NormalizationLayer, self).__init__() self.norm_s = float(normalize_scale) if learn_scale: self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sidphbot/jina-hub
NormalizationLayer
false
16,442
[ "Apache-2.0" ]
106
ab195030b72353c9b803874e2c99829fb75e1b17
https://github.com/sidphbot/jina-hub/tree/ab195030b72353c9b803874e2c99829fb75e1b17
MaskIOULoss
import torch import torch.nn as nn import torch.utils.data class MaskIOULoss(nn.Module): def __init__(self): super(MaskIOULoss, self).__init__() def forward(self, pred, target, weight): total = torch.stack([pred, target], -1) l_max = total.max(dim=2)[0] l_min = total.min(dim=...
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 ...
shunya-toyokawa/qanet_human_parts_segmentatiom
MaskIOULoss
false
16,443
[ "MIT" ]
72
5527b247acd65534b455c26e3692a14b31669602
https://github.com/shunya-toyokawa/qanet_human_parts_segmentatiom/tree/5527b247acd65534b455c26e3692a14b31669602
LocationEncoder
import torch import torch.nn as nn import torch.nn.functional as F class NormalizeScale(nn.Module): def __init__(self, dim, init_norm=20): super(NormalizeScale, self).__init__() self.init_norm = init_norm self.weight = nn.Parameter(torch.ones(1, dim) * init_norm) def forward(self, bo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sibeiyang/sgmn
LocationEncoder
false
16,444
[ "MIT" ]
130
00731b4f2202246d40a36d2a6727c599e6e649aa
https://github.com/sibeiyang/sgmn/tree/00731b4f2202246d40a36d2a6727c599e6e649aa
ConvUnit
import torch import torch.nn as nn class ConvUnit(nn.Module): def __init__(self): super(ConvUnit, self).__init__() self.conv = nn.Conv2d(in_channels=256, out_channels=32, kernel_size =5, stride=1) def forward(self, x): return self.conv(x) def get_inputs(): return [t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
shinoyuki222/torch-light
ConvUnit
false
16,445
[ "MIT" ]
310
4799805d9bcae82a9f12a574dcf9fdd838c92ee9
https://github.com/shinoyuki222/torch-light/tree/4799805d9bcae82a9f12a574dcf9fdd838c92ee9
RelLoss
import torch import numpy as np import torch.nn as nn import torch.nn.init def _mask_input(input, mask=None): if mask is not None: input = input * mask count = torch.sum(mask).data[0] else: count = np.prod(input.size(), dtype=np.float32).item() return input, count class RelLoss(n...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np import torch.nn as nn import torch.nn.init assert_size...
simonmeister/pytorch-mono-depth
RelLoss
false
16,446
[ "MIT" ]
56
713c70e2fdae6d9d6e0322febadfedcaee9470d3
https://github.com/simonmeister/pytorch-mono-depth/tree/713c70e2fdae6d9d6e0322febadfedcaee9470d3
MergeModule
import torch import torch.nn as nn class NormAttnMap(nn.Module): def __init__(self, norm_type='cossim'): super(NormAttnMap, self).__init__() self.norm_type = norm_type def forward(self, attn_map): if self.norm_type != 'cosssim': norm = torch.max(attn_map, dim=1, keepdim=T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
sibeiyang/sgmn
MergeModule
false
16,447
[ "MIT" ]
130
00731b4f2202246d40a36d2a6727c599e6e649aa
https://github.com/sibeiyang/sgmn/tree/00731b4f2202246d40a36d2a6727c599e6e649aa
GSympNet
from torch.nn import Module import torch import torch.nn as nn class Module(torch.nn.Module): """Standard module format. """ def __init__(self): super(Module, self).__init__() self.activation = None self.initializer = None self.__device = None self.__dtype = 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.nn import Module import torch.nn as nn assert_size_stride = torch._C....
shushu-qin/deeponet
GSympNet
false
16,448
[ "Apache-2.0" ]
140
5bbe066279bba055ad80e04c364140363c87634a
https://github.com/shushu-qin/deeponet/tree/5bbe066279bba055ad80e04c364140363c87634a
_TransitionUp
import torch import torch.nn as nn import torch.nn.init class _TransitionUp(nn.Module): def __init__(self, num_features): super().__init__() self.deconv = nn.ConvTranspose2d(num_features, num_features, kernel_size=3, stride=2, padding=1) def forward(self, x, skip): 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 import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo...
simonmeister/pytorch-mono-depth
_TransitionUp
false
16,449
[ "MIT" ]
56
713c70e2fdae6d9d6e0322febadfedcaee9470d3
https://github.com/simonmeister/pytorch-mono-depth/tree/713c70e2fdae6d9d6e0322febadfedcaee9470d3
Downsample
import torch from torch import Tensor from torch import nn class Downsample(nn.Module): def __init__(self, c1, c2, patch_size): super().__init__() self.proj = nn.Conv2d(c1, c2, patch_size, patch_size) def forward(self, x: 'Tensor') ->Tensor: x = x.permute(0, 3, 1, 2) x = 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
sithu31296/image_classification
Downsample
false
16,450
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
SAGEConv
import torch import torch.nn.functional as F import torch.nn as nn class SAGEConv(nn.Module): """ Description ----------- SAGE convolutional layer. Parameters ---------- in_features : int Dimension of input features. pool_features : int Dimension of pooling features. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sigeisler/grb
SAGEConv
false
16,451
[ "MIT" ]
51
c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
https://github.com/sigeisler/grb/tree/c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
GCNConv
import torch import torch.nn.functional as F import torch.nn as nn class GCNConv(nn.Module): """ Description ----------- GCN convolutional layer. Parameters ---------- in_features : int Dimension of input features. out_features : int Dimension of output features. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F import torch.nn as nn assert_size_stride = torch...
sigeisler/grb
GCNConv
false
16,452
[ "MIT" ]
51
c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
https://github.com/sigeisler/grb/tree/c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
localSubNet
import torch import torch.nn as nn class localSubNet(nn.Module): def __init__(self, blockDepth=16, convDepth=32, scale=0.25): super(localSubNet, self).__init__() self.blockDepth = blockDepth self.convDepth = convDepth self.scale = scale self.net = torch.nn.Sequential() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
shir-barzel-healthy/CIE_XYZ_NET
localSubNet
false
16,453
[ "MIT" ]
64
9aabf5222dd81efa518233340dc3313177927e27
https://github.com/shir-barzel-healthy/CIE_XYZ_NET/tree/9aabf5222dd81efa518233340dc3313177927e27
GRUStep
import torch import torch.nn as nn class GRUStep(nn.Module): def __init__(self, hidden_size, input_size): super(GRUStep, self).__init__() """GRU module""" self.linear_z = nn.Linear(hidden_size + input_size, hidden_size, bias=False) self.linear_r = nn.Linear(hidden_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
siyangZhao/BAMnet
GRUStep
false
16,454
[ "Apache-2.0" ]
170
4c6222610c120a4a114daf40938219ea0ca57dc6
https://github.com/siyangZhao/BAMnet/tree/4c6222610c120a4a114daf40938219ea0ca57dc6
AgreementRouting
import torch import torch.nn as nn import torch.nn.functional as F def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class AgreementRouting(nn.Module): def __init__(self, input_caps, outpu...
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...
shwetasrsh/MNIST-baselines
AgreementRouting
false
16,455
[ "MIT" ]
61
aa888e201a1dddda13e7b278cab8f940d57538db
https://github.com/shwetasrsh/MNIST-baselines/tree/aa888e201a1dddda13e7b278cab8f940d57538db
_FPNUp
import torch import torch.nn as nn import torch.nn.init class _FPNUp(nn.Module): def __init__(self, num_input_features, skip_channel_adjust=True): super().__init__() self.conv_channel_adjust = nn.Conv2d(num_input_features, 256, kernel_size=1) self.conv_fusion = nn.Conv2d(256, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
simonmeister/pytorch-mono-depth
_FPNUp
false
16,456
[ "MIT" ]
56
713c70e2fdae6d9d6e0322febadfedcaee9470d3
https://github.com/simonmeister/pytorch-mono-depth/tree/713c70e2fdae6d9d6e0322febadfedcaee9470d3
TAGConv
import torch import torch.nn.functional as F import torch.nn as nn class TAGConv(nn.Module): """ Description ----------- TAGCN convolutional layer. Parameters ---------- in_features : int Dimension of input features. out_features : int Dimension of output features. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F import torch.nn as nn assert_size_stride = torch...
sigeisler/grb
TAGConv
false
16,457
[ "MIT" ]
51
c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
https://github.com/sigeisler/grb/tree/c89e21076dc05d1edb87dfe2eff20c29ba6bd0c1
ResNetV2
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn from torch.nn import functional as F from collections import OrderedDict def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bethgelab/robustness
ResNetV2
false
16,458
[ "Apache-2.0" ]
67
aa0a6798fe3973bae5f47561721b59b39f126ab7
https://github.com/bethgelab/robustness/tree/aa0a6798fe3973bae5f47561721b59b39f126ab7
MLP
import torch from torch import Tensor from torch import nn class MLP(nn.Module): def __init__(self, dim, hidden_dim, out_dim=None) ->None: super().__init__() out_dim = out_dim or dim self.fc1 = nn.Conv2d(dim, hidden_dim, 1, 1, 0) self.act = nn.ReLU6(True) self.fc2 = nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
sithu31296/image_classification
MLP
false
16,459
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
BodyPoseModel
import torch from collections import OrderedDict def _make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = torch.nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 collections import Order...
pento-group/terran
BodyPoseModel
false
16,460
[ "BSD-3-Clause" ]
62
983f18521b149749c944e3b29c86361cb1ecf3a5
https://github.com/pento-group/terran/tree/983f18521b149749c944e3b29c86361cb1ecf3a5
LASympNet
from torch.nn import Module import torch import torch.nn as nn class Module(torch.nn.Module): """Standard module format. """ def __init__(self): super(Module, self).__init__() self.activation = None self.initializer = None self.__device = None self.__dtype = 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.nn import Module import torch.nn as nn assert_size_stride = torch._C....
shushu-qin/deeponet
LASympNet
false
16,461
[ "Apache-2.0" ]
140
5bbe066279bba055ad80e04c364140363c87634a
https://github.com/shushu-qin/deeponet/tree/5bbe066279bba055ad80e04c364140363c87634a
ClassAttention
import torch from torch import Tensor from torch import nn class ClassAttention(nn.Module): def __init__(self, dim, num_heads): super().__init__() self.num_heads = num_heads self.scale = (dim // num_heads) ** -0.5 self.q = nn.Linear(dim, dim, bias=False) self.kv = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sithu31296/image_classification
ClassAttention
false
16,462
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
InstanceNorm
import torch import torch.utils.data import torch from torch import nn class InstanceNorm(nn.Module): def __init__(self, epsilon=1e-08): super(InstanceNorm, self).__init__() self.epsilon = epsilon def forward(self, x): x = x - torch.mean(x, (2, 3), True) tmp = torch.mul(x, 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 import torch.utils.data import torch from torch import nn assert_size_stride = ...
siyuhuang/PoseStylizer
InstanceNorm
false
16,463
[ "BSD-3-Clause" ]
75
d1d832781ddfd3efde24bf32b36a4074fafebcc1
https://github.com/siyuhuang/PoseStylizer/tree/d1d832781ddfd3efde24bf32b36a4074fafebcc1
PatchEmbedding
import torch from torch import nn class PatchEmbedding(nn.Module): """Image to Patch Embedding """ def __init__(self, patch_size=16, embed_dim=768): super().__init__() self.proj = nn.Conv2d(3, embed_dim, patch_size, patch_size) def forward(self, x: 'torch.Tensor'): x = self.p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
sithu31296/image_classification
PatchEmbedding
false
16,464
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
PixelNorm
import torch import torch.utils.data import torch from torch import nn class PixelNorm(nn.Module): def __init__(self, epsilon=1e-08): super(PixelNorm, self).__init__() self.epsilon = epsilon def forward(self, x): tmp = torch.mul(x, x) tmp1 = torch.rsqrt(torch.mean(tmp, dim=1,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch from torch import nn assert_size_stride = ...
siyuhuang/PoseStylizer
PixelNorm
false
16,465
[ "BSD-3-Clause" ]
75
d1d832781ddfd3efde24bf32b36a4074fafebcc1
https://github.com/siyuhuang/PoseStylizer/tree/d1d832781ddfd3efde24bf32b36a4074fafebcc1
ApplyStyle
import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class FC(nn.Module): def __init__(self, in_channels, out_channels, gain=2 ** 0.5, use_wscale =False, lrmul=1.0, bias=True): super(FC, self).__init__() he_std = gain * in_channels ** -0.5...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import nn import torch.nn.functi...
siyuhuang/PoseStylizer
ApplyStyle
false
16,466
[ "BSD-3-Clause" ]
75
d1d832781ddfd3efde24bf32b36a4074fafebcc1
https://github.com/siyuhuang/PoseStylizer/tree/d1d832781ddfd3efde24bf32b36a4074fafebcc1
PatchEmbedOverlap
import torch from torch import Tensor from torch import nn class PatchEmbedOverlap(nn.Module): """Image to Patch Embedding with overlapping """ def __init__(self, patch_size=16, stride=16, padding=0, embed_dim=768): super().__init__() self.proj = nn.Conv2d(3, embed_dim, patch_size, stride...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
sithu31296/image_classification
PatchEmbedOverlap
false
16,467
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
DistillationLoss
import torch from torch import Tensor from torch import nn from typing import Union class DistillationLoss(nn.Module): """Distilling the Knowledge in a Neural Network https://arxiv.org/pdf/1503.02531.pdf """ def __init__(self, alpha: 'float'=0.95, temp: 'Union[float, int]'=6 ) ->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 libdevice, math as tl_math from torch ...
sithu31296/image_classification
DistillationLoss
false
16,468
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
DepthGTLoss
import torch import numpy as np class DepthGTLoss(torch.nn.Module): """ A simple L1 loss, but restricted to the cropped center of the image. It also does not count pixels outside of a given range of values (in target). Additionally, there is also an L1 loss on the gradient. """ 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 import triton_helpers from torch._inductor.runtime....
simon-donne/defusr
DepthGTLoss
false
16,469
[ "MIT" ]
65
fa4275070af4024eea128e99d7c6df2358d129a5
https://github.com/simon-donne/defusr/tree/fa4275070af4024eea128e99d7c6df2358d129a5
FC
import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class FC(nn.Module): def __init__(self, in_channels, out_channels, gain=2 ** 0.5, use_wscale =False, lrmul=1.0, bias=True): super(FC, self).__init__() he_std = gain * in_channels ** -0.5...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import nn assert_size_stride = t...
siyuhuang/PoseStylizer
FC
false
16,470
[ "BSD-3-Clause" ]
75
d1d832781ddfd3efde24bf32b36a4074fafebcc1
https://github.com/siyuhuang/PoseStylizer/tree/d1d832781ddfd3efde24bf32b36a4074fafebcc1
FCUDown
import torch from torch import nn class FCUDown(nn.Module): def __init__(self, c1, c2, dw_stride): super().__init__() self.conv_project = nn.Conv2d(c1, c2, 1, 1, 0) self.sample_pooling = nn.AvgPool2d(dw_stride, dw_stride) self.ln = nn.LayerNorm(c2) self.act = nn.GELU() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
sithu31296/image_classification
FCUDown
false
16,471
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
LocalNet
import torch import torch.nn as nn class LocalNet(nn.Module): def forward(self, x_in): """Defines a double convolution :param x_in: input convolutional features :returns: convolutional features :rtype: Tensor """ x = self.lrelu(self.conv1(self.refpad(x_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 math as tl_math import torch....
sjmoran/CURL
LocalNet
false
16,472
[ "BSD-3-Clause" ]
125
919e519717b66e14d92ac6fa404c328ee3f254a5
https://github.com/sjmoran/CURL/tree/919e519717b66e14d92ac6fa404c328ee3f254a5
MidNet4
import torch import torch.nn as nn class MidNet4(nn.Module): def forward(self, x_in): """Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor """ x = self.lrelu(self.conv1(x_in)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sjmoran/CURL
MidNet4
false
16,473
[ "BSD-3-Clause" ]
125
919e519717b66e14d92ac6fa404c328ee3f254a5
https://github.com/sjmoran/CURL/tree/919e519717b66e14d92ac6fa404c328ee3f254a5
XCA
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class XCA(nn.Module): """ Cross-Covariance Attention (XCA) operation where the channels are updated using a weighted sum. The weights are obtained from the (softmax normalized) Cross-covariance matrix (Q^T K \...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sithu31296/image_classification
XCA
false
16,474
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
ConvBlock
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super(Block, self).__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Repre...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
sjmoran/CURL
ConvBlock
false
16,475
[ "BSD-3-Clause" ]
125
919e519717b66e14d92ac6fa404c328ee3f254a5
https://github.com/sjmoran/CURL/tree/919e519717b66e14d92ac6fa404c328ee3f254a5
PoolFormerBlock
import torch from torch import Tensor from torch import nn class DropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). Copied from timm This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, the original na...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sithu31296/image_classification
PoolFormerBlock
false
16,476
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
stack_pool
import torch import torch.nn as nn class stack_pool(nn.Module): def __init__(self): super(stack_pool, self).__init__() self.pool2 = nn.MaxPool2d(2, stride=2) self.pool2s1 = nn.MaxPool2d(2, stride=1) self.pool3s1 = nn.MaxPool2d(3, stride=1, padding=1) self.padding = nn.Repl...
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...
siyuhuang/crowdcount-stackedpool
stack_pool
false
16,477
[ "MIT" ]
93
bbba3d9e91a5a89642b4bd3638ae8e68801ea7bf
https://github.com/siyuhuang/crowdcount-stackedpool/tree/bbba3d9e91a5a89642b4bd3638ae8e68801ea7bf
multi_pool
import torch import torch.nn as nn class multi_pool(nn.Module): def __init__(self): super(multi_pool, self).__init__() self.pool2 = nn.MaxPool2d(2, stride=2) self.pool4 = nn.MaxPool2d(4, stride=2, padding=1) self.pool8 = nn.MaxPool2d(8, stride=2, padding=3) def forward(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...
siyuhuang/crowdcount-stackedpool
multi_pool
false
16,478
[ "MIT" ]
93
bbba3d9e91a5a89642b4bd3638ae8e68801ea7bf
https://github.com/siyuhuang/crowdcount-stackedpool/tree/bbba3d9e91a5a89642b4bd3638ae8e68801ea7bf
ClipLayer
import torch import torch.nn as nn def clip_data(data, max_norm): norms = torch.norm(data.reshape(data.shape[0], -1), dim=-1) scale = (max_norm / norms).clamp(max=1.0) data *= scale.reshape(-1, 1, 1, 1) return data class ClipLayer(nn.Module): def __init__(self, max_norm): super(ClipLaye...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
skat00sh/Handcrafted-DP
ClipLayer
false
16,479
[ "MIT" ]
48
d1f8bc004adc240d5c424a10bdcc30fc266c8218
https://github.com/skat00sh/Handcrafted-DP/tree/d1f8bc004adc240d5c424a10bdcc30fc266c8218
MidNet2
import torch import torch.nn as nn class MidNet2(nn.Module): def forward(self, x_in): """Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor """ x = self.lrelu(self.conv1...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
sjmoran/CURL
MidNet2
false
16,480
[ "BSD-3-Clause" ]
125
919e519717b66e14d92ac6fa404c328ee3f254a5
https://github.com/sjmoran/CURL/tree/919e519717b66e14d92ac6fa404c328ee3f254a5
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): """Initialize parameters and build model. An nn.Module contains layers, and a method forward(input)that returns the output. Weights (learnable params) are inherently defined here. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sofya-pugach/spot_mini_mini
Actor
false
16,481
[ "MIT" ]
323
42770145e91ed2625ccc7e4f4d7016ce14a61464
https://github.com/sofya-pugach/spot_mini_mini/tree/42770145e91ed2625ccc7e4f4d7016ce14a61464
CA
import torch from torch import Tensor from torch import nn class CA(nn.Module): """ClassAttention as in CaiT """ def __init__(self, dim: 'int', heads: 'int'): super().__init__() self.num_heads = heads self.scale = (dim // heads) ** -0.5 self.qkv = nn.Linear(dim, dim * 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 from torch._inductor.runtime....
sithu31296/image_classification
CA
false
16,482
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
OutlookAttention
import math import torch from torch import Tensor from torch import nn from torch.nn import functional as F class OutlookAttention(nn.Module): def __init__(self, dim, num_heads, k=3, s=1, p=1): super().__init__() self.s = s self.k = k self.p = p self.num_heads = num_heads ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sithu31296/image_classification
OutlookAttention
false
16,483
[ "MIT" ]
57
6b8cbce96100225621cee3166a73e852ba216cc3
https://github.com/sithu31296/image_classification/tree/6b8cbce96100225621cee3166a73e852ba216cc3
GlobalAvgPool2d
import torch import torch.nn as nn import torch.utils class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): in_size = inputs.size() inputs = inp...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
songzijiang/FasterSeg
GlobalAvgPool2d
false
16,484
[ "MIT" ]
334
1a14ef6dd665afd229a16ab43b532b5a406512f8
https://github.com/songzijiang/FasterSeg/tree/1a14ef6dd665afd229a16ab43b532b5a406512f8
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): """Initialize parameters and build model. Args: state_dim (int): Dimension of each state action_dim (int): Dimension of each action Return: value output of network "...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
sofya-pugach/spot_mini_mini
Critic
false
16,485
[ "MIT" ]
323
42770145e91ed2625ccc7e4f4d7016ce14a61464
https://github.com/sofya-pugach/spot_mini_mini/tree/42770145e91ed2625ccc7e4f4d7016ce14a61464
USConv2d
import torch import torch.nn as nn import torch.utils def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value 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 import torch.utils assert_size_stride = torch._C._dynamo.g...
songzijiang/FasterSeg
USConv2d
false
16,486
[ "MIT" ]
334
1a14ef6dd665afd229a16ab43b532b5a406512f8
https://github.com/songzijiang/FasterSeg/tree/1a14ef6dd665afd229a16ab43b532b5a406512f8
PolicyNetwork
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal class PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003, log_std_min=-20, log_std_max=2): super(PolicyNetwork, self).__init__() self.log_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
sofya-pugach/spot_mini_mini
PolicyNetwork
false
16,487
[ "MIT" ]
323
42770145e91ed2625ccc7e4f4d7016ce14a61464
https://github.com/sofya-pugach/spot_mini_mini/tree/42770145e91ed2625ccc7e4f4d7016ce14a61464
SplitAndConcat
import torch import torch.nn as nn import torch.utils.data class SplitAndConcat(nn.Module): """Split the data from split_dim and concatenate in concat_dim. @param split_dim from which axis the data will be chunk @param concat_dim to which axis the data will be concatenated @param chunk size of the da...
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....
sstsai-adl/d2go
SplitAndConcat
false
16,488
[ "Apache-2.0" ]
687
6cff773797b14698043589afe57ea67cd76286f9
https://github.com/sstsai-adl/d2go/tree/6cff773797b14698043589afe57ea67cd76286f9
conv_head_pooling
import torch import torch.nn as nn import torch.utils.data class conv_head_pooling(nn.Module): def __init__(self, in_feature, out_feature, stride, conv_type, padding_mode='zeros', dilation=1): super(conv_head_pooling, self).__init__() if conv_type == 'depthwise': _groups = in_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
sstsai-adl/d2go
conv_head_pooling
false
16,489
[ "Apache-2.0" ]
687
6cff773797b14698043589afe57ea67cd76286f9
https://github.com/sstsai-adl/d2go/tree/6cff773797b14698043589afe57ea67cd76286f9
GCNLayer
import torch import torch.nn as nn class GCNLayer(nn.Module): def __init__(self, input_dim, output_dim, prop_depth=1, act=torch.relu, dropout=0.0, layer_i=0): super(GCNLayer, self).__init__() self.prop_depth = 1 self.weight = nn.Parameter(torch.empty(input_dim, output_dim, dtype ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
snap-stanford/distance-encoding
GCNLayer
false
16,490
[ "MIT" ]
177
b9ccb1b59422b11b40883d0284d7fc9ba88efdb6
https://github.com/snap-stanford/distance-encoding/tree/b9ccb1b59422b11b40883d0284d7fc9ba88efdb6
SigmoidFocalLoss
import torch import torch.nn as nn import torch.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = 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 ...
songzijiang/FasterSeg
SigmoidFocalLoss
false
16,491
[ "MIT" ]
334
1a14ef6dd665afd229a16ab43b532b5a406512f8
https://github.com/songzijiang/FasterSeg/tree/1a14ef6dd665afd229a16ab43b532b5a406512f8
MLP
import random import torch import numpy as np from torch import nn class MLP(nn.Module): def __init__(self, kernels, num_features, num_hiddens, normalize=True, num_updates=3000, batch_size=128, weight_decay=0.0001, soft_preds=False ): super().__init__() self.kernels = kernels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
snipsco/tract
MLP
false
16,492
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
588
7a54972764292bccf1737ff8bbcfa1e1736e3fad
https://github.com/snipsco/tract/tree/7a54972764292bccf1737ff8bbcfa1e1736e3fad
Residual_Covolution
import torch import torch.nn as nn class Residual_Covolution(nn.Module): def __init__(self, icol, ocol, num_classes): super(Residual_Covolution, self).__init__() self.conv1 = nn.Conv2d(icol, ocol, kernel_size=3, stride=1, padding =12, dilation=12, bias=True) self.conv2 = nn.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._inductor.runtime import triton_helpers import torch.nn as nn assert_...
speedinghzl/Pytorch-Deeplab
Residual_Covolution
false
16,493
[ "MIT" ]
310
14f2b81c676a6eb19f34940efb1297855f8fa05e
https://github.com/speedinghzl/Pytorch-Deeplab/tree/14f2b81c676a6eb19f34940efb1297855f8fa05e
MyWcploss
import torch from torch import nn class MyWcploss(nn.Module): def __init__(self): super(MyWcploss, self).__init__() def forward(self, pred, gt): eposion = 1e-10 torch.sigmoid(pred) count_pos = torch.sum(gt) * 1.0 + eposion count_neg = torch.sum(1.0 - gt) * 1.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
stevewongv/DSC-PyTorch
MyWcploss
false
16,494
[ "MIT" ]
75
4318225ce4fa5343db2cc723d8bcae4c884b23f4
https://github.com/stevewongv/DSC-PyTorch/tree/4318225ce4fa5343db2cc723d8bcae4c884b23f4
DistanceNetwork
import torch import torch.nn as nn class DistanceNetwork(nn.Module): def __init__(self): super(DistanceNetwork, self).__init__() def forward(self, support_set, input_image): """ Produces pdfs over the support set classes for the target set image. :param support_set: The embed...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
stamatiad/MatchingNetworks
DistanceNetwork
false
16,495
[ "MIT" ]
316
07c4567c15578664a550903c222c7eaa2abfe113
https://github.com/stamatiad/MatchingNetworks/tree/07c4567c15578664a550903c222c7eaa2abfe113
ConvNet
import torch import torch.optim import torch.nn as nn import torch.nn.functional as F class ConvNet(nn.Module): def __init__(self): super(ConvNet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = 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.optim import tor...
stanbiryukov/PyTorch-LBFGS
ConvNet
false
16,496
[ "MIT" ]
451
ea0ca553797b38d47682ce8ff553a4f53ec8c15c
https://github.com/stanbiryukov/PyTorch-LBFGS/tree/ea0ca553797b38d47682ce8ff553a4f53ec8c15c
ShallowCombination
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class ShallowCombination(nn.Module): """This Module can be used to generate a shallow combination from two embeddings using a gate.""" def __init__(self, bertram_config: 'BertramConfig'): super(ShallowCombination, self)....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
stefan-it/bertram
ShallowCombination
false
16,497
[ "Apache-2.0" ]
50
2e449cdc677577d1ca8b9daf852f324be4074940
https://github.com/stefan-it/bertram/tree/2e449cdc677577d1ca8b9daf852f324be4074940
PEGCNLayer
import torch import torch.nn as nn class PEGCNLayer(nn.Module): def __init__(self, input_dim, output_dim, prop_depth, act=torch.relu, dropout=0.0, layer_i=0): super(PEGCNLayer, self).__init__() self.prop_depth = prop_depth self.act = act self.weight = nn.Parameter(torch.em...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
snap-stanford/distance-encoding
PEGCNLayer
false
16,498
[ "MIT" ]
177
b9ccb1b59422b11b40883d0284d7fc9ba88efdb6
https://github.com/snap-stanford/distance-encoding/tree/b9ccb1b59422b11b40883d0284d7fc9ba88efdb6
Predict
import torch from torch import nn class Predict(nn.Module): def __init__(self, in_planes=32, out_planes=1, kernel_size=1): super(Predict, self).__init__() self.conv = nn.Conv2d(in_planes, out_planes, kernel_size) def forward(self, x): y = self.conv(x) return y def get_input...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
stevewongv/DSC-PyTorch
Predict
false
16,499
[ "MIT" ]
75
4318225ce4fa5343db2cc723d8bcae4c884b23f4
https://github.com/stevewongv/DSC-PyTorch/tree/4318225ce4fa5343db2cc723d8bcae4c884b23f4
LearnedPositionalEmbedding1D
import torch from torch import nn class LearnedPositionalEmbedding1D(nn.Module): """Adds (optionally learned) positional embeddings to the inputs.""" def __init__(self, seq_len, dim): super().__init__() self.pos_embedding = nn.Parameter(torch.zeros(1, seq_len, dim)) def forward(self, x):...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
styler00dollar/Colab-animesion
LearnedPositionalEmbedding1D
false
16,500
[ "MIT" ]
67
0fa603689fec3ed4ede098fd7c15b519dbb76a09
https://github.com/styler00dollar/Colab-animesion/tree/0fa603689fec3ed4ede098fd7c15b519dbb76a09
CNN
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils class CNN(nn.Module): def __init__(self, e_char, filters, padding=1, kernel_size=5): super(CNN, self).__init__() self.e_char = e_char self.filters = filters self.padding = padding self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
stxxllbu/CS224n-winter-together
CNN
false
16,501
[ "Apache-2.0" ]
468
eae158ed8e88dc7c8638e25bac4c4fc8eeddcc8c
https://github.com/stxxllbu/CS224n-winter-together/tree/eae158ed8e88dc7c8638e25bac4c4fc8eeddcc8c