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 |
|---|---|---|---|---|---|---|---|---|---|---|
ZeroConv2d | import torch
from torch import nn
from torch.nn import functional as F
class ZeroConv2d(nn.Module):
def __init__(self, in_channel, out_channel, padding=1):
super().__init__()
self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0)
self.conv.weight.data.zero_()
self.conv.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.triton_helpers import math as tl_math
from torch im... | hologerry/glow-pytorch-1 | ZeroConv2d | false | 3,616 | [
"MIT"
] | 0 | 9d3f95f4ff7f0a1361796a9b2554e3c229aad9b7 | https://github.com/hologerry/glow-pytorch-1/tree/9d3f95f4ff7f0a1361796a9b2554e3c229aad9b7 |
SmoothnessLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class SmoothnessLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred_label):
_n, _c, w, h = pred_label.size()
loss = torch.tensor(0.0, device=pred_label.device)
for i in range(w - 1):... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | hologerry/DewarpNet | SmoothnessLoss | false | 3,617 | [
"MIT"
] | 0 | b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 | https://github.com/hologerry/DewarpNet/tree/b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 |
AELoss | import torch
import torch.utils.data
from torch import nn
class AELoss(nn.Module):
def __init__(self, pull_factor, push_factor, distance, margin_push):
super(AELoss, self).__init__()
self.pull_factor = pull_factor
self.push_factor = push_factor
self.distance = distance
sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | houweidong/FCOS | AELoss | false | 3,618 | [
"BSD-2-Clause"
] | 0 | ad7d5e5d1b162398af408a9635ce8a2012f7db8a | https://github.com/houweidong/FCOS/tree/ad7d5e5d1b162398af408a9635ce8a2012f7db8a |
MCFullyConnected | import collections
import torch
import torch.utils.data
from torch import nn
def get_redistribution(kind: 'str', num_states: 'int', num_features: 'int'=
None, num_out: 'int'=None, normaliser: 'nn.Module'=None, **kwargs):
if kind == 'linear':
return LinearRedistribution(num_states, num_features, num_ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | hoedt/stable-nalu | MCFullyConnected | false | 3,619 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
AdaptiveInstanceNorm | import torch
from torch import nn
from math import sqrt
def equal_lr(module, name='weight'):
"""Rescale weights after every updates.
"""
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
wei... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | hologerry/style-based-gan-pytorch | AdaptiveInstanceNorm | false | 3,620 | [
"MIT"
] | 0 | 1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 | https://github.com/hologerry/style-based-gan-pytorch/tree/1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 |
EqualLinear | import torch
from torch import nn
from math import sqrt
def equal_lr(module, name='weight'):
"""Rescale weights after every updates.
"""
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
wei... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from math import sqrt
assert_size_stride = torch._C._dynamo... | hologerry/style-based-gan-pytorch | EqualLinear | false | 3,621 | [
"MIT"
] | 0 | 1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 | https://github.com/hologerry/style-based-gan-pytorch/tree/1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 |
CFRB | import torch
from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from torch import autograd as autograd
import torch.fft
from itertools import product as product
def sequential(*args):
"""Advanced nn.Sequential.
Args:
nn.Sequential, nn.Module
Returns:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | hduba/KAIR | CFRB | false | 3,622 | [
"MIT"
] | 0 | dbd7596c7e4a4667b9b7baac369fc6c02571fa58 | https://github.com/hduba/KAIR/tree/dbd7596c7e4a4667b9b7baac369fc6c02571fa58 |
EqualConv2d | import torch
from torch import nn
from math import sqrt
def equal_lr(module, name='weight'):
"""Rescale weights after every updates.
"""
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
wei... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from math import sqrt
assert_size_stride = torch._C._dynamo... | hologerry/style-based-gan-pytorch | EqualConv2d | false | 3,623 | [
"MIT"
] | 0 | 1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 | https://github.com/hologerry/style-based-gan-pytorch/tree/1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 |
NoiseInjection | import torch
from torch import nn
class NoiseInjection(nn.Module):
def __init__(self, channel):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1, channel, 1, 1))
def forward(self, image, noise):
return image + self.weight * noise
def get_inputs():
return [torch.rand(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | hologerry/style-based-gan-pytorch | NoiseInjection | false | 3,624 | [
"MIT"
] | 0 | 1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 | https://github.com/hologerry/style-based-gan-pytorch/tree/1a694fb3ea0288f1aaaa43aa67a570d908d9dc27 |
DocUnetLoss_DL_batch | import torch
import torch.nn as nn
import torch.nn.functional as F
class DocUnetLoss_DL_batch(nn.Module):
"""
只使用一个unet的loss 目前使用这个loss训练的比较好
"""
def __init__(self, r=0.0, reduction='mean'):
super(DocUnetLoss_DL_batch, self).__init__()
assert reduction in ['mean', 'sum'
],... | 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
... | hologerry/DewarpNet | DocUnetLoss_DL_batch | false | 3,625 | [
"MIT"
] | 0 | b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 | https://github.com/hologerry/DewarpNet/tree/b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 |
LgRegv | import torch
import torch.nn as nn
class LgRegv(torch.nn.Module):
"""
TODO: pre-training
from power to voronoi
"""
def __init__(self, dim, nla):
super(LgRegv, self).__init__()
self.linear = nn.Linear(dim, nla, bias=False)
def forward(self, x):
ba = -torch.sum((self.li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | horsepurve/DeepVoro | LgRegv | false | 3,626 | [
"MIT"
] | 0 | 1b67a8e0d51e1c966a2af96d4b6a495f8390f608 | https://github.com/horsepurve/DeepVoro/tree/1b67a8e0d51e1c966a2af96d4b6a495f8390f608 |
distLinear | import torch
import torch.nn as nn
from torch.nn.utils.weight_norm import WeightNorm
class distLinear(nn.Module):
def __init__(self, indim, outdim):
super(distLinear, self).__init__()
self.L = nn.Linear(indim, outdim, bias=False)
self.class_wise_learnable_norm = True
if self.class... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | horsepurve/DeepVoro | distLinear | false | 3,627 | [
"MIT"
] | 0 | 1b67a8e0d51e1c966a2af96d4b6a495f8390f608 | https://github.com/horsepurve/DeepVoro/tree/1b67a8e0d51e1c966a2af96d4b6a495f8390f608 |
Conv2d_fw | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv2d_fw(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, bias=True):
super(Conv2d_fw, self).__init__(in_channels, out_channels,
kernel_size, stride=stride, padding=pad... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | horsepurve/DeepVoro | Conv2d_fw | false | 3,628 | [
"MIT"
] | 0 | 1b67a8e0d51e1c966a2af96d4b6a495f8390f608 | https://github.com/horsepurve/DeepVoro/tree/1b67a8e0d51e1c966a2af96d4b6a495f8390f608 |
EdgeGCN | from torch.nn import Module
import torch
from torch.nn.modules.module import Module
import torch.nn as nn
class EdgeGCN(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out_features, include_adj=True, bias=True):
super(EdgeGCN, 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 math as tl_math
from torch.nn... | hou-yz/pygcn | EdgeGCN | false | 3,629 | [
"MIT"
] | 0 | 26195954035c5eaae2d6e086cfec24cad2642f2e | https://github.com/hou-yz/pygcn/tree/26195954035c5eaae2d6e086cfec24cad2642f2e |
DimReduction | import torch
import torch.nn as nn
class residual_block(nn.Module):
def __init__(self, nChn=512):
super(residual_block, self).__init__()
self.block = nn.Sequential(nn.Linear(nChn, nChn, bias=False), nn.
ReLU(inplace=True), nn.Linear(nChn, nChn, bias=False), nn.ReLU(
inplac... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | hrzhang1123/DTFD-MIL | DimReduction | false | 3,630 | [
"MIT"
] | 0 | 5cf22db83d0c031e69b17d5b668b546940d829bc | https://github.com/hrzhang1123/DTFD-MIL/tree/5cf22db83d0c031e69b17d5b668b546940d829bc |
RNNMLClassification | import torch
import torch.nn as nn
class RNNMLClassification(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(RNNMLClassification, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.output_size = output_size
self.i2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | hotbaby/kkb-nlp | RNNMLClassification | false | 3,631 | [
"MIT"
] | 0 | 614cd0f37aa969d21b2fbe3d9f8b2b08db1d0eb1 | https://github.com/hotbaby/kkb-nlp/tree/614cd0f37aa969d21b2fbe3d9f8b2b08db1d0eb1 |
FcCat | import torch
import torch.nn as nn
class FcCat(nn.Module):
def __init__(self, nIn, nOut):
super(FcCat, self).__init__()
self.fc = nn.Linear(nIn, nOut, bias=False)
def forward(self, x):
out = torch.cat((x, self.fc(x)), 1)
return out
def get_inputs():
return [torch.rand([... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | huangzsdy/pytorch_basic_learning | FcCat | false | 3,633 | [
"Apache-2.0"
] | 0 | 7880bc3fcee1d38623d93fa2a36482ccde0e335a | https://github.com/huangzsdy/pytorch_basic_learning/tree/7880bc3fcee1d38623d93fa2a36482ccde0e335a |
Fadein | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.data
class Fadein(nn.Module):
def __init__(self, cfg):
super(Fadein, self).__init__()
self.alpha = 0.0
def update_alpha(self, delta):
self.alpha = self.alpha + delta
self.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
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | hyunobae/SRGAN | Fadein | false | 3,634 | [
"MIT"
] | 0 | 9a967312c08e608833d2037398948617e1200c35 | https://github.com/hyunobae/SRGAN/tree/9a967312c08e608833d2037398948617e1200c35 |
MulMCFC | import collections
import torch
import torch.utils.data
from torch import nn
def get_redistribution(kind: 'str', num_states: 'int', num_features: 'int'=
None, num_out: 'int'=None, normaliser: 'nn.Module'=None, **kwargs):
if kind == 'linear':
return LinearRedistribution(num_states, num_features, num_ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | hoedt/stable-nalu | MulMCFC | false | 3,635 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
LinearPool | import torch
from torch import nn
class LinearPool(nn.Module):
def __init__(self):
super(LinearPool, self).__init__()
def forward(self, feat_map):
"""
Arguments:
feat_map(Tensor): tensor with shape (N, C, H, W)
return(Tensor): tensor with shape (N, C, 1, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | iampartho/EEE426 | LinearPool | false | 3,636 | [
"Apache-2.0"
] | 0 | a706660c0efcd4adea44d54c57a34bcaa4439ec1 | https://github.com/iampartho/EEE426/tree/a706660c0efcd4adea44d54c57a34bcaa4439ec1 |
LayerNormChannel | import torch
import torch.nn as nn
class LayerNormChannel(nn.Module):
"""
LayerNorm only for Channel Dimension.
Input: tensor in shape [B, C, H, W]
"""
def __init__(self, num_channels, eps=1e-05):
super().__init__()
self.weight = nn.Parameter(torch.ones(num_channels))
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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | hyenal/tensorflow-image-models | LayerNormChannel | false | 3,637 | [
"Apache-2.0"
] | 0 | 2012be8ecc7bc23e84dc2488d3e4fe1c80dbfb2c | https://github.com/hyenal/tensorflow-image-models/tree/2012be8ecc7bc23e84dc2488d3e4fe1c80dbfb2c |
GAT | from torch.nn import Module
import torch
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F
class EdgeGCN(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out_features, include_adj=True, bias=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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | hou-yz/pygcn | GAT | false | 3,638 | [
"MIT"
] | 0 | 26195954035c5eaae2d6e086cfec24cad2642f2e | https://github.com/hou-yz/pygcn/tree/26195954035c5eaae2d6e086cfec24cad2642f2e |
InvConv2d | import torch
from torch import nn
from torch.nn import functional as F
class InvConv2d(nn.Module):
def __init__(self, in_channel):
super().__init__()
weight = torch.randn(in_channel, in_channel)
q, _ = torch.qr(weight)
weight = q.unsqueeze(2).unsqueeze(3)
self.weight = 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 import nn
from torch.nn import functional as F
assert_size_stride = t... | hologerry/glow-pytorch-1 | InvConv2d | false | 3,639 | [
"MIT"
] | 0 | 9d3f95f4ff7f0a1361796a9b2554e3c229aad9b7 | https://github.com/hologerry/glow-pytorch-1/tree/9d3f95f4ff7f0a1361796a9b2554e3c229aad9b7 |
ExpPool | import torch
from torch import nn
class ExpPool(nn.Module):
def __init__(self):
super(ExpPool, self).__init__()
def forward(self, feat_map):
"""
Numerically stable implementation of the operation
Arguments:
feat_map(Tensor): tensor with shape (N, C, H, W)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | iampartho/EEE426 | ExpPool | false | 3,640 | [
"Apache-2.0"
] | 0 | a706660c0efcd4adea44d54c57a34bcaa4439ec1 | https://github.com/iampartho/EEE426/tree/a706660c0efcd4adea44d54c57a34bcaa4439ec1 |
CNNCifar | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.functional as F
class CNNCifar(nn.Module):
def __init__(self, args):
super(CNNCifar, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | EugeneYuZ/RL-FL | CNNCifar | false | 3,641 | [
"MIT"
] | 0 | cb4cc2a17eda1dbf60d696e361f31e433d8dbdea | https://github.com/EugeneYuZ/RL-FL/tree/cb4cc2a17eda1dbf60d696e361f31e433d8dbdea |
Pooling | import torch
import torch.nn as nn
class Pooling(nn.Module):
"""
Implementation of pooling for PoolFormer
--pool_size: pooling size
"""
def __init__(self, pool_size=3):
super().__init__()
self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size //
2, count_incl... | 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... | hyenal/tensorflow-image-models | Pooling | false | 3,642 | [
"Apache-2.0"
] | 0 | 2012be8ecc7bc23e84dc2488d3e4fe1c80dbfb2c | https://github.com/hyenal/tensorflow-image-models/tree/2012be8ecc7bc23e84dc2488d3e4fe1c80dbfb2c |
ExtResNetBlock | import torch
from torch import nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding=1):
"""
Create a lis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | hummat/convolutional_occupancy_networks | ExtResNetBlock | false | 3,643 | [
"MIT"
] | 0 | bb351edff59c196e01aa687943e19fee4ac11077 | https://github.com/hummat/convolutional_occupancy_networks/tree/bb351edff59c196e01aa687943e19fee4ac11077 |
PcamPool | import torch
from torch import nn
class PcamPool(nn.Module):
def __init__(self):
super(PcamPool, self).__init__()
def forward(self, feat_map, logit_map):
assert logit_map is not None
prob_map = torch.sigmoid(logit_map)
weight_map = prob_map / prob_map.sum(dim=2, keepdim=True)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | iampartho/EEE426 | PcamPool | false | 3,644 | [
"Apache-2.0"
] | 0 | a706660c0efcd4adea44d54c57a34bcaa4439ec1 | https://github.com/iampartho/EEE426/tree/a706660c0efcd4adea44d54c57a34bcaa4439ec1 |
CAModule | import torch
from torch import nn
class CAModule(nn.Module):
"""
Re-implementation of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
code reference:
https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | iampartho/EEE426 | CAModule | false | 3,645 | [
"Apache-2.0"
] | 0 | a706660c0efcd4adea44d54c57a34bcaa4439ec1 | https://github.com/iampartho/EEE426/tree/a706660c0efcd4adea44d54c57a34bcaa4439ec1 |
LogSumExpPool | import torch
from torch import nn
class LogSumExpPool(nn.Module):
def __init__(self, gamma):
super(LogSumExpPool, self).__init__()
self.gamma = gamma
def forward(self, feat_map):
"""
Numerically stable implementation of the operation
Arguments:
feat_map(Te... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | iampartho/EEE426 | LogSumExpPool | false | 3,647 | [
"Apache-2.0"
] | 0 | a706660c0efcd4adea44d54c57a34bcaa4439ec1 | https://github.com/iampartho/EEE426/tree/a706660c0efcd4adea44d54c57a34bcaa4439ec1 |
SoftCrossEntropyLoss | import torch
import torch.utils.data
class SoftCrossEntropyLoss(torch.nn.Module):
"""SoftCrossEntropyLoss (useful for label smoothing and mixup).
Identical to torch.nn.CrossEntropyLoss if used with one-hot labels."""
def __init__(self):
super(SoftCrossEntropyLoss, self).__init__()
def forwar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | i-murray/pycls | SoftCrossEntropyLoss | false | 3,648 | [
"MIT"
] | 0 | 858dac527eb11732ba08b94162d18b53454b9018 | https://github.com/i-murray/pycls/tree/858dac527eb11732ba08b94162d18b53454b9018 |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, input_size=50, hidden_size=256, dropout=0,
kernel_size=3, padding=1, activation_function=F.relu):
"""
Args:
input_size: dimention of input embedding
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 import triton_helpers
import torch.nn as nn
import ... | igorvlnascimento/DeepREF | CNN | false | 3,649 | [
"MIT"
] | 0 | 0fed8120571e44e12ee3d1861289bc101c0a275f | https://github.com/igorvlnascimento/DeepREF/tree/0fed8120571e44e12ee3d1861289bc101c0a275f |
ConvNet | import torch
import torch.nn as nn
class ConvNet(nn.Module):
def __init__(self):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(1, 5, 6, 2)
self.pool1 = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(5, 8, 3, 1)
self.drp1 = nn.Dropout2d(0.25)
self.pool2 = nn.Max... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | iOsnaaente/Faculdade_ECA-UFSM | ConvNet | false | 3,650 | [
"MIT"
] | 0 | aea8b8d66169b073c439b47ad990e45695cbe953 | https://github.com/iOsnaaente/Faculdade_ECA-UFSM/tree/aea8b8d66169b073c439b47ad990e45695cbe953 |
RAddFloat | import torch
import torch._utils
class RAddFloat(torch.nn.Module):
def __init__(self):
super(RAddFloat, self).__init__()
def forward(self, x):
y = 1.0 + x
y = y + y + 1
y = y + y + 1
x = y + x
return x
def get_inputs():
return [torch.rand([4, 4, 4, 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
import torch._utils
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_stri... | ijinjay/torch2mindspore | RAddFloat | false | 3,652 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, input_size, output_size):
super(Model, self).__init__()
hidden2_size = int(input_size / 2)
hidden1_size = int((input_size + hidden2_size) * 3 / 2)
hidden3_size = int((outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | iasakura/tiramisu | Model | false | 3,653 | [
"MIT"
] | 0 | 71aae95424dcca6ab920ab13e6e882006f13629d | https://github.com/iasakura/tiramisu/tree/71aae95424dcca6ab920ab13e6e882006f13629d |
Padding2 | import torch
import torch._utils
class Padding2(torch.nn.Module):
def __init__(self, input_channel):
super(Padding2, self).__init__()
self.requires_grad = False
self.conv = torch.nn.ConvTranspose2d(input_channel, input_channel,
1, stride=2, padding=0, groups=input_channel, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch._utils
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | ijinjay/torch2mindspore | Padding2 | false | 3,654 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
MolDQN | import torch
import torch.nn as nn
class MolDQN(nn.Module):
def __init__(self, input_length, output_length):
super(MolDQN, self).__init__()
self.linear_1 = nn.Linear(input_length, 1024)
self.linear_2 = nn.Linear(1024, 512)
self.linear_3 = nn.Linear(512, 128)
self.linear_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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | iamchosenlee/MolDQN-pytorch | MolDQN | false | 3,655 | [
"MIT"
] | 0 | 66bd1e067e439e49abc77d21089d3baf065317d4 | https://github.com/iamchosenlee/MolDQN-pytorch/tree/66bd1e067e439e49abc77d21089d3baf065317d4 |
Padding1 | import torch
import torch._utils
class Padding1(torch.nn.Module):
def __init__(self, input_channel):
super(Padding1, self).__init__()
self.requires_grad = False
self.conv = torch.nn.ConvTranspose2d(input_channel, input_channel,
1, stride=2, padding=0, groups=input_channel, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch._utils
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | ijinjay/torch2mindspore | Padding1 | false | 3,656 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
Padding3 | import torch
import torch._utils
class Padding3(torch.nn.Module):
def __init__(self, input_channel):
super(Padding3, self).__init__()
self.requires_grad = False
self.conv = torch.nn.ConvTranspose2d(input_channel, input_channel,
1, stride=2, padding=0, groups=input_channel, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch._utils
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | ijinjay/torch2mindspore | Padding3 | false | 3,657 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
SP | import torch
import torch.nn as nn
import torch._utils
def sp_init(x):
x01 = x[:, :, 0::2, :]
x02 = x[:, :, 1::2, :]
x_LL = x01[:, :, :, 0::2]
x_HL = x02[:, :, :, 0::2]
x_LH = x01[:, :, :, 1::2]
x_HH = x02[:, :, :, 1::2]
return torch.cat((x_LL, x_HL, x_LH, x_HH), 1)
class SP(nn.Module):
... | 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._dyn... | ijinjay/torch2mindspore | SP | false | 3,658 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
Padding4 | import torch
import torch._utils
class Padding4(torch.nn.Module):
def __init__(self, input_channel):
super(Padding4, self).__init__()
self.requires_grad = False
self.conv = torch.nn.ConvTranspose2d(input_channel, input_channel,
1, stride=2, padding=0, groups=input_channel, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch._utils
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | ijinjay/torch2mindspore | Padding4 | false | 3,659 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
Custom | import torch
import torch._utils
class Custom(torch.nn.Module):
def __init__(self):
super(Custom, self).__init__()
self.conv = torch.nn.Conv2d(3, 3, 1, 1)
self.conv1 = torch.nn.Conv2d(3, 3, 1, 1)
self.conv2 = torch.nn.Conv2d(3, 3, 1, 1)
self.relu = torch.nn.ReLU()
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._utils
assert_si... | ijinjay/torch2mindspore | Custom | false | 3,660 | [
"MIT"
] | 0 | e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 | https://github.com/ijinjay/torch2mindspore/tree/e4c06bd5e8a3b25b72bf158393a66c5cd1b572d2 |
SALayer | import torch
import torch.nn as nn
import torch.utils.model_zoo
class SALayer(nn.Module):
def __init__(self, channel, kernel_size=3):
super(SALayer, self).__init__()
self.conv_sa = nn.Conv2d(channel, channel, kernel_size, padding=1,
groups=channel)
def forward(self, x):
y... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.model_zoo
assert_size_stride = torch._C... | iariav/EDSR-PyTorch | SALayer | false | 3,661 | [
"MIT"
] | 0 | c709b3d43adb6c2457cf87c37c1f34a7bcfc48bb | https://github.com/iariav/EDSR-PyTorch/tree/c709b3d43adb6c2457cf87c37c1f34a7bcfc48bb |
Generator | import torch
import torch.nn as nn
class Generator(nn.Module):
"""Define standard linear + softmax generation step."""
def __init__(self, size, vocab):
super(Generator, self).__init__()
self.size = size
self.proj = nn.Linear(self.size, vocab)
def forward(self, x):
sliced_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | icdmtlog/icdm2021tlog | Generator | false | 3,662 | [
"Apache-2.0"
] | 0 | 6f92cce926b923d8f03689ddbeef3ac09d23712e | https://github.com/icdmtlog/icdm2021tlog/tree/6f92cce926b923d8f03689ddbeef3ac09d23712e |
GLU | import torch
from torch import Tensor
from torch import nn as nn
import torch.nn.functional as F
class MonteCarloDropout(nn.Dropout):
"""
Defines Monte Carlo dropout Module as defined
in the paper https://arxiv.org/pdf/1506.02142.pdf.
In summary, This technique uses the regular dropout
which can b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import Tensor
from torch import nn as nn
import torch.nn.functional a... | gdevos010/darts | GLU | false | 3,663 | [
"Apache-2.0"
] | 0 | 96c97c1e241500ae7b91d32bbfa21d811e4a7d71 | https://github.com/gdevos010/darts/tree/96c97c1e241500ae7b91d32bbfa21d811e4a7d71 |
ConvHeadPooling | import torch
import torch.nn as nn
from typing import Tuple
class ConvHeadPooling(nn.Module):
def __init__(self, in_feature, out_feature, stride, padding_mode='zeros'):
super(ConvHeadPooling, self).__init__()
self.conv = nn.Conv2d(in_feature, out_feature, kernel_size=stride +
1, paddi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | iliasprc/Compact-Transformers | ConvHeadPooling | false | 3,664 | [
"Apache-2.0"
] | 0 | 31975a0b4469854dfb0e0cbcedd8f0698cf84a7e | https://github.com/iliasprc/Compact-Transformers/tree/31975a0b4469854dfb0e0cbcedd8f0698cf84a7e |
ContrastiveLoss | import torch
from numpy.random import *
import torch.onnx
import torch.nn.functional as F
class ContrastiveLoss(torch.nn.Module):
def __init__(self, margin=2):
super(ContrastiveLoss, self).__init__()
self.margin = margin
def forward(self, output1, output2, label):
euclidean_distance ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from numpy.random import *
i... | ioarun/pcb-fault-detection | ContrastiveLoss | false | 3,665 | [
"MIT"
] | 0 | d05deb724f86c4f89bdb816c07229bfba6420c14 | https://github.com/ioarun/pcb-fault-detection/tree/d05deb724f86c4f89bdb816c07229bfba6420c14 |
SoftDetectionModule | import torch
import torch.nn.functional as F
import torch.nn as nn
class SoftDetectionModule(nn.Module):
def __init__(self, soft_local_max_size=3):
super(SoftDetectionModule, self).__init__()
self.soft_local_max_size = soft_local_max_size
self.pad = self.soft_local_max_size // 2
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | imelekhov/d2-net | SoftDetectionModule | false | 3,666 | [
"BSD-3-Clause-Clear"
] | 0 | 68a61797c40a4d6226c1774d84d97c4f493c9955 | https://github.com/imelekhov/d2-net/tree/68a61797c40a4d6226c1774d84d97c4f493c9955 |
Bilinear | import torch
from torch import Tensor
from torch import nn as nn
import torch.nn.functional as F
class MonteCarloDropout(nn.Dropout):
"""
Defines Monte Carlo dropout Module as defined
in the paper https://arxiv.org/pdf/1506.02142.pdf.
In summary, This technique uses the regular dropout
which can b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import Tensor
from torch import nn as nn
import torch.nn.functional a... | gdevos010/darts | Bilinear | false | 3,667 | [
"Apache-2.0"
] | 0 | 96c97c1e241500ae7b91d32bbfa21d811e4a7d71 | https://github.com/gdevos010/darts/tree/96c97c1e241500ae7b91d32bbfa21d811e4a7d71 |
AdaIN | import torch
import torch.nn as 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
import torch.nn as ... | innerverz/CodeTemplate | AdaIN | false | 3,668 | [
"MIT"
] | 0 | a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 | https://github.com/innerverz/CodeTemplate/tree/a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 |
TwoLayerCNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class TwoLayerCNN(nn.Module):
def __init__(self, C, M, embedding, channel, mtc_input, *args, **kwargs):
super(TwoLayerCNN, self).__init__()
self.C = C
self.M = M
self.embedding = embedding
self.mtc_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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | imvladikon/string-embed | TwoLayerCNN | false | 3,669 | [
"MIT"
] | 0 | 49e5ab0ada37b497dac51974aff16eeac65627a0 | https://github.com/imvladikon/string-embed/tree/49e5ab0ada37b497dac51974aff16eeac65627a0 |
ResBlk | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class ResBlk(nn.Module):
def __init__(self, dim_in, dim_out, actv=nn.LeakyReLU(0.2), normalize=
False, downsample=False):
super().__init__()
self.actv = actv
self.normalize = normalize
self.down... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | innerverz/CodeTemplate | ResBlk | false | 3,670 | [
"MIT"
] | 0 | a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 | https://github.com/innerverz/CodeTemplate/tree/a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 |
_GatedResidualNetwork | import torch
from torch import Tensor
from torch import nn as nn
import torch.nn.functional as F
class MonteCarloDropout(nn.Dropout):
"""
Defines Monte Carlo dropout Module as defined
in the paper https://arxiv.org/pdf/1506.02142.pdf.
In summary, This technique uses the regular dropout
which can b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import T... | gdevos010/darts | _GatedResidualNetwork | false | 3,671 | [
"Apache-2.0"
] | 0 | 96c97c1e241500ae7b91d32bbfa21d811e4a7d71 | https://github.com/gdevos010/darts/tree/96c97c1e241500ae7b91d32bbfa21d811e4a7d71 |
ApplyStyle | import torch
import torch.nn as nn
class ApplyStyle(nn.Module):
"""
@ref: https://github.com/lernapparat/lernapparat/blob/master/style_gan/pytorch_style_gan.ipynb
"""
def __init__(self, latent_size, channels):
super(ApplyStyle, self).__init__()
self.linear = nn.Linear(latent_size,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | innerverz/CodeTemplate | ApplyStyle | false | 3,672 | [
"MIT"
] | 0 | a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 | https://github.com/innerverz/CodeTemplate/tree/a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 |
_GateAddNorm | import torch
from torch import Tensor
from torch import nn as nn
import torch.nn.functional as F
class MonteCarloDropout(nn.Dropout):
"""
Defines Monte Carlo dropout Module as defined
in the paper https://arxiv.org/pdf/1506.02142.pdf.
In summary, This technique uses the regular dropout
which can b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import T... | gdevos010/darts | _GateAddNorm | false | 3,673 | [
"Apache-2.0"
] | 0 | 96c97c1e241500ae7b91d32bbfa21d811e4a7d71 | https://github.com/gdevos010/darts/tree/96c97c1e241500ae7b91d32bbfa21d811e4a7d71 |
GAT | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLay... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | iaongstudio/PaperRobot | GAT | false | 3,674 | [
"MIT"
] | 0 | d7d2a87822e1fb473e5c72ffc6b83d1022ecd3c1 | https://github.com/iaongstudio/PaperRobot/tree/d7d2a87822e1fb473e5c72ffc6b83d1022ecd3c1 |
GLU | import torch
import torch.nn.functional as F
import torch.nn as nn
class GLU(nn.Module):
def __init__(self, dim):
super(GLU, self).__init__()
self.dim = dim
def forward(self, x):
return F.glu(x, self.dim)
def get_inputs():
return [torch.rand([4, 4, 4, 4, 4])]
def get_init_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... | ishine/tfm-tts | GLU | false | 3,675 | [
"MIT"
] | 0 | a964736467851ddec8f8e8933b9550cbe7d7d7eb | https://github.com/ishine/tfm-tts/tree/a964736467851ddec8f8e8933b9550cbe7d7d7eb |
DownsampleA | import torch
import torch.nn as nn
class DownsampleA(nn.Module):
def __init__(self, nIn, nOut, stride):
super(DownsampleA, self).__init__()
assert stride == 2
self.avg = nn.AvgPool2d(kernel_size=1, stride=stride)
def forward(self, x):
x = self.avg(x)
return torch.cat(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | gianlucagiudice/PyCIL | DownsampleA | false | 3,676 | [
"MIT"
] | 0 | 0db88f239b935ea6d0047918a2a55a703f707b04 | https://github.com/gianlucagiudice/PyCIL/tree/0db88f239b935ea6d0047918a2a55a703f707b04 |
NAE | import torch
import torch.nn as nn
class NAE(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, gt):
diff = torch.abs(pred - gt)
loss = torch.mean(torch.abs(diff / gt))
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | j1a0m0e4sNTU/MachineLearning2019 | NAE | false | 3,677 | [
"MIT"
] | 0 | 44a7a3387837e53134bcf5eb8fcf95daf4dff48d | https://github.com/j1a0m0e4sNTU/MachineLearning2019/tree/44a7a3387837e53134bcf5eb8fcf95daf4dff48d |
FixedSubnetConv | import math
import torch
import torch.multiprocessing
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
class FixedSubnetConv(nn.Conv2d):
def __init__(self, *args, **kwargs):
super().__init__(*args... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.multiprocessing
import torch.nn as nn
import torch.nn.p... | isamu-isozaki/hidden-networks | FixedSubnetConv | false | 3,678 | [
"Apache-2.0"
] | 0 | 7dcb96a7de43b65ffde176d771f88b5ecedb84ab | https://github.com/isamu-isozaki/hidden-networks/tree/7dcb96a7de43b65ffde176d771f88b5ecedb84ab |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, channels, eps=1e-05):
super().__init__()
self.channels = channels
self.eps = eps
self.gamma = nn.Parameter(torch.ones(channels))
self.beta = nn.Parameter(torch.zeros(channels))
def forwa... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ishine/tfm-tts | LayerNorm | false | 3,679 | [
"MIT"
] | 0 | a964736467851ddec8f8e8933b9550cbe7d7d7eb | https://github.com/ishine/tfm-tts/tree/a964736467851ddec8f8e8933b9550cbe7d7d7eb |
WMAE | import torch
import torch.nn as nn
class WMAE(nn.Module):
def __init__(self):
super().__init__()
self.weight = [300, 1, 200]
def forward(self, pred, gt):
diff = torch.abs(pred - gt)
loss = 0
for i in range(3):
loss += torch.sum(diff[:, i] * self.weight[i])... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | j1a0m0e4sNTU/MachineLearning2019 | WMAE | false | 3,680 | [
"MIT"
] | 0 | 44a7a3387837e53134bcf5eb8fcf95daf4dff48d | https://github.com/j1a0m0e4sNTU/MachineLearning2019/tree/44a7a3387837e53134bcf5eb8fcf95daf4dff48d |
ResBlock | import torch
import torch.nn as nn
def set_activate_layer(types):
if types == 'relu':
activation = nn.ReLU()
elif types == 'lrelu':
activation = nn.LeakyReLU(0.2)
elif types == 'tanh':
activation = nn.Tanh()
elif types == 'sig':
activation = nn.Sigmoid()
elif types ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | innerverz/CodeTemplate | ResBlock | false | 3,681 | [
"MIT"
] | 0 | a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 | https://github.com/innerverz/CodeTemplate/tree/a20f5d24b0b79871aa39b5cde33e3bb4d2507d13 |
MSE | import torch
import torch.nn as nn
class MSE(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, gt):
loss = torch.mean(torch.pow(pred - gt, 2))
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | j1a0m0e4sNTU/MachineLearning2019 | MSE | false | 3,682 | [
"MIT"
] | 0 | 44a7a3387837e53134bcf5eb8fcf95daf4dff48d | https://github.com/j1a0m0e4sNTU/MachineLearning2019/tree/44a7a3387837e53134bcf5eb8fcf95daf4dff48d |
ComplexConv | import torch
import torch.nn as nn
import torch.utils.data
class ComplexConv(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True):
super(ComplexConv, self).__init__()
self.device = torch.device('cuda' if torch.cuda.is_a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | ishine/multiASR | ComplexConv | false | 3,683 | [
"Apache-2.0"
] | 0 | 991ea2b12ea8ea4a4beeeba42c156e632c389062 | https://github.com/ishine/multiASR/tree/991ea2b12ea8ea4a4beeeba42c156e632c389062 |
CausalSelfAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class CausalSelfAttention(nn.Module):
"""
A vanilla multi-head masked self-attention layer with a projection at the end.
It is possible to use torch.nn.MultiheadAttention here but I am including an
explicit implementation h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | itsdaniele/graphtrans | CausalSelfAttention | false | 3,684 | [
"Apache-2.0"
] | 0 | 9cdf68af725b258deced4424dbcd5942a481ff8d | https://github.com/itsdaniele/graphtrans/tree/9cdf68af725b258deced4424dbcd5942a481ff8d |
TransformerEncoderLayer | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from torch.nn import Identity
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""
Obtained from: github.com:r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | iliasprc/Compact-Transformers | TransformerEncoderLayer | false | 3,685 | [
"Apache-2.0"
] | 0 | 31975a0b4469854dfb0e0cbcedd8f0698cf84a7e | https://github.com/iliasprc/Compact-Transformers/tree/31975a0b4469854dfb0e0cbcedd8f0698cf84a7e |
Net | import torch
import torch.nn as nn
class FcCat(nn.Module):
def __init__(self, nIn, nOut):
super(FcCat, self).__init__()
self.fc = nn.Linear(nIn, nOut, bias=False)
def forward(self, x):
out = torch.cat((x, self.fc(x)), 1)
return out
class Net(nn.Module):
def __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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | huangzsdy/pytorch_basic_learning | Net | false | 3,686 | [
"Apache-2.0"
] | 0 | 7880bc3fcee1d38623d93fa2a36482ccde0e335a | https://github.com/huangzsdy/pytorch_basic_learning/tree/7880bc3fcee1d38623d93fa2a36482ccde0e335a |
CriticArchitecture | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
"""
Initializer function for weights in Pytorch
:param layer: number of hidden layers to implement
:return: None
"""
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | ivallesp/RL_Tennis | CriticArchitecture | false | 3,687 | [
"MIT"
] | 0 | a83933af9c4481d50f735983b4fc3b1f053f71d1 | https://github.com/ivallesp/RL_Tennis/tree/a83933af9c4481d50f735983b4fc3b1f053f71d1 |
MaskedTransformerEncoderLayer | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from torch.nn import Identity
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""
Obtained from: github.com:r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | iliasprc/Compact-Transformers | MaskedTransformerEncoderLayer | false | 3,688 | [
"Apache-2.0"
] | 0 | 31975a0b4469854dfb0e0cbcedd8f0698cf84a7e | https://github.com/iliasprc/Compact-Transformers/tree/31975a0b4469854dfb0e0cbcedd8f0698cf84a7e |
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... | jayden-chua/image-mask | BCELoss2d | false | 3,689 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
BinaryCrossEntropyLoss2d | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.backends.cudnn
import torch.utils.data
class BinaryCrossEntropyLoss2d(nn.Module):
def __init__(self, weight=None, size_average=True):
"""
Binary cross entropy loss 2D
Args:
weight:
size... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | jayden-chua/image-mask | BinaryCrossEntropyLoss2d | false | 3,690 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
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... | jayden-chua/image-mask | DiceScore | false | 3,691 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
DisConvModule | import torch
import torch.nn as nn
from torch.nn.utils import spectral_norm as spectral_norm_fn
from torch.nn.utils import weight_norm as weight_norm_fn
def dis_conv(input_dim, output_dim, kernel_size=5, stride=2, padding=0,
rate=1, activation='lrelu', weight_norm='none'):
return Conv2dBlock(input_dim, output... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn.utils import spectral_norm as spectral_norm_... | jacobwjs/generative-inpainting-pytorch | DisConvModule | false | 3,692 | [
"MIT"
] | 0 | 5cd5e818aa7394444b6c21df448d8b395492e4d7 | https://github.com/jacobwjs/generative-inpainting-pytorch/tree/5cd5e818aa7394444b6c21df448d8b395492e4d7 |
RelativeMultiHeadAttention | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class RelativeMultiHeadAttention(nn.Module):
def __init__(self, channels, num_heads, dropout):
super(RelativeMultiHeadAttention, self).__init__()
assert channels % num_heads == 0, 'd_model % num_heads should be zero.'
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 math
i... | ishine/tfm-tts | RelativeMultiHeadAttention | false | 3,693 | [
"MIT"
] | 0 | a964736467851ddec8f8e8933b9550cbe7d7d7eb | https://github.com/ishine/tfm-tts/tree/a964736467851ddec8f8e8933b9550cbe7d7d7eb |
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... | jayden-chua/image-mask | WeightedSoftDiceLoss | false | 3,694 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
QuaternionLinear | from torch.nn import Module
import torch
import numpy as np
from numpy.random import RandomState
from torch.nn.parameter import Parameter
def quaternion_init(in_features, out_features, rng, kernel_size=None,
criterion='glorot'):
if kernel_size is not None:
receptive_field = np.prod(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.nn import Module
import numpy as np
from numpy.random import RandomSt... | ispamm/DualQSELD-TCN | QuaternionLinear | false | 3,695 | [
"MIT"
] | 0 | fc5dc8840b4fdd8cb09f8f92e628561417df268a | https://github.com/ispamm/DualQSELD-TCN/tree/fc5dc8840b4fdd8cb09f8f92e628561417df268a |
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, weight=None, size_average=True):
super(SoftDiceLoss, self).__init__()
def forward(self, logits, targets):
smooth = 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
import torch.nn as nn
import torch.backends.cudnn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
em... | jayden-chua/image-mask | SoftDiceLoss | false | 3,696 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
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... | jayden-chua/image-mask | DiceLoss | false | 3,697 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
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 ... | jayden-chua/image-mask | Conv3BN | false | 3,698 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
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
... | jayden-chua/image-mask | WeightedBCELoss2d | false | 3,699 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
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... | jayden-chua/image-mask | BCEDiceLoss | false | 3,700 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
DenseCrossEntropy | import torch
from torch import nn
import torch.functional as F
import torch.nn.functional as F
class DenseCrossEntropy(nn.Module):
def __init__(self):
super(DenseCrossEntropy, self).__init__()
def forward(self, logits, labels):
logits = logits.float()
labels = labels.float()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | grok-phantom/pytorch_tempest | DenseCrossEntropy | false | 3,701 | [
"MIT"
] | 0 | 37921b5824f9fcb853da3f54d929c4855672416e | https://github.com/grok-phantom/pytorch_tempest/tree/37921b5824f9fcb853da3f54d929c4855672416e |
LightHead | import torch
from torch import nn
class RMSNorm(nn.Module):
"""An implementation of RMS Normalization.
# https://catalyst-team.github.io/catalyst/_modules/catalyst/contrib/nn/modules/rms_norm.html#RMSNorm
"""
def __init__(self, dimension: 'int', epsilon: 'float'=1e-08, is_bias:
'bool'=False)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | grok-phantom/pytorch_tempest | LightHead | false | 3,702 | [
"MIT"
] | 0 | 37921b5824f9fcb853da3f54d929c4855672416e | https://github.com/grok-phantom/pytorch_tempest/tree/37921b5824f9fcb853da3f54d929c4855672416e |
RelativeSelfAttentionLayer | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, channels, eps=1e-05):
super().__init__()
self.channels = channels
self.eps = eps
self.gamma = nn.Parameter(torch.ones(channels))
self.beta = nn.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.... | ishine/tfm-tts | RelativeSelfAttentionLayer | false | 3,703 | [
"MIT"
] | 0 | a964736467851ddec8f8e8933b9550cbe7d7d7eb | https://github.com/ishine/tfm-tts/tree/a964736467851ddec8f8e8933b9550cbe7d7d7eb |
CosineActivation | import torch
from torch import nn
def t2v(tau, f, out_features, w, b, w0, b0, arg=None):
if arg:
v1 = f(torch.matmul(tau, w) + b, arg)
else:
v1 = f(torch.matmul(tau, w) + b)
v2 = torch.matmul(tau, w0) + b0
return torch.cat([v1, v2], 1)
class CosineActivation(nn.Module):
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | jaredfeng-ca/Time2Vec-PyTorch | CosineActivation | false | 3,704 | [
"MIT"
] | 0 | b42205f6721f5a6faf16134e604af28476490d0a | https://github.com/jaredfeng-ca/Time2Vec-PyTorch/tree/b42205f6721f5a6faf16134e604af28476490d0a |
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 ... | jayden-chua/image-mask | UNetModule | false | 3,705 | [
"MIT"
] | 0 | ce2c6a32bf13df582e7b57e506d58518258be292 | https://github.com/jayden-chua/image-mask/tree/ce2c6a32bf13df582e7b57e506d58518258be292 |
SineActivation | import torch
from torch import nn
def t2v(tau, f, out_features, w, b, w0, b0, arg=None):
if arg:
v1 = f(torch.matmul(tau, w) + b, arg)
else:
v1 = f(torch.matmul(tau, w) + b)
v2 = torch.matmul(tau, w0) + b0
return torch.cat([v1, v2], 1)
class SineActivation(nn.Module):
def __init... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | jaredfeng-ca/Time2Vec-PyTorch | SineActivation | false | 3,706 | [
"MIT"
] | 0 | b42205f6721f5a6faf16134e604af28476490d0a | https://github.com/jaredfeng-ca/Time2Vec-PyTorch/tree/b42205f6721f5a6faf16134e604af28476490d0a |
PairwiseDistance | import torch
import torch.nn as nn
class PairwiseDistance(nn.Module):
"""class for calculating distance
Arguments:
nn {[type]} -- [description]
"""
def __init__(self, smooth=0.0001):
"""Initializer
Arguments:
smooth {int} -- [description]
"""
supe... | 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
assert_size_stride = torch._C._dynamo.gu... | jce2090/palmprint-recognition | PairwiseDistance | false | 3,707 | [
"MIT"
] | 0 | d2d93c6817afe1b67650dae6516a3d180aaeca38 | https://github.com/jce2090/palmprint-recognition/tree/d2d93c6817afe1b67650dae6516a3d180aaeca38 |
DAImgHead | import torch
import torch.nn as nn
import torchvision.transforms.functional as F
import torch.nn.functional as F
import torch.cuda.amp
class DAImgHead(nn.Module):
"""
Add a simple Image-level Domain Classifier head
"""
def __init__(self, in_channels):
"""
Arguments:
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 import triton_helpers
import torch.nn as nn
import ... | enpko47/DA-CenterNet | DAImgHead | false | 3,708 | [
"MIT"
] | 0 | ef0a99b8ba741fa1dbd66fa58ccae9bf8759ae86 | https://github.com/enpko47/DA-CenterNet/tree/ef0a99b8ba741fa1dbd66fa58ccae9bf8759ae86 |
ShiftSoftplus | import torch
import numpy as np
from torch.nn import Softplus
class ShiftSoftplus(Softplus):
"""
Shiftsoft plus activation function:
1/beta * (log(1 + exp**(beta * x)) - log(shift))
"""
def __init__(self, beta=1, shift=2, threshold=20):
super().__init__(beta, threshold)
self.s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.nn import Softplus
assert_size_stride = torch._C._d... | jeah-z/BDE-FGCN-DFT | ShiftSoftplus | false | 3,709 | [
"MIT"
] | 0 | 5542544079642a371f08c8c1f356fa235d895194 | https://github.com/jeah-z/BDE-FGCN-DFT/tree/5542544079642a371f08c8c1f356fa235d895194 |
PyTorchMlp | import torch
import torch.nn as nn
class PyTorchMlp(nn.Module):
def __init__(self, n_inputs=4, n_actions=2):
nn.Module.__init__(self)
self.fc1 = nn.Linear(n_inputs, 512)
self.fc2 = nn.Linear(512, 256)
self.fc3 = nn.Linear(256, n_actions)
self.activ_fn = nn.ReLU()
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jasonjabbour/motion_imitation | PyTorchMlp | false | 3,710 | [
"Apache-2.0"
] | 0 | a28e7cd9dca2fbdd6823f19db4f66b496dd29144 | https://github.com/jasonjabbour/motion_imitation/tree/a28e7cd9dca2fbdd6823f19db4f66b496dd29144 |
DNHloss | import torch
import torch.nn as nn
class DNHloss(nn.Module):
"""DNH loss function
Arguments:
nn {[type]} -- [description]
"""
def __init__(self, lamda):
"""Initializer class
Arguments:
lamda {[type]} -- [description]
"""
super(DNHloss, self).__ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | jce2090/palmprint-recognition | DNHloss | false | 3,711 | [
"MIT"
] | 0 | d2d93c6817afe1b67650dae6516a3d180aaeca38 | https://github.com/jce2090/palmprint-recognition/tree/d2d93c6817afe1b67650dae6516a3d180aaeca38 |
folder | import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
class folder(nn.Module):
def __init__(self):
super().__init__()
def forward(self, feature_map):
N, _, H, W = feature_map.size()
feature_map = F.unfold(feature_map, kernel_size=3, padding=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 import nn
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | hav4ik/AdelaiDet | folder | false | 3,712 | [
"BSD-2-Clause"
] | 0 | 6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2 | https://github.com/hav4ik/AdelaiDet/tree/6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2 |
TripletMarginLoss | import torch
import torch.nn as nn
class PairwiseDistance(nn.Module):
"""class for calculating distance
Arguments:
nn {[type]} -- [description]
"""
def __init__(self, smooth=0.0001):
"""Initializer
Arguments:
smooth {int} -- [description]
"""
supe... | 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... | jce2090/palmprint-recognition | TripletMarginLoss | false | 3,713 | [
"MIT"
] | 0 | d2d93c6817afe1b67650dae6516a3d180aaeca38 | https://github.com/jce2090/palmprint-recognition/tree/d2d93c6817afe1b67650dae6516a3d180aaeca38 |
NeuralNerwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class NeuralNerwork(nn.Module):
def __init__(self, n_features, n_targets):
super(NeuralNerwork, self).__init__()
self.fc1 = nn.Linear(n_features, 15)
self.fc2 = nn.Linear(15, 10)
self.fc3 = nn.Linear(10, n_targets)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | jf20541/NeuralNetworks | NeuralNerwork | false | 3,714 | [
"MIT"
] | 0 | ee36b734880f30d9e8691205dadcd074795bdff3 | https://github.com/jf20541/NeuralNetworks/tree/ee36b734880f30d9e8691205dadcd074795bdff3 |
ScModel | import torch
import torch as t
import torch.nn as nn
from torch.nn.parameter import Parameter
class ScModel(nn.Module):
""" Model for single cell data """
def __init__(self, n_genes: 'int', n_celltypes: 'int', device: 't.device'
) ->None:
super().__init__()
self.K = n_celltypes
... | 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... | jfnavarro/stereoscope | ScModel | false | 3,715 | [
"MIT"
] | 0 | 0a64db45291c3a9b72abdf13183614a10f3dac40 | https://github.com/jfnavarro/stereoscope/tree/0a64db45291c3a9b72abdf13183614a10f3dac40 |
GCN | import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
class Conv2D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, padding=
'same', stride=1, dilation=1, groups=1):
super(Conv2D, self).__init__()
assert type(kernel_size) in [int,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
as... | hav4ik/AdelaiDet | GCN | false | 3,716 | [
"BSD-2-Clause"
] | 0 | 6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2 | https://github.com/hav4ik/AdelaiDet/tree/6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2 |
maxout | import torch
import torch.nn as nn
import torch.utils.data
class maxout(nn.Module):
def __init__(self, in_feature, out_feature, pool_size):
super(maxout, self).__init__()
self.in_feature = in_feature
self.out_feature = out_feature
self.pool_size = pool_size
self.linear = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | jiahuanluo/Global-Encoding | maxout | false | 3,717 | [
"MIT"
] | 0 | 2adb01def9525588b3a75e6f2a5181a3a11464ed | https://github.com/jiahuanluo/Global-Encoding/tree/2adb01def9525588b3a75e6f2a5181a3a11464ed |
Gather | import torch
import torch.nn as nn
class Gather(torch.nn.Module):
"""
gather
"""
@staticmethod
def modify_commandline_options(parser, is_train):
return parser
def __init__(self, F, K, use_mask=False):
super().__init__()
self.K = K
self.F = F
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jhp038/fashion_project | Gather | false | 3,718 | [
"MIT"
] | 0 | 719533dc60155801f567e6a9183d7a5036ee1166 | https://github.com/jhp038/fashion_project/tree/719533dc60155801f567e6a9183d7a5036ee1166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.