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 |
|---|---|---|---|---|---|---|---|---|---|---|
DotAtte | import math
import torch
from torch import nn
import torch.utils.data
def seq_mask(seq_len, max_len):
"""Create sequence mask.
:param seq_len: list or torch.Tensor, the lengths of sequences in a batch.
:param max_len: int, the maximum sequence length in a batch.
:return: mask, torch.LongTensor, [batc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | LindaCY/fastNLP | DotAtte | false | 17,620 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
BinaryCrossEntropyLoss2d | import torch
import torch.nn as nn
class BinaryCrossEntropyLoss2d(nn.Module):
def __init__(self, weight=None, size_average=True):
super().__init__()
self.bce_loss = nn.BCELoss(weight, size_average)
def forward(self, inputs, targets):
return self.bce_loss(inputs, targets)
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Luoxd1996/Rank2nuclearSegmentation | BinaryCrossEntropyLoss2d | false | 17,621 | [
"MIT"
] | 5 | bd85ac13eec7ce18c286efd521a27486483da904 | https://github.com/Luoxd1996/Rank2nuclearSegmentation/tree/bd85ac13eec7ce18c286efd521a27486483da904 |
BiAffine | import torch
from torch import nn
import torch.utils.data
from torch.nn import Parameter
class BiAffine(nn.Module):
def __init__(self, n_enc, n_dec, n_labels, biaffine=True, **kwargs):
"""
:param int n_enc: the dimension of the encoder input.
:param int n_dec: the dimension of the decode... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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
from torch.nn import Parameter
asse... | LindaCY/fastNLP | BiAffine | false | 17,622 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
FocalLoss | import torch
import torch.nn as nn
from torch.nn.functional import binary_cross_entropy
class FocalLoss(nn.Module):
"""
Focal Loss for Dense Object Detection [https://arxiv.org/abs/1708.02002]
Digest the paper as below:
α, balances the importance of positive/negative examples
γ, focusing p... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Luoxd1996/Rank2nuclearSegmentation | FocalLoss | false | 17,623 | [
"MIT"
] | 5 | bd85ac13eec7ce18c286efd521a27486483da904 | https://github.com/Luoxd1996/Rank2nuclearSegmentation/tree/bd85ac13eec7ce18c286efd521a27486483da904 |
Conv | import torch
from torch import nn
import torch.utils.data
import torch.nn.init as init
def initial_parameter(net, initial_method=None):
"""A method used to initialize the weights of PyTorch models.
:param net: a PyTorch model
:param str initial_method: one of the following initializations.
-... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | LindaCY/fastNLP | Conv | false | 17,624 | [
"Apache-2.0"
] | 4 | 3fa95b6cfc31211453bc21792e3eef87948858da | https://github.com/LindaCY/fastNLP/tree/3fa95b6cfc31211453bc21792e3eef87948858da |
GeM | import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import Parameter
def gem(x, p=3, eps=1e-06):
return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow(
1.0 / p)
class GeM(nn.Module):
def __init__(self, p=3, eps=1e-06):
super(GeM, self).__init... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.functional a... | LightnessOfBeing/kaggle-bengali-classification | GeM | false | 17,625 | [
"MIT"
] | 5 | 342bc2a9bf57f9f03fa25f5271cb178ab8f7b4ff | https://github.com/LightnessOfBeing/kaggle-bengali-classification/tree/342bc2a9bf57f9f03fa25f5271cb178ab8f7b4ff |
JointMseLoss | import torch
import torch.utils.data
import torch.nn as nn
class JointMseLoss(nn.Module):
def __init__(self):
super(JointMseLoss, self).__init__()
self.mseLoss = nn.MSELoss()
def forward(self, pre1, pre2, gt, sobel_gt):
loss1 = self.mseLoss(pre1, sobel_gt)
loss2 = self.mseLos... | 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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | Lysemo/StructureAwareDCNN | JointMseLoss | false | 17,626 | [
"Apache-2.0"
] | 6 | f2437d39eb246ac6cd9e63b44070f1aca8838475 | https://github.com/Lysemo/StructureAwareDCNN/tree/f2437d39eb246ac6cd9e63b44070f1aca8838475 |
SoftDiceLoss | import torch
import torch.nn as nn
class SoftDiceLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super().__init__()
def forward(self, inputs, targets):
smooth = 1.0
num = targets.size(0)
m1 = inputs.view(num, -1)
m2 = targets.view(num, -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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Luoxd1996/Rank2nuclearSegmentation | SoftDiceLoss | false | 17,627 | [
"MIT"
] | 5 | bd85ac13eec7ce18c286efd521a27486483da904 | https://github.com/Luoxd1996/Rank2nuclearSegmentation/tree/bd85ac13eec7ce18c286efd521a27486483da904 |
LossDice | import torch
import torch.nn as nn
class LossAbstract(nn.Module):
"""A named loss function, that loss functions should inherit from.
Args:
device (str): device key
"""
def __init__(self, device='cuda:0'):
super().__init__()
self.device = device
self.name = 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... | MECLabTUDA/OOD-Gen | LossDice | false | 17,628 | [
"MIT"
] | 5 | f85ea9106ae1425f18e34c9d82fa3ca4925d8d9e | https://github.com/MECLabTUDA/OOD-Gen/tree/f85ea9106ae1425f18e34c9d82fa3ca4925d8d9e |
TCL | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
from torch.nn.init import *
class TCL(nn.Module):
def __init__(self, conv_size, dim):
super(TCL, self).__init__()
self.conv2d = nn.Conv2d(dim, dim, kernel_size=(conv_size, 1),
padding=(conv_size // 2, 0))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
from torch.nn.... | Luoyadan/MM2020_ABG | TCL | false | 17,629 | [
"MIT"
] | 8 | d74cf915deea7bb425518f5bd40e64a9a7341981 | https://github.com/Luoyadan/MM2020_ABG/tree/d74cf915deea7bb425518f5bd40e64a9a7341981 |
LossL1 | import torch
import torch.nn as nn
class LossAbstract(nn.Module):
"""A named loss function, that loss functions should inherit from.
Args:
device (str): device key
"""
def __init__(self, device='cuda:0'):
super().__init__()
self.device = device
self.name = 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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | MECLabTUDA/OOD-Gen | LossL1 | false | 17,630 | [
"MIT"
] | 5 | f85ea9106ae1425f18e34c9d82fa3ca4925d8d9e | https://github.com/MECLabTUDA/OOD-Gen/tree/f85ea9106ae1425f18e34c9d82fa3ca4925d8d9e |
MNIST_CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class MNIST_CNN(nn.Module):
"""
Hand-tuned architecture for MNIST.
Weirdness I've noticed so far with this architecture:
- adding a linear layer after the mean-pool in features hurts
RotatedMNIST-100 gen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Luodian/IIB | MNIST_CNN | false | 17,631 | [
"MIT"
] | 3 | a7457e56f4e389bea484e9f9cdbd01485114d6dc | https://github.com/Luodian/IIB/tree/a7457e56f4e389bea484e9f9cdbd01485114d6dc |
BCEDiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCEDiceLoss(nn.Module):
def __init__(self):
super(BCEDiceLoss, self).__init__()
def forward(self, input, target):
bce = F.binary_cross_entropy_with_logits(input, target)
smooth = 1e-05
num = target.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... | Luoxd1996/Rank2nuclearSegmentation | BCEDiceLoss | false | 17,632 | [
"MIT"
] | 5 | bd85ac13eec7ce18c286efd521a27486483da904 | https://github.com/Luoxd1996/Rank2nuclearSegmentation/tree/bd85ac13eec7ce18c286efd521a27486483da904 |
DenseConvBlock | import torch
from torch import nn
class DenseConvBlock(nn.Module):
def __init__(self, in_channels: 'int', out_channels: 'int'=16,
growth_channels: 'int'=16):
super(DenseConvBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels, out_channels, (3, 3), (1, 1), (
1, 1))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | Lornatang/SRDenseNet-PyTorch | DenseConvBlock | false | 17,633 | [
"Apache-2.0"
] | 4 | d7876bda4c48195a3652aed4e207f7509ac23e4b | https://github.com/Lornatang/SRDenseNet-PyTorch/tree/d7876bda4c48195a3652aed4e207f7509ac23e4b |
TVLoss | import torch
from torch import nn
class TVLoss(nn.Module):
def __init__(self, tvloss_weight=1):
super(TVLoss, self).__init__()
self.tvloss_weight = tvloss_weight
def forward(self, generated):
b, c, h, w = generated.size()
h_tv = torch.pow(generated[:, :, 1:, :] - generated[:,... | 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... | MKFMIKU/Enhancing-Loss.pytorch | TVLoss | false | 17,634 | [
"MIT"
] | 6 | 1e8b7cbdc53f6ef912955c19193e0a538e38dc7e | https://github.com/MKFMIKU/Enhancing-Loss.pytorch/tree/1e8b7cbdc53f6ef912955c19193e0a538e38dc7e |
DAModule | import torch
import numpy as np
from torch import nn
from torch.nn import init
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | LeftAttention/Attention-Codebase | DAModule | false | 17,635 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
Critic | import torch
from torch import nn
class Critic(nn.Module):
def __init__(self, obs_dim: 'int'):
super().__init__()
self.fc1 = nn.Linear(obs_dim, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, 1)
def forward(self, x):
x = torch.tanh(self.fc1(x))
x = 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.triton_helpers import libdevice
from torch import n... | MIMUW-RL/spp-rl | Critic | false | 17,636 | [
"MIT"
] | 7 | 86b96cdd220cc4eae86f7cfd26924c69b498dcc6 | https://github.com/MIMUW-RL/spp-rl/tree/86b96cdd220cc4eae86f7cfd26924c69b498dcc6 |
ModulatedConv2d | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
from to... | Liamkuo/SAIR | ModulatedConv2d | false | 17,637 | [
"MIT"
] | 6 | 0fb289cd975b5a196b58e7d16bac00e31fd41d39 | https://github.com/Liamkuo/SAIR/tree/0fb289cd975b5a196b58e7d16bac00e31fd41d39 |
ComboLoss | import torch
import torch.nn as nn
def l1_loss(A_tensors, B_tensors):
return torch.abs(A_tensors - B_tensors)
class ComboLoss(nn.Module):
def __init__(self, alpha=1.0, beta=1.0, gamma=1.0, from_logits=True, **
kwargs):
super().__init__(**kwargs)
self.alpha = alpha
self.beta ... | 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... | MPWARE-TEAM/HPA2021 | ComboLoss | false | 17,638 | [
"Apache-2.0"
] | 7 | 06c45c5465d9b586f35cba3da5129ea28a1cd85b | https://github.com/MPWARE-TEAM/HPA2021/tree/06c45c5465d9b586f35cba3da5129ea28a1cd85b |
ResidualAttention | import torch
from torch import nn
class ResidualAttention(nn.Module):
def __init__(self, channel=512, num_class=1000, la=0.2):
super().__init__()
self.la = la
self.fc = nn.Conv2d(in_channels=channel, out_channels=num_class,
kernel_size=1, stride=1, bias=False)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | LeftAttention/Attention-Codebase | ResidualAttention | false | 17,639 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
BasicAcM | import numpy
import torch
from torch import nn
class BasicAcM(nn.Module):
def __init__(self, in_dim: 'int', ac_dim: 'int', discrete: 'bool'=True):
super().__init__()
self.discrete = discrete
h1s = 100
h2s = 50
self.fc1 = nn.Linear(in_dim, h1s)
self.fc2 = nn.Linear(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy
from t... | MIMUW-RL/spp-rl | BasicAcM | false | 17,640 | [
"MIT"
] | 7 | 86b96cdd220cc4eae86f7cfd26924c69b498dcc6 | https://github.com/MIMUW-RL/spp-rl/tree/86b96cdd220cc4eae86f7cfd26924c69b498dcc6 |
Attention | import math
import torch
import torch as t
import torch.nn as nn
class Linear(nn.Module):
"""
Linear Module
"""
def __init__(self, in_dim, out_dim, bias=True, w_init='linear'):
"""
:param in_dim: dimension of input
:param out_dim: dimension of output
:param bias: boole... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MIT-Omnipush/omnipush-metalearning-baselines | Attention | false | 17,641 | [
"MIT"
] | 4 | b3ba5db7aa5137f1d259470bc6f4bb7019826ab3 | https://github.com/MIT-Omnipush/omnipush-metalearning-baselines/tree/b3ba5db7aa5137f1d259470bc6f4bb7019826ab3 |
Swish | import torch
import torch.nn as nn
import torch.nn.functional as F
class Swish(nn.Module):
def __init__(self):
super().__init__()
self.beta = nn.Parameter(torch.tensor([0.5]))
def forward(self, x):
return (x * torch.sigmoid_(x * F.softplus(self.beta))).div_(1.1)
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.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | MLIA/LEADS | Swish | false | 17,642 | [
"MIT"
] | 6 | 4010f6b6e6a56ee049b4b4a9aec1c24b34730616 | https://github.com/MLIA/LEADS/tree/4010f6b6e6a56ee049b4b4a9aec1c24b34730616 |
SEModule | import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
import torch.utils.data
from collections import OrderedDict
def make_divisible(v, divisor, min_val=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is div... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | MAC-AutoML/XNAS | SEModule | false | 17,643 | [
"MIT"
] | 9 | 2c54ceb09b255cbcabd67f3c39fc777c4b2403f4 | https://github.com/MAC-AutoML/XNAS/tree/2c54ceb09b255cbcabd67f3c39fc777c4b2403f4 |
AcM | import torch
from torch import nn
class AcM(nn.Module):
def __init__(self, in_dim: 'int', ac_dim: 'int', ac_lim: 'int',
discrete: 'bool'=True):
super().__init__()
self.ac_lim = ac_lim
self.discrete = discrete
self.fc1 = nn.Linear(in_dim, 64)
self.fc2 = nn.Linear(64... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MIMUW-RL/spp-rl | AcM | false | 17,644 | [
"MIT"
] | 7 | 86b96cdd220cc4eae86f7cfd26924c69b498dcc6 | https://github.com/MIMUW-RL/spp-rl/tree/86b96cdd220cc4eae86f7cfd26924c69b498dcc6 |
TokenEmbedding | import torch
import torch.nn as nn
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
kernel_size=3, pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | MAZiqing/FEDformer | TokenEmbedding | false | 17,645 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
TemporalEmbedding | import math
import torch
import torch.nn as nn
class FixedEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(FixedEmbedding, self).__init__()
w = torch.zeros(c_in, d_model).float()
w.require_grad = False
position = torch.arange(0, c_in).float().unsqueeze(1)
div... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | MAZiqing/FEDformer | TemporalEmbedding | false | 17,646 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
Actor | import torch
from torch import nn
from torch.distributions import Categorical
from torch.distributions import Normal
from torch.distributions import Independent
class Actor(nn.Module):
def __init__(self, obs_dim: 'int', ac_lim: 'float', ac_dim: 'int',
discrete: 'bool'=True):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MIMUW-RL/spp-rl | Actor | false | 17,647 | [
"MIT"
] | 7 | 86b96cdd220cc4eae86f7cfd26924c69b498dcc6 | https://github.com/MIMUW-RL/spp-rl/tree/86b96cdd220cc4eae86f7cfd26924c69b498dcc6 |
series_decomp | import math
import torch
import torch.nn as nn
class moving_avg(nn.Module):
"""
Moving average block to highlight the trend of time series
"""
def __init__(self, kernel_size, stride):
super(moving_avg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(ker... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | MAZiqing/FEDformer | series_decomp | false | 17,648 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
moving_avg | import math
import torch
import torch.nn as nn
class moving_avg(nn.Module):
"""
Moving average block to highlight the trend of time series
"""
def __init__(self, kernel_size, stride):
super(moving_avg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(ker... | 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... | MAZiqing/FEDformer | moving_avg | false | 17,649 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
LinearEstimator | import torch
import torch.nn as nn
class LinearEstimator(nn.Module):
def __init__(self, in_c, out_c, factor=1.0):
super().__init__()
self.factor = factor
self.net = nn.Linear(in_c, out_c, bias=False)
def forward(self, x):
return self.net(x) * self.factor
def get_inputs():
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | MLIA/LEADS | LinearEstimator | false | 17,650 | [
"MIT"
] | 6 | 4010f6b6e6a56ee049b4b4a9aec1c24b34730616 | https://github.com/MLIA/LEADS/tree/4010f6b6e6a56ee049b4b4a9aec1c24b34730616 |
my_Layernorm | import torch
import torch.nn as nn
class my_Layernorm(nn.Module):
"""
Special designed layernorm for the seasonal part
"""
def __init__(self, channels):
super(my_Layernorm, self).__init__()
self.layernorm = nn.LayerNorm(channels)
def forward(self, x):
x_hat = self.layerno... | 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_... | MAZiqing/FEDformer | my_Layernorm | false | 17,651 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
series_decomp_multi | import math
import torch
import torch.nn as nn
class moving_avg(nn.Module):
"""
Moving average block to highlight the trend of time series
"""
def __init__(self, kernel_size, stride):
super(moving_avg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(ker... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MAZiqing/FEDformer | series_decomp_multi | false | 17,652 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
C1Bilinear | import torch
import torch.nn as nn
from random import *
class C1Bilinear(nn.Module):
def __init__(self, num_class=150, fc_dim=4096, segSize=384, use_softmax
=False):
super(C1Bilinear, self).__init__()
self.segSize = segSize
self.use_softmax = use_softmax
self.conv_last = 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
from torch._inductor.runtime.... | Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video | C1Bilinear | false | 17,653 | [
"MIT"
] | 4 | 674b72af15ba8833317b8daa9d1e614ea63151c1 | https://github.com/Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video/tree/674b72af15ba8833317b8daa9d1e614ea63151c1 |
SoftDiceLoss | import torch
import torch.nn as nn
import torch.utils.data.distributed
from torch.backends import cudnn as cudnn
class SoftDiceLoss(nn.Module):
"""SoftJaccard loss for binary problems.
"""
def forward(self, logits, labels):
num = labels.size(0)
m1 = torch.sigmoid(logits.view(num, -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.utils.data.distributed
from torch.backends import cudnn as cudnn
assert_size_stride = torch._C._dynamo.gu... | MIPT-Oulu/Collagen | SoftDiceLoss | false | 17,654 | [
"MIT"
] | 4 | 0cbc4285d60e5c9fcc89f629fcf4321e80b7452c | https://github.com/MIPT-Oulu/Collagen/tree/0cbc4285d60e5c9fcc89f629fcf4321e80b7452c |
PositionAttentionModule | import torch
import numpy as np
from torch import nn
from torch.nn import init
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | LeftAttention/Attention-Codebase | PositionAttentionModule | false | 17,655 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
BCEWithLogitsLoss2d | import torch
import torch.nn as nn
import torch.utils.data.distributed
from torch.backends import cudnn as cudnn
class BCEWithLogitsLoss2d(nn.Module):
"""Computationally stable version of 2D BCE loss.
"""
def __init__(self):
super(BCEWithLogitsLoss2d, self).__init__()
self.bce_loss = nn.B... | 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... | MIPT-Oulu/Collagen | BCEWithLogitsLoss2d | false | 17,656 | [
"MIT"
] | 4 | 0cbc4285d60e5c9fcc89f629fcf4321e80b7452c | https://github.com/MIPT-Oulu/Collagen/tree/0cbc4285d60e5c9fcc89f629fcf4321e80b7452c |
DataEmbedding_wo_pos | import math
import torch
import torch.nn as nn
class PositionalEmbedding(nn.Module):
def __init__(self, d_model, max_len=5000):
super(PositionalEmbedding, self).__init__()
pe = torch.zeros(max_len, d_model).float()
pe.require_grad = False
position = torch.arange(0, max_len).float(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | MAZiqing/FEDformer | DataEmbedding_wo_pos | false | 17,657 | [
"MIT"
] | 7 | 7914d39df829494a8172afb9676982c3789d491d | https://github.com/MAZiqing/FEDformer/tree/7914d39df829494a8172afb9676982c3789d491d |
SoftJaccardLoss | import torch
import torch.nn as nn
import torch.utils.data.distributed
from torch.backends import cudnn as cudnn
class SoftJaccardLoss(nn.Module):
"""SoftJaccard loss for binary problems.
"""
def __init__(self, use_log=False):
super(SoftJaccardLoss, self).__init__()
self.use_log = use_log... | 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.distributed
from torch.backends import cudnn as cudnn
assert_size_stride = torch._C._dynamo.gu... | MIPT-Oulu/Collagen | SoftJaccardLoss | false | 17,658 | [
"MIT"
] | 4 | 0cbc4285d60e5c9fcc89f629fcf4321e80b7452c | https://github.com/MIPT-Oulu/Collagen/tree/0cbc4285d60e5c9fcc89f629fcf4321e80b7452c |
ChannelSqueeze | import torch
import torch.utils.data
import torch.nn as nn
def channel_squeeze(x, groups):
"""
Channel squeeze operation.
Parameters:
----------
x : Tensor
Input tensor.
groups : int
Number of groups.
Returns
-------
Tensor
Resulted tensor.
"""
bat... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | HyperGAN/imgclsmob | ChannelSqueeze | false | 17,659 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, enc_hid_dim, dec_hid_dim):
super().__init__()
self.enc_hid_dim = enc_hid_dim
self.dec_hid_dim = dec_hid_dim
self.attn = nn.Linear(enc_hid_dim + dec_hid_dim, dec_hid_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MaZhanyu007/MSDGAN | Attention | false | 17,660 | [
"MIT"
] | 8 | 037ad33025c29869dbc9cb233a45b8762d31179d | https://github.com/MaZhanyu007/MSDGAN/tree/037ad33025c29869dbc9cb233a45b8762d31179d |
ParallelPolarizedSelfAttention | import torch
from torch import nn
class ParallelPolarizedSelfAttention(nn.Module):
def __init__(self, channel=512):
super().__init__()
self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1))
self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1))
self.softmax_channel = 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.... | LeftAttention/Attention-Codebase | ParallelPolarizedSelfAttention | false | 17,661 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
SDR | import torch
class SDR(torch.nn.Module):
def __init__(self) ->None:
super().__init__()
self.expr = 'bi,bi->b'
def _batch_dot(self, x, y):
return torch.einsum(self.expr, x, y)
def forward(self, outputs, labels):
if outputs.dtype != labels.dtype:
outputs = 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
from torch._inductor.runtime.... | Marc-Demoustier/demixr | SDR | false | 17,662 | [
"MIT"
] | 4 | cb3bb1606670d2e705b36f09e9a4a4394f8303da | https://github.com/Marc-Demoustier/demixr/tree/cb3bb1606670d2e705b36f09e9a4a4394f8303da |
SSDicriminatorLoss | from torch.nn import Module
import torch
from torch import Tensor
from abc import abstractmethod
from typing import Tuple
import torch.nn as nn
from typing import Dict
import torch.utils.data.distributed
from torch.nn import CrossEntropyLoss
from torch.backends import cudnn as cudnn
from torch.nn import BCELoss
class... | 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.... | MIPT-Oulu/Collagen | SSDicriminatorLoss | false | 17,663 | [
"MIT"
] | 4 | 0cbc4285d60e5c9fcc89f629fcf4321e80b7452c | https://github.com/MIPT-Oulu/Collagen/tree/0cbc4285d60e5c9fcc89f629fcf4321e80b7452c |
translatedSigmoid | import torch
from torch import nn
class translatedSigmoid(nn.Module):
def __init__(self):
super(translatedSigmoid, self).__init__()
self.beta = nn.Parameter(torch.tensor([-3.5]))
def forward(self, x):
beta = torch.nn.functional.softplus(self.beta)
alpha = -beta * 6.9077542789... | 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 import nn
assert_size_stride = torch._C._dynamo.gua... | MachineLearningLifeScience/What-is-a-meaningful-representation-of-protein-sequences | translatedSigmoid | false | 17,664 | [
"BSD-3-Clause"
] | 4 | 2c24db6ee8763b0b6098d7509cf3325647931c11 | https://github.com/MachineLearningLifeScience/What-is-a-meaningful-representation-of-protein-sequences/tree/2c24db6ee8763b0b6098d7509cf3325647931c11 |
SequentialPolarizedSelfAttention | import torch
from torch import nn
class SequentialPolarizedSelfAttention(nn.Module):
def __init__(self, channel=512):
super().__init__()
self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1))
self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1))
self.softmax_channel = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LeftAttention/Attention-Codebase | SequentialPolarizedSelfAttention | false | 17,665 | [
"Apache-2.0"
] | 6 | 348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 | https://github.com/LeftAttention/Attention-Codebase/tree/348ec66233a7c0f95a3cb5f0f11641e2a7a9b9c3 |
BCEDiceLoss | import torch
import torch.nn as nn
import torch.utils.data.distributed
from torch.backends import cudnn as cudnn
class BCEWithLogitsLoss2d(nn.Module):
"""Computationally stable version of 2D BCE loss.
"""
def __init__(self):
super(BCEWithLogitsLoss2d, self).__init__()
self.bce_loss = nn.B... | 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... | MIPT-Oulu/Collagen | BCEDiceLoss | false | 17,666 | [
"MIT"
] | 4 | 0cbc4285d60e5c9fcc89f629fcf4321e80b7452c | https://github.com/MIPT-Oulu/Collagen/tree/0cbc4285d60e5c9fcc89f629fcf4321e80b7452c |
Accuracy | import torch
from torch import nn
def accuracy(logits, labels, ignore_index: 'int'=-100):
with torch.no_grad():
valid_mask = labels != ignore_index
predictions = logits.float().argmax(-1)
correct = (predictions == labels) * valid_mask
return correct.sum().float() / valid_mask.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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | MachineLearningLifeScience/What-is-a-meaningful-representation-of-protein-sequences | Accuracy | false | 17,667 | [
"BSD-3-Clause"
] | 4 | 2c24db6ee8763b0b6098d7509cf3325647931c11 | https://github.com/MachineLearningLifeScience/What-is-a-meaningful-representation-of-protein-sequences/tree/2c24db6ee8763b0b6098d7509cf3325647931c11 |
ResUnit | import torch
import torch.nn as nn
class ResUnit(nn.Module):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__()
self.norm_1 = nn.InstanceNorm2d(in_channels)
self.norm_2 = nn.InstanceNorm2d(out_channels)
self.activation = nn.ELU()
self.conv_1 = 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.triton_helpers import libdevice
import torch.nn as ... | MRSAIL-Mini-Robotics-Software-AI-Lab/GANVAS-models | ResUnit | false | 17,668 | [
"MIT"
] | 5 | 9bc1530d5998da3908929152da2a3120832ca104 | https://github.com/MRSAIL-Mini-Robotics-Software-AI-Lab/GANVAS-models/tree/9bc1530d5998da3908929152da2a3120832ca104 |
HSwish | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class HSwish(nn.Module):
"""
H-Swish activation function from 'Searching for MobileNetV3,' https://arxiv.org/abs/1905.02244.
Parameters:
----------
inplace : bool
Whether to use inplace version of 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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | HyperGAN/imgclsmob | HSwish | false | 17,669 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
KLLoss | import torch
import torch.utils.data
from torchvision.transforms import functional as F
import torch.nn as nn
import torch.nn.functional as F
from sklearn import *
class KLLoss(nn.Module):
"""
This criterion is a implemenation of Focal Loss, which is proposed in
Focal Loss for Dense Object Detecti... | 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... | CityU-AIM-Group/SIGMA | KLLoss | false | 17,670 | [
"MIT"
] | 5 | 19f89777db8d42f750a9b87756d3326c7efd18f5 | https://github.com/CityU-AIM-Group/SIGMA/tree/19f89777db8d42f750a9b87756d3326c7efd18f5 |
DiracInitBlock | import torch
import torch.utils.data
import torch.nn as nn
class DiracInitBlock(nn.Module):
"""
DiracNetV2 specific initial block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
"""
def __init__(self, i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | DiracInitBlock | false | 17,671 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
AlexConv | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from inspect import isfunction
def get_activation_layer(activation):
"""
Create activation layer from string/function.
Parameters:
----------
activation : function, or str, or nn.Module
Activation f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HyperGAN/imgclsmob | AlexConv | false | 17,672 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
IRevInjectivePad | import torch
import torch.utils.data
import torch.nn as nn
class IRevInjectivePad(nn.Module):
"""
i-RevNet channel zero padding block.
Parameters:
----------
padding : int
Size of the padding.
"""
def __init__(self, padding):
super(IRevInjectivePad, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | HyperGAN/imgclsmob | IRevInjectivePad | false | 17,673 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
extractNet_connected | import torch
import torch.nn as nn
import torch.nn.functional as F
class extractNet_connected(nn.Module):
def __init__(self):
super(extractNet_connected, self).__init__()
self.conv1 = nn.Conv2d(3, 16, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(16, 32, 3, stride=2, padding=1)
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
assert_... | MNRKhan/aps360-project | extractNet_connected | false | 17,674 | [
"MIT"
] | 3 | 1d91a4262c95cd6b5610aae16e1a30f2749a4373 | https://github.com/MNRKhan/aps360-project/tree/1d91a4262c95cd6b5610aae16e1a30f2749a4373 |
DiracConv | import torch
import torch.utils.data
import torch.nn as nn
class DiracConv(nn.Module):
"""
DiracNetV2 specific convolution block with pre-activation.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | DiracConv | false | 17,675 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
MaxPoolBranch | import torch
import torch.utils.data
import torch.nn as nn
class MaxPoolBranch(nn.Module):
"""
PolyNet specific max pooling branch block.
"""
def __init__(self):
super(MaxPoolBranch, self).__init__()
self.pool = nn.MaxPool2d(kernel_size=3, stride=2, padding=0)
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._inductor.runtime import triton_helpers
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | HyperGAN/imgclsmob | MaxPoolBranch | false | 17,676 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
IBNbConvBlock | import torch
import torch.utils.data
import torch.nn as nn
class IBNbConvBlock(nn.Module):
"""
IBN(b)-ResNet specific convolution block with Instance normalization and ReLU activation.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HyperGAN/imgclsmob | IBNbConvBlock | false | 17,677 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
MobileNetV3Classifier | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
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.utils.data
impor... | HyperGAN/imgclsmob | MobileNetV3Classifier | false | 17,678 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
FirstLSTMAmp | import torch
import torch.utils.data
import torch.nn as nn
class FirstLSTMAmp(nn.Module):
"""
First LSTM amplifier branch.
Parameters:
----------
in_features : int
Number of input channels.
out_features : int
Number of output channels.
"""
def __init__(self, in_featur... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | FirstLSTMAmp | false | 17,679 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
InterpolationBlock | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class InterpolationBlock(nn.Module):
"""
Interpolation block.
Parameters:
----------
scale_factor : float
Multiplier for spatial size.
"""
def __init__(self, scale_factor):
super(In... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | HyperGAN/imgclsmob | InterpolationBlock | false | 17,680 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
DistNet | import torch
from torch import nn
from sklearn.cluster import KMeans
class translatedSigmoid(nn.Module):
def __init__(self):
super(translatedSigmoid, self).__init__()
self.beta = nn.Parameter(torch.tensor([-3.5]))
def forward(self, x):
beta = torch.nn.functional.softplus(self.beta)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MachineLearningLifeScience/What-is-a-meaningful-representation-of-protein-sequences | DistNet | false | 17,681 | [
"BSD-3-Clause"
] | 4 | 2c24db6ee8763b0b6098d7509cf3325647931c11 | https://github.com/MachineLearningLifeScience/What-is-a-meaningful-representation-of-protein-sequences/tree/2c24db6ee8763b0b6098d7509cf3325647931c11 |
SqueezeInitBlock | import torch
import torch.utils.data
import torch.nn as nn
class SqueezeInitBlock(nn.Module):
"""
SqueezeNet specific initial block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | SqueezeInitBlock | false | 17,682 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
WRNBottleneck | import torch
import torch.utils.data
import torch.nn as nn
def wrn_conv1x1(in_channels, out_channels, stride, activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | WRNBottleneck | false | 17,683 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
NasMaxPoolBlock | import torch
import torch.utils.data
import torch.nn as nn
class NasMaxPoolBlock(nn.Module):
"""
NASNet specific Max pooling layer with extra padding.
Parameters:
----------
extra_padding : bool, default False
Whether to use extra padding.
"""
def __init__(self, extra_padding=Fal... | 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.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | HyperGAN/imgclsmob | NasMaxPoolBlock | false | 17,684 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
NasPathBranch | import torch
import torch.utils.data
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | HyperGAN/imgclsmob | NasPathBranch | false | 17,685 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
NasAvgPoolBlock | import torch
import torch.utils.data
import torch.nn as nn
class NasAvgPoolBlock(nn.Module):
"""
NASNet specific 3x3 Average pooling layer with extra padding.
Parameters:
----------
extra_padding : bool, default False
Whether to use extra padding.
"""
def __init__(self, extra_pad... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | HyperGAN/imgclsmob | NasAvgPoolBlock | false | 17,686 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
SPHead | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from inspect import isfunction
def get_activation_layer(activation):
"""
Create activation layer from string/function.
Parameters:
----------
activation : function, or str, or nn.Module
Activation f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | SPHead | false | 17,687 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
XConv2d | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class XConv2d(nn.Conv2d):
"""
X-Convolution layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | HyperGAN/imgclsmob | XConv2d | false | 17,688 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
IBNbResInitBlock | import torch
import torch.utils.data
import torch.nn as nn
def ibnb_conv7x7_block(in_channels, out_channels, stride=1, padding=3, bias
=False, activate=True):
"""
7x7 version of the IBN(b)-ResNet specific convolution block.
Parameters:
----------
in_channels : int
Number of input chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HyperGAN/imgclsmob | IBNbResInitBlock | false | 17,689 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
Conv2dBlock | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.functional as... | MattAlexMiracle/SmartPatch | Conv2dBlock | false | 17,690 | [
"MIT"
] | 7 | c485cb433d8e085d6eae10a335ee19f5e6c1a41c | https://github.com/MattAlexMiracle/SmartPatch/tree/c485cb433d8e085d6eae10a335ee19f5e6c1a41c |
WRNUnit | import torch
import torch.utils.data
import torch.nn as nn
def wrn_conv1x1(in_channels, out_channels, stride, activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | WRNUnit | false | 17,691 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
WRNInitBlock | import torch
import torch.utils.data
import torch.nn as nn
class WRNConv(nn.Module):
"""
WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
kernel_size : int or tuple/list of 2 in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | WRNInitBlock | false | 17,692 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
AlexOutputBlock | import torch
import torch.utils.data
import torch.nn as nn
class AlexDense(nn.Module):
"""
AlexNet specific dense block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
"""
def __init__(self, in_channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | AlexOutputBlock | false | 17,693 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
Swish | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
def forward(self, x):
return 1.78718727865 * (x * torch.sigmoid(x) - 0.20662096414)
def get_inputs():
return [torch.rand([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.nn as nn
import torch.utils.data
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | Manojbhat09/Sane-annotation-shape-complete | Swish | false | 17,694 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 |
NLL | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class NLL(nn.Module):
def __init__(self):
super(NLL, self).__init__()
def forward(self, x):
return torch.mean(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
assert_size_stride... | Manojbhat09/Sane-annotation-shape-complete | NLL | false | 17,695 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 |
NavigatorBranch | import torch
import torch.utils.data
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | HyperGAN/imgclsmob | NavigatorBranch | false | 17,696 | [
"MIT"
] | 9 | 88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 | https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3 |
Classify | import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Flatten(nn.Module):
@staticmethod
def forward(x):
return x.view(x.size(0), -1)
class Classify(nn.Module):
def __init__(self, c1,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Mac-AI/BNA-traffic-mapper | Classify | false | 17,697 | [
"MIT"
] | 4 | 9fcc3f516e18e19704444b6b848fc8aa356007bc | https://github.com/Mac-AI/BNA-traffic-mapper/tree/9fcc3f516e18e19704444b6b848fc8aa356007bc |
Norm | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
class Norm(nn.Module):
def __init__(self, dims):
super(Norm, self).__init__()
self.dims = dims
def forward(self, x):
z2 = torch.norm(x, p=2)
out = z2 - self.dims
out = out * out
... | 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
import... | Manojbhat09/Sane-annotation-shape-complete | Norm | false | 17,698 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 |
BowEncoder | import torch
import torch.nn as nn
from torch.nn import functional as F
class BowEncoder(nn.Module):
"""
static information extractor
"""
def __init__(self, num_words, bow_mid_hid, dropout):
super().__init__()
self.fc1 = nn.Linear(num_words, bow_mid_hid)
self.fc_trans = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Maxpa1n/case2vec | BowEncoder | false | 17,699 | [
"Apache-2.0"
] | 8 | 1e8f7a9ccbd5ef01409c7f03110b708bce467161 | https://github.com/Maxpa1n/case2vec/tree/1e8f7a9ccbd5ef01409c7f03110b708bce467161 |
EquivariantLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
from torch.nn.modules.batchnorm import _BatchNorm
class MyBatchNorm1d(_BatchNorm):
"""Applies Batch Normalization over a 2d or 3d input that is seen as a
mini-batch.
.. math::
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
import torch.nn a... | Manojbhat09/Sane-annotation-shape-complete | EquivariantLayer | false | 17,700 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Manojbhat09/Sane-annotation-shape-complete | Critic | false | 17,701 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 |
extractNet_connected_v2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class extractNet_connected_v2(nn.Module):
def __init__(self):
super(extractNet_connected_v2, self).__init__()
self.conv1 = nn.Conv2d(3, 16, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(16, 32, 3, stride=2, padding=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
assert_... | MNRKhan/aps360-project | extractNet_connected_v2 | false | 17,702 | [
"MIT"
] | 3 | 1d91a4262c95cd6b5610aae16e1a30f2749a4373 | https://github.com/MNRKhan/aps360-project/tree/1d91a4262c95cd6b5610aae16e1a30f2749a4373 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 400)
self.l2 = nn.Linear(400, 300... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Manojbhat09/Sane-annotation-shape-complete | Actor | false | 17,703 | [
"Apache-2.0"
] | 9 | 03b298b2c0a187be979ff31ad2a39238b72a6d78 | https://github.com/Manojbhat09/Sane-annotation-shape-complete/tree/03b298b2c0a187be979ff31ad2a39238b72a6d78 |
quadexp | import torch
import torch as tr
import torch.nn as nn
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | MichaelArbel/MMD-gradient-flow | quadexp | false | 17,704 | [
"BSD-3-Clause"
] | 5 | aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | https://github.com/MichaelArbel/MMD-gradient-flow/tree/aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 |
OneHiddenLayer | import torch
import torch as tr
import torch.nn as nn
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sigma ** 2)
class OneHiddenLayer(nn.Module):
def __init__(self, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MichaelArbel/MMD-gradient-flow | OneHiddenLayer | false | 17,705 | [
"BSD-3-Clause"
] | 5 | aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | https://github.com/MichaelArbel/MMD-gradient-flow/tree/aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 |
ConcatBlock | import torch
import torch.nn as nn
import torch.nn.functional
class ConcatBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(ConcatBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional
assert_size_stride = torch._C._... | Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation | ConcatBlock | false | 17,706 | [
"MIT"
] | 6 | 34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 | https://github.com/Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation/tree/34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 |
ActFirstResBlock | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MattAlexMiracle/SmartPatch | ActFirstResBlock | false | 17,707 | [
"MIT"
] | 7 | c485cb433d8e085d6eae10a335ee19f5e6c1a41c | https://github.com/MattAlexMiracle/SmartPatch/tree/c485cb433d8e085d6eae10a335ee19f5e6c1a41c |
BCELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCELoss(nn.Module):
def forward(self, pos_score, neg_score, average=True):
pos_loss = -F.log_softmax(pos_score, dim=1)[:, 1]
neg_loss = -F.log_softmax(neg_score, dim=1)[:, 0]
loss = pos_loss.sum() + neg_loss.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
... | MaybeS/mnist | BCELoss | false | 17,708 | [
"MIT"
] | 8 | d0aeafce97d7308dc84adbb6ad8e547776db0cd5 | https://github.com/MaybeS/mnist/tree/d0aeafce97d7308dc84adbb6ad8e547776db0cd5 |
OutPutBlock | import torch
import torch.nn as nn
import torch.nn.functional
class OutPutBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutPutBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional
assert_size_stride = torch._C._... | Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation | OutPutBlock | false | 17,709 | [
"MIT"
] | 6 | 34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 | https://github.com/Luoxd1996/awesome-semi-supervised-learning-for-medical-image-segmentation/tree/34d78f41e4fa5927b03cb9f9b2fd473cd16f5e57 |
SeE_Block | import torch
import torch.nn as nn
import torch.nn.functional as F
class SeE_Block(nn.Module):
def __init__(self, channel):
super(SeE_Block, self).__init__()
self.channel = channel
self.relu = nn.ReLU()
self.sigmoid = nn.Sigmoid()
self.fc1 = nn.Conv2d(self.channel, self.ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Mhaiyang/TCSVT2021_DCENet | SeE_Block | false | 17,710 | [
"BSD-3-Clause"
] | 4 | aae8c7643402c15847836c0ce4934b743e11fd8a | https://github.com/Mhaiyang/TCSVT2021_DCENet/tree/aae8c7643402c15847836c0ce4934b743e11fd8a |
NoisyOneHiddenLayer | import torch
import torch as tr
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x):
return tr.exp(-x ** 2 / self.sig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MichaelArbel/MMD-gradient-flow | NoisyOneHiddenLayer | false | 17,711 | [
"BSD-3-Clause"
] | 5 | aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 | https://github.com/MichaelArbel/MMD-gradient-flow/tree/aa7be78c53c1995ae156fb04b6f1b4fcf02dd039 |
StdConv2d | import torch
import torch.nn.functional as F
import torch.nn as nn
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-05)
return F.conv2d(x, w, self.bias, self.stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | MetaMain/ViTRobust | StdConv2d | false | 17,712 | [
"BSD-3-Clause"
] | 6 | 5bca523f430933469d9f82022e334839388cee7a | https://github.com/MetaMain/ViTRobust/tree/5bca523f430933469d9f82022e334839388cee7a |
TripletLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class TripletLoss(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample and a negative sample
"""
def __init__(self, margin=4.0, size_average=True):
super(TripletLoss, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | MikeLagunes/Supervised-Triplet-Network | TripletLoss | false | 17,713 | [
"MIT"
] | 6 | 575bcaf8f17affb0ff0e93212dde0f3f634c196f | https://github.com/MikeLagunes/Supervised-Triplet-Network/tree/575bcaf8f17affb0ff0e93212dde0f3f634c196f |
MultiheadAttention | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
from torch.nn.init import constant_
from torch.nn.init import xavier_normal_
from torch.nn.parameter import Parameter
from torch.nn import functional as F
class MultiheadAttention(Module):
"""Allows the ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Mehrad0711/HUBERT | MultiheadAttention | false | 17,714 | [
"MIT"
] | 3 | 2f13fd2f7f5a2ec13544f4007158b582ae7408c3 | https://github.com/Mehrad0711/HUBERT/tree/2f13fd2f7f5a2ec13544f4007158b582ae7408c3 |
LossEnergy | import torch
from torch import nn
class WaveFunctionLoss(nn.Module):
"""Base class for all wave function loss functions.
Any such loss must be derived from the local energy and wave function
values, :math:`L(\\{E_\\text{loc}[\\psi],\\ln|\\psi|,w\\})`, using also
importance-sampling weights *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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | MikeEntwistle/deepqmc | LossEnergy | false | 17,715 | [
"MIT"
] | 4 | b5c20bf1768f04227becd5079c6b40aefc97d26c | https://github.com/MikeEntwistle/deepqmc/tree/b5c20bf1768f04227becd5079c6b40aefc97d26c |
WrapPad2d | import torch
import torch.nn as nn
import torch.nn.init
import torch.optim
class WrapPad2d(nn.Module):
"""Create a padding layer that wraps the data
Arguments:
padding (int): the size of the padding
"""
def __init__(self, padding):
super(WrapPad2d, self).__init__()
self.paddi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.init
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_... | NREL/deep-image-prior-cfd | WrapPad2d | false | 17,716 | [
"Apache-2.0"
] | 5 | 85a86ac10bef070b1a973d2a6569849583e08d79 | https://github.com/NREL/deep-image-prior-cfd/tree/85a86ac10bef070b1a973d2a6569849583e08d79 |
FiLM | import torch
import torch.nn as nn
import torch.nn.functional
class FiLM(nn.Module):
def __init__(self, output_size, gating_size):
super().__init__()
self.scale = nn.Linear(gating_size, output_size[0])
self.shift = nn.Linear(gating_size, output_size[0])
def forward(self, x, gating):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional
assert_size_stride = torch._C._... | MichalOp/StarTrain | FiLM | false | 17,717 | [
"MIT"
] | 7 | e8dddf879f103e18239ad37b373c9b51fbbe093b | https://github.com/MichalOp/StarTrain/tree/e8dddf879f103e18239ad37b373c9b51fbbe093b |
MultiHeadedAttention | import math
import torch
from torch import Tensor
from torch import nn
class MultiHeadedAttention(nn.Module):
"""
Multi-Head Attention module from "Attention is All You Need"
Implementation modified from OpenNMT-py.
https://github.com/OpenNMT/OpenNMT-py
"""
def __init__(self, num_heads: '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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Merterm/-Modeling-Intensification-for-SLG | MultiHeadedAttention | false | 17,718 | [
"MIT"
] | 5 | 800fff3d3c7bacc86c1db8382f7c2e68d2f0c074 | https://github.com/Merterm/-Modeling-Intensification-for-SLG/tree/800fff3d3c7bacc86c1db8382f7c2e68d2f0c074 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target):
smooth = 1.0
intersection = (input * target).sum()
return 1 - (2.0 * intersection + smooth) / (input.sum() + target.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | MichalBusta/OpenCitiesAIC | DiceLoss | false | 17,719 | [
"MIT"
] | 7 | 2358118a782edde27a588d6adaf79941cbd90de6 | https://github.com/MichalBusta/OpenCitiesAIC/tree/2358118a782edde27a588d6adaf79941cbd90de6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.