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 |
|---|---|---|---|---|---|---|---|---|---|---|
Normalize | import torch
import torch.nn as nn
from itertools import product as product
import torch.onnx
class Normalize(nn.Module):
def __init__(self, n_channels, scale=1.0):
super(Normalize, self).__init__()
self.n_channels = n_channels
self.scale = scale
self.eps = 1e-10
self.weig... | 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
from itertools import product as product
import torch.onn... | Janus1984/Msnhnet | Normalize | false | 13,872 | [
"MIT"
] | 546 | 4e09f2501ba8db789f0a20441a357de3ba468f10 | https://github.com/Janus1984/Msnhnet/tree/4e09f2501ba8db789f0a20441a357de3ba468f10 |
GeLU | from torch.nn import Module
import functools
import math
import torch
import torch.utils.data
import torch.nn as nn
from torchvision.models import *
import torch.nn.init
class GeLU(Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
import functools
import torch.utils.data
import tor... | JiahuaWU/fastai | GeLU | false | 13,873 | [
"Apache-2.0"
] | 59 | 13a2df812d875abf0558004283392ab40d9bdea1 | https://github.com/JiahuaWU/fastai/tree/13a2df812d875abf0558004283392ab40d9bdea1 |
Scale | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from itertools import product as product
import torch.onnx
class Scale(nn.Module):
def __init__(self, channels):
super(Scale, self).__init__()
self.weight = Parameter(torch.Tensor(channels))
self.bias = Parameter(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn.parameter import Parameter
from itertools import product as product
import torch.onnx
assert_size_stride... | Janus1984/Msnhnet | Scale | false | 13,874 | [
"MIT"
] | 546 | 4e09f2501ba8db789f0a20441a357de3ba468f10 | https://github.com/Janus1984/Msnhnet/tree/4e09f2501ba8db789f0a20441a357de3ba468f10 |
Ecgclient | import torch
import torch.nn as nn
class Ecgclient(nn.Module):
def __init__(self):
super(Ecgclient, self).__init__()
self.conv1 = nn.Conv1d(1, 16, 7, padding=3)
self.relu1 = nn.LeakyReLU()
self.pool1 = nn.MaxPool1d(2)
self.conv2 = nn.Conv1d(16, 16, 5, padding=2)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | JayDigvijay/Federated-Learning-and-Split-Learning-with-raspberry-pi | Ecgclient | false | 13,875 | [
"MIT"
] | 48 | 314a9618fc6be2ba1b9b7bdf93b126d49a2519ee | https://github.com/JayDigvijay/Federated-Learning-and-Split-Learning-with-raspberry-pi/tree/314a9618fc6be2ba1b9b7bdf93b126d49a2519ee |
CELoss | import torch
import torch.nn.functional as F
from torch import nn
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn.functi... | JiYuanFeng/MCTrans | CELoss | false | 13,876 | [
"Apache-2.0"
] | 84 | 9b8b5677eef584b423d5e1630680a4b667cbe823 | https://github.com/JiYuanFeng/MCTrans/tree/9b8b5677eef584b423d5e1630680a4b667cbe823 |
EdgeFeaturesLayer | import torch
import torch.nn as nn
class EdgeFeaturesLayer(nn.Module):
def __init__(self, d_model, d_edge, h, dropout):
super(EdgeFeaturesLayer, self).__init__()
assert d_model % h == 0
d_model // h
self.linear = nn.Linear(d_edge, 1, bias=False)
with torch.no_grad():
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Jh-SYSU/MolRep | EdgeFeaturesLayer | false | 13,877 | [
"MIT"
] | 57 | b2c802d18d41d7db26c19c6dd644098f945e48a1 | https://github.com/Jh-SYSU/MolRep/tree/b2c802d18d41d7db26c19c6dd644098f945e48a1 |
PositionGenerator | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, hidden_size, variance_epsilon=1e-12):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(hidden_size))
self.beta = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = v... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Jh-SYSU/MolRep | PositionGenerator | false | 13,878 | [
"MIT"
] | 57 | b2c802d18d41d7db26c19c6dd644098f945e48a1 | https://github.com/Jh-SYSU/MolRep/tree/b2c802d18d41d7db26c19c6dd644098f945e48a1 |
LNN | import math
import torch
import torch.utils.data
import torch.nn.functional as F
class LNN(torch.nn.Module):
"""
A pytorch implementation of LNN layer
Input shape
- A 3D tensor with shape: ``(batch_size,field_size,embedding_size)``.
Output shape
- 2D tensor with shape:``(batch_size,LNN... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JazonJiao/pytorch-fm | LNN | false | 13,879 | [
"MIT"
] | 734 | 7192e7861fa54341d5b2df995f92858f583ea09e | https://github.com/JazonJiao/pytorch-fm/tree/7192e7861fa54341d5b2df995f92858f583ea09e |
FactorizationMachine | import torch
import torch.utils.data
class FactorizationMachine(torch.nn.Module):
def __init__(self, reduce_sum=True):
super().__init__()
self.reduce_sum = reduce_sum
def forward(self, x):
"""
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | JazonJiao/pytorch-fm | FactorizationMachine | false | 13,880 | [
"MIT"
] | 734 | 7192e7861fa54341d5b2df995f92858f583ea09e | https://github.com/JazonJiao/pytorch-fm/tree/7192e7861fa54341d5b2df995f92858f583ea09e |
Linear_2L_KFRA | import torch
import torch.nn as nn
import torch.utils.data
def sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv):
Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1)
all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z),
upper_Qinv)
weight_mtx_sample = all_mtx_sample[:, :-1]
bias_mt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | JavierAntoran/Bayesain-Neural-Networks | Linear_2L_KFRA | false | 13,881 | [
"MIT"
] | 1,299 | 1f867a5bcbd1abfecede99807eb0b5f97ed8be7c | https://github.com/JavierAntoran/Bayesain-Neural-Networks/tree/1f867a5bcbd1abfecede99807eb0b5f97ed8be7c |
ScaleNorm | import math
import torch
import torch.nn as nn
class ScaleNorm(nn.Module):
"""ScaleNorm"""
"""All g’s in SCALE NORM are initialized to sqrt(d)"""
def __init__(self, scale, eps=1e-05):
super(ScaleNorm, self).__init__()
self.scale = nn.Parameter(torch.tensor(math.sqrt(scale)))
self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.nn ... | Jh-SYSU/MolRep | ScaleNorm | false | 13,882 | [
"MIT"
] | 57 | b2c802d18d41d7db26c19c6dd644098f945e48a1 | https://github.com/Jh-SYSU/MolRep/tree/b2c802d18d41d7db26c19c6dd644098f945e48a1 |
AsymmetricLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | 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... | JiYuanFeng/mmclassification | AsymmetricLoss | false | 13,883 | [
"Apache-2.0"
] | 1,190 | b337ef1f11b85148cca4b6fb0c4da3f8cc2eede6 | https://github.com/JiYuanFeng/mmclassification/tree/b337ef1f11b85148cca4b6fb0c4da3f8cc2eede6 |
Generator | import math
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, hidden_size, variance_epsilon=1e-12):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(hidden_size))
self.beta = nn.Parameter(torch.zeros(hidden_size))
self.variance... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Jh-SYSU/MolRep | Generator | false | 13,884 | [
"MIT"
] | 57 | b2c802d18d41d7db26c19c6dd644098f945e48a1 | https://github.com/Jh-SYSU/MolRep/tree/b2c802d18d41d7db26c19c6dd644098f945e48a1 |
CQAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=1, stride=1, paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IsaacChanghau/VSLNet | CQAttention | false | 13,885 | [
"MIT"
] | 62 | 3793c625f2e251a5f19a0d59f0c83b12e386f808 | https://github.com/IsaacChanghau/VSLNet/tree/3793c625f2e251a5f19a0d59f0c83b12e386f808 |
FusionLayer | import torch
from torch import nn
from torch.nn import init
class FusionLayer(nn.Module):
def __init__(self, nums=6):
super(FusionLayer, self).__init__()
self.weights = nn.Parameter(torch.randn(nums))
self.nums = nums
self._reset_parameters()
def _reset_parameters(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 import nn
from torch.nn import init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C... | JasonLin1998/DSS-pytorch | FusionLayer | false | 13,886 | [
"MIT"
] | 188 | f249541bf7e5e479e050b562dd6024d6219f36f4 | https://github.com/JasonLin1998/DSS-pytorch/tree/f249541bf7e5e479e050b562dd6024d6219f36f4 |
ConvToVector | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvToVector(nn.Module):
def __init__(self, in_channels, padding=1):
super(ConvToVector, self).__init__()
self.in_channels = in_channels
self.conv1 = nn.Conv2d(in_channels, 3, kernel_size=3, padding=padding)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | JannerM/spatial-reasoning | ConvToVector | false | 13,887 | [
"MIT"
] | 54 | e163003a33177e41ca02d5feefee3fdfca5ba154 | https://github.com/JannerM/spatial-reasoning/tree/e163003a33177e41ca02d5feefee3fdfca5ba154 |
MultiHeadAttention | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
class MultiHeadAttention(nn.Module):
"""
input:
query --- [N, T_q, query_dim]
key --- [N, T_k, key_dim]
output:
out --- [N, T_q, num_units]
"""
def __init__(self, query_dim, key_dim, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Jesse3692/ttskit | MultiHeadAttention | false | 13,888 | [
"MIT"
] | 151 | aa424cf46f5fbe67dc06e67d00c1d46c31a9974b | https://github.com/Jesse3692/ttskit/tree/aa424cf46f5fbe67dc06e67d00c1d46c31a9974b |
DacBlock | import torch
from torch import nn
class DacBlock(nn.Module):
def __init__(self, channel):
super(DacBlock, self).__init__()
self.dilate1 = nn.Conv2d(channel, channel, kernel_size=3, dilation=
1, padding=1)
self.dilate2 = nn.Conv2d(channel, channel, kernel_size=3, dilation=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | JiYuanFeng/MCTrans | DacBlock | false | 13,889 | [
"Apache-2.0"
] | 84 | 9b8b5677eef584b423d5e1630680a4b667cbe823 | https://github.com/JiYuanFeng/MCTrans/tree/9b8b5677eef584b423d5e1630680a4b667cbe823 |
MultiHeadAttentionBlock | import math
import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=1, 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 import triton_helpers
from torch._inductor.runtime.... | IsaacChanghau/VSLNet | MultiHeadAttentionBlock | false | 13,890 | [
"MIT"
] | 62 | 3793c625f2e251a5f19a0d59f0c83b12e386f808 | https://github.com/IsaacChanghau/VSLNet/tree/3793c625f2e251a5f19a0d59f0c83b12e386f808 |
WassersteinLoss | from torch.nn import Module
import functools
import torch
import torch.utils.data
import torch.nn as nn
from torchvision.models import *
import torch.nn.init
class WassersteinLoss(Module):
"""For WGAN."""
def forward(self, real, fake):
return real.mean() - fake.mean()
class PrePostInitMeta(type):
... | 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.nn import Module
import functools
import torch.utils.data
import torch.nn as n... | JiahuaWU/fastai | WassersteinLoss | false | 13,892 | [
"Apache-2.0"
] | 59 | 13a2df812d875abf0558004283392ab40d9bdea1 | https://github.com/JiahuaWU/fastai/tree/13a2df812d875abf0558004283392ab40d9bdea1 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | 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... | JiYuanFeng/mmclassification | FocalLoss | false | 13,893 | [
"Apache-2.0"
] | 1,190 | b337ef1f11b85148cca4b6fb0c4da3f8cc2eede6 | https://github.com/JiYuanFeng/mmclassification/tree/b337ef1f11b85148cca4b6fb0c4da3f8cc2eede6 |
CrossEntropy2D | import torch
import torch.nn as nn
class CrossEntropy2D(nn.Module):
"""
2D Cross-entropy loss implemented as negative log likelihood
"""
def __init__(self, weight=None, reduction='none'):
super(CrossEntropy2D, self).__init__()
self.nll_loss = nn.CrossEntropyLoss(weight=weight, reducti... | 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
... | Jinboasltw/FastSurfer | CrossEntropy2D | false | 13,894 | [
"Apache-2.0"
] | 257 | 3c0330c459c221b85428d3ec2e95f5196aee3129 | https://github.com/Jinboasltw/FastSurfer/tree/3c0330c459c221b85428d3ec2e95f5196aee3129 |
MaxPoolPad | import torch
import torch.utils.data
import torch.nn as nn
from torchvision.models import *
import torch.nn.init
class MaxPoolPad(nn.Module):
def __init__(self):
super(MaxPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.MaxPool2d(3, stride=2, padding=1)
... | 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
from torchvision.models import *
import tor... | JiahuaWU/fastai | MaxPoolPad | false | 13,895 | [
"Apache-2.0"
] | 59 | 13a2df812d875abf0558004283392ab40d9bdea1 | https://github.com/JiahuaWU/fastai/tree/13a2df812d875abf0558004283392ab40d9bdea1 |
SoftQNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftQNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003):
super(SoftQNetwork, self).__init__()
self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size)
self.linear2 = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | JieRen98/Popular-RL-Algorithms | SoftQNetwork | false | 13,896 | [
"Apache-2.0"
] | 273 | 7f2bb74a51cf9cbde92a6ccfa42e97dc129dd145 | https://github.com/JieRen98/Popular-RL-Algorithms/tree/7f2bb74a51cf9cbde92a6ccfa42e97dc129dd145 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
""" Applies attention mechanism on the `context` using the `query`.
**Thank you** to IBM for their initial implementation of :class:`Attention`. Here is
their `License
<https://github.com/IBM/pytorch-seq2seq/blob/master/LICENSE>`__.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JiaqiLiu/PyTorch-NLP | Attention | false | 13,897 | [
"BSD-3-Clause"
] | 2,125 | 71d2ce1e8b8da5ab4e7732d1ebf971150986e6c8 | https://github.com/JiaqiLiu/PyTorch-NLP/tree/71d2ce1e8b8da5ab4e7732d1ebf971150986e6c8 |
CharbonnierLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | 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 functools
import torc... | Juggernaut93/mmediting | CharbonnierLoss | false | 13,898 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
CharbonnierCompLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | 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 functools
import torc... | Juggernaut93/mmediting | CharbonnierCompLoss | false | 13,899 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
L1CompositionLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import functools
impor... | Juggernaut93/mmediting | L1CompositionLoss | false | 13,900 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
def focal_loss(input_values, gamma):
"""Computes the focal loss"""
p = torch.exp(-input_values)
loss = (1 - p) ** gamma * input_values
return loss.mean()
class Focal... | 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
... | Jianf-Wang/RSG | FocalLoss | false | 13,901 | [
"MIT"
] | 108 | 3c5074511455428d81af89e1621493dcdb5db6ce | https://github.com/Jianf-Wang/RSG/tree/3c5074511455428d81af89e1621493dcdb5db6ce |
NormedLinear | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
from torch.nn import Parameter
class NormedLinear(nn.Module):
def __init__(self, in_features, out_features):
super(NormedLinear, self).__init__()
self.weight = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Jianf-Wang/RSG | NormedLinear | false | 13,902 | [
"MIT"
] | 108 | 3c5074511455428d81af89e1621493dcdb5db6ce | https://github.com/Jianf-Wang/RSG/tree/3c5074511455428d81af89e1621493dcdb5db6ce |
ComponentConditionBlock | import torch
import torch.nn as nn
import torch.utils.data.distributed
class ComponentConditionBlock(nn.Module):
def __init__(self, in_shape, n_comps):
super().__init__()
self.in_shape = in_shape
self.bias = nn.Parameter(torch.zeros(n_comps, in_shape[0], 1, 1),
requires_grad=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
import torch.nn as nn
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda... | Johnson-yue/lffont | ComponentConditionBlock | false | 13,903 | [
"MIT"
] | 98 | f31f5a1cd6a075449a0f18aaafd945d373121e15 | https://github.com/Johnson-yue/lffont/tree/f31f5a1cd6a075449a0f18aaafd945d373121e15 |
TwoLayerNet | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
class TwoLayerNet(nn.Module):
def __init__(self, D_in: 'int', H: 'int', D_out: 'int') ->None:
"""
In the constructor we instantiate two nn.Linear modules and assign them as
member variables.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JohnlNguyen/FLSim | TwoLayerNet | false | 13,904 | [
"BSD-3-Clause"
] | 79 | a5ed7c0b84499cd9dbc5fe95f8bcb4ba8ab5a5cb | https://github.com/JohnlNguyen/FLSim/tree/a5ed7c0b84499cd9dbc5fe95f8bcb4ba8ab5a5cb |
Get_gradient_nopadding | import torch
import torch.nn as nn
import torch.nn.functional as F
class Get_gradient_nopadding(nn.Module):
def __init__(self):
super(Get_gradient_nopadding, self).__init__()
kernel_v = [[0, -1, 0], [0, 0, 0], [0, 1, 0]]
kernel_h = [[0, 0, 0], [-1, 0, 1], [0, 0, 0]]
kernel_h = tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | JoeyBallentine/ESRGAN | Get_gradient_nopadding | false | 13,905 | [
"Apache-2.0"
] | 95 | 9000b43e3acf8709626f45951bb91ace1d983359 | https://github.com/JoeyBallentine/ESRGAN/tree/9000b43e3acf8709626f45951bb91ace1d983359 |
LinearRegression | import torch
import torch.nn as nn
class LinearRegression(nn.Module):
def __init__(self):
super().__init__()
self.a = nn.Parameter(torch.randn(1, requires_grad=True, dtype=
torch.float))
self.b = nn.Parameter(torch.randn(1, requires_grad=True, dtype=
torch.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | JohnlNguyen/FLSim | LinearRegression | false | 13,906 | [
"BSD-3-Clause"
] | 79 | a5ed7c0b84499cd9dbc5fe95f8bcb4ba8ab5a5cb | https://github.com/JohnlNguyen/FLSim/tree/a5ed7c0b84499cd9dbc5fe95f8bcb4ba8ab5a5cb |
ModMBStddevLayer | import torch
import torch.nn as nn
class ModMBStddevLayer(nn.Module):
"""Modified MiniBatch Stddev Layer.
This layer is modified from ``MiniBatchStddevLayer`` used in PGGAN. In
StyleGAN2, the authors add a new feature, `channel_groups`, into this
layer.
"""
def __init__(self, group_size=4, c... | 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_... | Juggernaut93/mmediting | ModMBStddevLayer | false | 13,907 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
ValueNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ValueNetwork(nn.Module):
def __init__(self, state_dim, hidden_dim, init_w=0.003):
super(ValueNetwork, self).__init__()
self.linear1 = nn.Linear(state_dim, hidden_dim)
self.linear2 = nn.Linear(hidden_dim, hidden_dim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | JieRen98/Popular-RL-Algorithms | ValueNetwork | false | 13,908 | [
"Apache-2.0"
] | 273 | 7f2bb74a51cf9cbde92a6ccfa42e97dc129dd145 | https://github.com/JieRen98/Popular-RL-Algorithms/tree/7f2bb74a51cf9cbde92a6ccfa42e97dc129dd145 |
MSECompositionLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import functools
import torch.nn as nn
from torch.nn import functional as F
assert_size_s... | Juggernaut93/mmediting | MSECompositionLoss | false | 13,909 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
PlainRefiner | import torch
import torch.nn as nn
class PlainRefiner(nn.Module):
"""Simple refiner from Deep Image Matting.
Args:
conv_channels (int): Number of channels produced by the three main
convolutional layer.
loss_refine (dict): Config of the loss of the refiner. Default: None.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Juggernaut93/mmediting | PlainRefiner | false | 13,910 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
Transformer | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
class Transformer(nn.Module):
def __init__(self, in_channels, out_channels):
super(Transformer, self).__init__()
self.T_sigma = nn.Linear(in_channels, out_channels)
self.T_gamma = nn.Linear(in_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
fr... | JunLi-Galios/PGGAN | Transformer | false | 13,911 | [
"Apache-2.0"
] | 58 | b8bd3dc44c71a985315fb82070e911378cf210db | https://github.com/JunLi-Galios/PGGAN/tree/b8bd3dc44c71a985315fb82070e911378cf210db |
ReLUHyperSolver | import torch
import torch.nn as nn
class ReLUHyperSolver(nn.Module):
def __init__(self, in_dim, out_dim, hidden_dim=32):
super().__init__()
self.fc1 = nn.Linear(in_dim, hidden_dim)
self.fc2 = nn.Linear(hidden_dim, hidden_dim)
self.fc3 = nn.Linear(hidden_dim, out_dim)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Juju-botu/diffeqml-research | ReLUHyperSolver | false | 13,912 | [
"Apache-2.0"
] | 49 | aa796c87447e5299ec4f25a07fc4d032afb1f63e | https://github.com/Juju-botu/diffeqml-research/tree/aa796c87447e5299ec4f25a07fc4d032afb1f63e |
DilatedModel | import torch
from torch import nn
import torch.nn.functional as F
class DilatedModel(nn.Module):
def __init__(self, k=16):
super(DilatedModel, self).__init__()
self.conv1 = nn.Conv2d(1, k, 3, stride=1, dilation=1, padding=1)
self.conv2 = nn.Conv2d(k, k, 3, stride=1, dilation=1, 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
from torch import nn
assert_s... | JulianYu123456/icnn | DilatedModel | false | 13,913 | [
"Apache-2.0"
] | 258 | 0aaf4b5cd13d71d98b0d05f367e1f71657ea6eb8 | https://github.com/JulianYu123456/icnn/tree/0aaf4b5cd13d71d98b0d05f367e1f71657ea6eb8 |
PolicyNetwork | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
class PolicyNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, action_range=
1.0, init_w=0.003, log_std_min=-20, log_std_max=2):
super(PolicyNetwo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JieRen98/Popular-RL-Algorithms | PolicyNetwork | false | 13,914 | [
"Apache-2.0"
] | 273 | 7f2bb74a51cf9cbde92a6ccfa42e97dc129dd145 | https://github.com/JieRen98/Popular-RL-Algorithms/tree/7f2bb74a51cf9cbde92a6ccfa42e97dc129dd145 |
DiscShiftLoss | import torch
import torch.nn as nn
class DiscShiftLoss(nn.Module):
"""Disc shift loss.
Args:
loss_weight (float, optional): Loss weight. Defaults to 1.0.
"""
def __init__(self, loss_weight=0.1):
super().__init__()
self.loss_weight = loss_weight
def forward(self, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Juggernaut93/mmediting | DiscShiftLoss | false | 13,915 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
EqualLinearActModule | import torch
import torch.nn as nn
from copy import deepcopy
from functools import partial
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is proposed in:
Progressive Growing of ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 copy import deepcopy
from functools import partial
fr... | Juggernaut93/mmediting | EqualLinearActModule | false | 13,916 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
AvgPoolHead | import torch
import torch.nn as nn
import torch.optim
class AvgPoolHead(nn.Module):
def __init__(self, in_channels, out_channels, fea_map_size):
super(AvgPoolHead, self).__init__()
self.avgpool = nn.AvgPool2d(fea_map_size, stride=1)
self.fc = nn.Linear(in_channels, out_channels)
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
import torch.nn as nn
import torch.optim
assert_size_stride = torch._C._dynamo.g... | KGMSFT/integral-human-pose | AvgPoolHead | false | 13,917 | [
"MIT"
] | 472 | d3ad4117ed71c580d2ab17987e15f9b2c3318a3b | https://github.com/KGMSFT/integral-human-pose/tree/d3ad4117ed71c580d2ab17987e15f9b2c3318a3b |
PositioningCost | import torch
import torch.nn as nn
class PositioningCost(nn.Module):
def __init__(self, target, Q=1, R=0, P=0):
super().__init__()
self.target = target
self.Q, self.R, self.P = Q, R, P
def forward(self, traj, u=None, mesh_p=None):
cost = 0.1 * torch.norm(traj[..., -1, :3] - 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Juju-botu/diffeqml-research | PositioningCost | false | 13,918 | [
"Apache-2.0"
] | 49 | aa796c87447e5299ec4f25a07fc4d032afb1f63e | https://github.com/Juju-botu/diffeqml-research/tree/aa796c87447e5299ec4f25a07fc4d032afb1f63e |
TanhHyperSolver | import torch
import torch.nn as nn
class TanhHyperSolver(nn.Module):
def __init__(self, in_dim, out_dim, hidden_dim=32):
super().__init__()
self.fc1 = nn.Linear(in_dim, hidden_dim)
self.fc2 = nn.Linear(hidden_dim, hidden_dim)
self.fc3 = nn.Linear(hidden_dim, out_dim)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Juju-botu/diffeqml-research | TanhHyperSolver | false | 13,919 | [
"Apache-2.0"
] | 49 | aa796c87447e5299ec4f25a07fc4d032afb1f63e | https://github.com/Juju-botu/diffeqml-research/tree/aa796c87447e5299ec4f25a07fc4d032afb1f63e |
NeuralArray | import torch
import torch.utils.data
import torch
import torch.nn as nn
class NeuralArray(nn.Module):
def __init__(self, dim, random_init=False):
super(NeuralArray, self).__init__()
self.dim = dim
if random_init:
self.register_parameter('data', torch.nn.Parameter(torch.randn(
... | 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | JustusThies/NeuralTexGen | NeuralArray | false | 13,920 | [
"BSD-3-Clause"
] | 49 | 008a6596cf54db3dab2d73f6248e243ca9a46e32 | https://github.com/JustusThies/NeuralTexGen/tree/008a6596cf54db3dab2d73f6248e243ca9a46e32 |
Downsample | import torch
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
class Downsample(nn.Module):
def __init__(self, in_ch=None, out_ch=None, with_conv=False, fir=False,
fir_kernel=(1, 3, 3, 1)):
super().__init__()
out_ch = out_ch if out_ch else... | 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... | DeepTitan/PNDM | Downsample | false | 13,921 | [
"Apache-2.0"
] | 61 | 4037a4f40011c9a0d47b92303e64d47fcc7ed56a | https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a |
WeightShareConv1d | import torch
import torch.nn as nn
import torch.nn
import torch.nn.functional
import torch.jit
import torch.nn.functional as F
import torch.utils.data
import torch.nn.utils
class VariationalHidDropout(nn.Module):
def __init__(self, dropout=0.0):
"""
Hidden-to-hidden (VD-based) dropout that applie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.functional
import torch.ji... | JunLi-Galios/deq | WeightShareConv1d | false | 13,922 | [
"MIT"
] | 548 | 80eb6b598357e8e01ad419126465fa3ed53b12c7 | https://github.com/JunLi-Galios/deq/tree/80eb6b598357e8e01ad419126465fa3ed53b12c7 |
DropConnect | import torch
class DropConnect(torch.nn.Module):
def __init__(self, p):
super(DropConnect, self).__init__()
self.p = p
def forward(self, inputs):
batch_size = inputs.shape[0]
inputs.shape[2]
inputs.shape[3]
channel_size = inputs.shape[1]
keep_prob = 1 ... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_si... | KelvinYang0320/nas-without-training | DropConnect | false | 13,923 | [
"MIT"
] | 385 | 5ed77a06726a73233a5a93b8f70a7172ce570029 | https://github.com/KelvinYang0320/nas-without-training/tree/5ed77a06726a73233a5a93b8f70a7172ce570029 |
AuxiliaryConvolutions | import torch
from torch import nn
import torch.nn.functional as F
class AuxiliaryConvolutions(nn.Module):
"""
Additional convolutions to produce higher-level feature maps.
"""
def __init__(self):
super(AuxiliaryConvolutions, self).__init__()
self.conv8_1 = nn.Conv2d(1024, 256, kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HFAiLab/ffrecord | AuxiliaryConvolutions | false | 13,924 | [
"MIT"
] | 47 | e916dc715ffa38a304a673ade7c5aa1efff5936d | https://github.com/HFAiLab/ffrecord/tree/e916dc715ffa38a304a673ade7c5aa1efff5936d |
Linear_Q | from torch.autograd import Function
import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def quantize(input, nbit):
return Quantizer.apply(input, nbit)
def dorefa_a(input, nbit_a):
return quantize(torch.clamp(0.1 * input, 0, 1), nbit_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Jzz24/pytorch_quantization | Linear_Q | false | 13,925 | [
"MIT"
] | 71 | 0c2d93c8ce4f85dd2c34ea6f36c58d14db21bf8e | https://github.com/Jzz24/pytorch_quantization/tree/0c2d93c8ce4f85dd2c34ea6f36c58d14db21bf8e |
TransformerNet | import torch
import numpy as np
import torch.nn as nn
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = int(np.floor(kernel_size / 2))
self.reflection_pad = nn.ReflectionPad2d(reflec... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ImageProcessingCentraleLille2021/fast-neural-style | TransformerNet | false | 13,926 | [
"MIT"
] | 350 | e77456c35c2a49f90227119d158828a0964c7e13 | https://github.com/ImageProcessingCentraleLille2021/fast-neural-style/tree/e77456c35c2a49f90227119d158828a0964c7e13 |
QNetwork | import torch
from torch import nn
class QNetwork(nn.Module):
def __init__(self, num_states, num_actions):
super().__init__()
self._num_states = num_states
self._num_actions = num_actions
self._fc1 = nn.Linear(self._num_states, 100)
self._relu1 = nn.ReLU(inplace=True)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | JulianoLagana/deep-machine-learning | QNetwork | false | 13,927 | [
"MIT"
] | 49 | 0135a84067be357c8bc3d3a4298b60dcaf7d53d5 | https://github.com/JulianoLagana/deep-machine-learning/tree/0135a84067be357c8bc3d3a4298b60dcaf7d53d5 |
SRCNN | import logging
import torch
import torch.nn as nn
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get the root logger.
The logger will be initialized if it has not been initialized. By default a
StreamHandler will be added. If `log_file` is specified, a FileHandler will
also be added. ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Juggernaut93/mmediting | SRCNN | false | 13,928 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
SnakeHyperSolver | import torch
import torch.nn as nn
from torch import sin
from torch import pow
from torch.nn import Parameter
from torch.distributions.exponential import Exponential
class Snake(nn.Module):
"""
Implementation of the serpentine-like sine-based periodic activation function
.. math::
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 math as tl_math
import torch.... | Juju-botu/diffeqml-research | SnakeHyperSolver | false | 13,929 | [
"Apache-2.0"
] | 49 | aa796c87447e5299ec4f25a07fc4d032afb1f63e | https://github.com/Juju-botu/diffeqml-research/tree/aa796c87447e5299ec4f25a07fc4d032afb1f63e |
RLFeatPreprocessNet | import torch
from torch import nn
import torch.nn.parallel
class RLFeatPreprocessNet(nn.Module):
def __init__(self, feature_size, embed_size, box_info_size,
overlap_info_size, output_size):
super(RLFeatPreprocessNet, self).__init__()
self.feature_size = feature_size
self.embed_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 import nn
import torch.nn.parallel
assert_size_stride = torch._C._dyn... | KaihuaTang/VCTree-Scene-Graph-Generation | RLFeatPreprocessNet | false | 13,930 | [
"MIT"
] | 109 | 75bc30543dbb5a869acff65b2183efa7ee4ac35d | https://github.com/KaihuaTang/VCTree-Scene-Graph-Generation/tree/75bc30543dbb5a869acff65b2183efa7ee4ac35d |
Softplus | import torch
import numpy as np
from torch.utils.data import Dataset as Dataset
import torch.nn as nn
import torch.utils.data
def activation_shifting(activation):
def shifted_activation(x):
return activation(x) - activation(torch.zeros_like(x))
return shifted_activation
def cauchy_softplus(x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import numpy as np
from torch.utils.data import Dataset as Dat... | KelvinKan/CP-Flow | Softplus | false | 13,931 | [
"MIT"
] | 64 | d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 | https://github.com/KelvinKan/CP-Flow/tree/d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 |
MaxPool3x3 | import torch
import torch.nn as nn
class MaxPool3x3(nn.Module):
"""3x3 max pool with no subsampling."""
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1):
super(MaxPool3x3, self).__init__()
self.maxpool = nn.MaxPool2d(kernel_size, stride, padding)
... | 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... | KelvinYang0320/nas-without-training | MaxPool3x3 | false | 13,932 | [
"MIT"
] | 385 | 5ed77a06726a73233a5a93b8f70a7172ce570029 | https://github.com/KelvinYang0320/nas-without-training/tree/5ed77a06726a73233a5a93b8f70a7172ce570029 |
PseudoCoord | import torch
import torch.nn as nn
import torch.utils.data
class PseudoCoord(nn.Module):
def __init__(self):
super(PseudoCoord, self).__init__()
def forward(self, b):
"""
Input:
b: bounding box [batch, num_obj, 4] (x1,y1,x2,y2)
Output:
pseudo_coord ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dy... | KaihuaTang/VQA2.0-Recent-Approachs-2018.pytorch | PseudoCoord | false | 13,933 | [
"MIT"
] | 298 | 52e1ba5a7f3b88c617115ccc755e2e7868e8de2b | https://github.com/KaihuaTang/VQA2.0-Recent-Approachs-2018.pytorch/tree/52e1ba5a7f3b88c617115ccc755e2e7868e8de2b |
Conv2d | from torch.autograd import Function
import torch
import numpy as np
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
def _setup_kernel(k):
k = np.asarray(k, dtype=np.float32)
if k.ndim == 1:
k = np.outer(k, k)
k /= np.sum(k)
assert k.ndim == 2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import numpy as np
import torchvision.transf... | DeepTitan/PNDM | Conv2d | false | 13,934 | [
"Apache-2.0"
] | 61 | 4037a4f40011c9a0d47b92303e64d47fcc7ed56a | https://github.com/DeepTitan/PNDM/tree/4037a4f40011c9a0d47b92303e64d47fcc7ed56a |
SymmSoftplus | import torch
from torch.utils.data import Dataset as Dataset
import torch.utils.data
def symm_softplus(x, softplus_=torch.nn.functional.softplus):
return softplus_(x) - 0.5 * x
class SymmSoftplus(torch.nn.Module):
def forward(self, x):
return symm_softplus(x)
def get_inputs():
return [torch.r... | 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.utils.data import Dataset as Dataset
import torch.u... | KelvinKan/CP-Flow | SymmSoftplus | false | 13,935 | [
"MIT"
] | 64 | d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 | https://github.com/KelvinKan/CP-Flow/tree/d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 |
UpBlock | import torch
import torch.nn as nn
class UpBlock(nn.Module):
def __init__(self, in_f, out_f, stride=2, add_blur=False):
super(UpBlock, self).__init__()
self.shuffle = nn.ConvTranspose2d(in_f, out_f, kernel_size=3,
stride=stride, padding=0)
self.has_blur = add_blur
if 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Kash6/AnimeBot | UpBlock | false | 13,936 | [
"MIT"
] | 177 | 99c68bdb03501d6919669c4aabbb9fe5ea92ec8e | https://github.com/Kash6/AnimeBot/tree/99c68bdb03501d6919669c4aabbb9fe5ea92ec8e |
FCNet | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
import torch.utils.data
class FCNet(nn.Module):
def __init__(self, in_size, out_size, activate=None, drop=0.0):
super(FCNet, self).__init__()
self.lin = weight_norm(nn.Linear(in_size, out_size), dim=None)
self.drop_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | KaihuaTang/VQA2.0-Recent-Approachs-2018.pytorch | FCNet | false | 13,937 | [
"MIT"
] | 298 | 52e1ba5a7f3b88c617115ccc755e2e7868e8de2b | https://github.com/KaihuaTang/VQA2.0-Recent-Approachs-2018.pytorch/tree/52e1ba5a7f3b88c617115ccc755e2e7868e8de2b |
ModulatedToRGB | import torch
import torch.nn as nn
from copy import deepcopy
from functools import partial
from torch.nn import functional as F
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is pro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 copy import deepcopy
from functools import partial
fr... | Juggernaut93/mmediting | ModulatedToRGB | false | 13,938 | [
"Apache-2.0"
] | 1,884 | 8ef46ace29756dd2df1d92f2f73a33646e33e007 | https://github.com/Juggernaut93/mmediting/tree/8ef46ace29756dd2df1d92f2f73a33646e33e007 |
PosLinear | import torch
from torch import Tensor
from torch.utils.data import Dataset as Dataset
import torch.nn as nn
import torch.utils.data
class PosLinear(torch.nn.Linear):
def forward(self, x: 'Tensor') ->Tensor:
gain = 1 / x.size(1)
return nn.functional.linear(x, torch.nn.functional.softplus(self.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
fr... | KelvinKan/CP-Flow | PosLinear | false | 13,939 | [
"MIT"
] | 64 | d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 | https://github.com/KelvinKan/CP-Flow/tree/d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 |
MeanDistLoss | import torch
class MeanDistLoss(torch.nn.Module):
def __init__(self, p=2):
super().__init__()
self.p = p
def forward(self, x, y):
return torch.mean(torch.cdist(x, y, p=self.p))
def extra_repr(self):
return c_f.extra_repr(self, ['p'])
def get_inputs():
return [torch... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | KevinMusgrave/pytorch-adapt | MeanDistLoss | false | 13,940 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
M2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv2D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, same_padding
=False, stride=1, relu=True, bn=False):
super(Conv2D, self).__init__()
padding = int((kernel_size - 1) / 2) if same_padding e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Juggernaut93/SSH-pytorch | M2 | false | 13,941 | [
"MIT"
] | 63 | 8ea205fb1a3adfc32b5a4e35f68ed4d385ddbc31 | https://github.com/Juggernaut93/SSH-pytorch/tree/8ea205fb1a3adfc32b5a4e35f68ed4d385ddbc31 |
AbsLoss | import torch
class AbsLoss(torch.nn.Module):
"""
The mean absolute value.
"""
def forward(self, x):
""""""
return torch.mean(torch.abs(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
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | KevinMusgrave/pytorch-adapt | AbsLoss | false | 13,942 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
M3 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv2D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, same_padding
=False, stride=1, relu=True, bn=False):
super(Conv2D, self).__init__()
padding = int((kernel_size - 1) / 2) if same_padding e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Juggernaut93/SSH-pytorch | M3 | false | 13,943 | [
"MIT"
] | 63 | 8ea205fb1a3adfc32b5a4e35f68ed4d385ddbc31 | https://github.com/Juggernaut93/SSH-pytorch/tree/8ea205fb1a3adfc32b5a4e35f68ed4d385ddbc31 |
AdaptiveFeatureNorm | import torch
class AdaptiveFeatureNorm(torch.nn.Module):
"""
Implementation of the loss in
[Larger Norm More Transferable:
An Adaptive Feature Norm Approach for
Unsupervised Domain Adaptation](https://arxiv.org/abs/1811.07456).
Encourages features to gradually have larger and larger L2 norms.
... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | KevinMusgrave/pytorch-adapt | AdaptiveFeatureNorm | false | 13,944 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
UniformDistributionLoss | import torch
import torch.nn.functional as F
class UniformDistributionLoss(torch.nn.Module):
"""
Implementation of the confusion loss from
[Simultaneous Deep Transfer Across Domains and Tasks](https://arxiv.org/abs/1510.02192).
"""
def forward(self, x, *args):
""""""
probs = F.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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | KevinMusgrave/pytorch-adapt | UniformDistributionLoss | false | 13,945 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
BatchSpectralLoss | import torch
def batch_spectral_loss(x, k):
singular_values = torch.linalg.svdvals(x)
return torch.sum(singular_values[:k] ** 2)
class BatchSpectralLoss(torch.nn.Module):
"""
Implementation of the loss in
[Transferability vs. Discriminability: Batch Spectral
Penalization for Adversarial Doma... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | KevinMusgrave/pytorch-adapt | BatchSpectralLoss | false | 13,946 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
CORALLoss | import torch
def covariance(x):
batch_size = x.shape[0]
mm1 = torch.mm(x.t(), x)
cols_summed = torch.sum(x, dim=0)
mm2 = torch.mm(cols_summed.unsqueeze(1), cols_summed.unsqueeze(0))
return 1.0 / (batch_size - 1) * (mm1 - 1.0 / batch_size * mm2)
class CORALLoss(torch.nn.Module):
"""
Imple... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
assert_size_stride ... | KevinMusgrave/pytorch-adapt | CORALLoss | false | 13,947 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
SumNormalizer | import torch
def sum_normalizer(x, detach=False, scale_by_batch_size=False):
y = torch.sum(x)
if detach:
y = y.detach()
if scale_by_batch_size:
x = x * x.shape[0]
return x / y
class SumNormalizer(torch.nn.Module):
def __init__(self, detach=False, scale_by_batch_size=False):
... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | KevinMusgrave/pytorch-adapt | SumNormalizer | false | 13,948 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
Encoder | import torch
from torch import nn
import torch.hub
import torch.nn.functional as F
class Encoder(nn.Module):
"""Estimation of the nonnegative mixture weight by a 1-D conv layer.
"""
def __init__(self, L, N, audio_channels):
super(Encoder, self).__init__()
self.L, self.N = L, N
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | KilianRuiz2B/demucs | Encoder | false | 13,949 | [
"MIT"
] | 3,013 | a6fbf3806b018634f68563887feaee64c5e36600 | https://github.com/KilianRuiz2B/demucs/tree/a6fbf3806b018634f68563887feaee64c5e36600 |
BNMLoss | import torch
class BNMLoss(torch.nn.Module):
"""
Implementation of the loss in
[Towards Discriminability and Diversity:
Batch Nuclear-norm Maximization
under Label Insufficient Situations](https://arxiv.org/abs/2003.12237).
"""
def forward(self, x):
""""""
x = torch.nn.fun... | 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
assert_size_stride = t... | KevinMusgrave/pytorch-adapt | BNMLoss | false | 13,950 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
MinMaxNormalizer | import torch
def min_max_normalizer(x, detach=False):
x_min = torch.min(x)
x_max = torch.max(x)
if detach:
x_min = x_min.detach()
x_max = x_max.detach()
return (x - x_min) / (x_max - x_min)
class MinMaxNormalizer(torch.nn.Module):
def __init__(self, detach=False):
super(... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | KevinMusgrave/pytorch-adapt | MinMaxNormalizer | false | 13,951 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
SineLayer | import torch
import numpy as np
import torch.nn as nn
class SineLayer(nn.Module):
def __init__(self, in_features, out_features, bias=True, is_first=False,
omega_0=30):
super().__init__()
self.omega_0 = omega_0
self.is_first = is_first
self.in_features = in_features
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | Juju-botu/diffeqml-research | SineLayer | false | 13,952 | [
"Apache-2.0"
] | 49 | aa796c87447e5299ec4f25a07fc4d032afb1f63e | https://github.com/Juju-botu/diffeqml-research/tree/aa796c87447e5299ec4f25a07fc4d032afb1f63e |
LRN | import torch
import torch.nn as nn
class LRN(nn.Module):
def __init__(self, local_size=1, alpha=0.0001, beta=0.75,
ACROSS_CHANNELS=False):
super(LRN, self).__init__()
self.ACROSS_CHANNELS = ACROSS_CHANNELS
if self.ACROSS_CHANNELS:
self.average = nn.AvgPool3d(kernel_siz... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Kitware/VAIME | LRN | false | 13,953 | [
"BSD-3-Clause"
] | 127 | 47b24b9d8a208cf8c621e5bb1088c61fcf507af6 | https://github.com/Kitware/VAIME/tree/47b24b9d8a208cf8c621e5bb1088c61fcf507af6 |
SDFNetwork | import torch
import numpy as np
import torch.nn as nn
def get_embedder(multires, input_dims=3):
embed_kwargs = {'include_input': True, 'input_dims': input_dims,
'max_freq_log2': multires - 1, 'num_freqs': multires,
'log_sampling': True, 'periodic_fns': [torch.sin, torch.cos]}
embedder_obj = Em... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | Junlin-Yin/NeuS | SDFNetwork | false | 13,954 | [
"MIT"
] | 345 | b13dba90ba1c65d0ccaaca6b9d65225d5dfa8fe2 | https://github.com/Junlin-Yin/NeuS/tree/b13dba90ba1c65d0ccaaca6b9d65225d5dfa8fe2 |
PosLinear2 | import torch
from torch import Tensor
from torch.utils.data import Dataset as Dataset
import torch.nn as nn
import torch.utils.data
class PosLinear2(torch.nn.Linear):
def forward(self, x: 'Tensor') ->Tensor:
return nn.functional.linear(x, torch.nn.functional.softmax(self.
weight, 1), self.bia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | KelvinKan/CP-Flow | PosLinear2 | false | 13,955 | [
"MIT"
] | 64 | d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 | https://github.com/KelvinKan/CP-Flow/tree/d01303cb4ebeb5a0bbfca638ffaf5b7a8ec22fb1 |
UpsamplingBilinear2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class UpsamplingBilinear2d(nn.Module):
def __init__(self, scale_factor=2.0):
super().__init__()
self.scale_factor = scale_factor
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale_factor, mode=
... | 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... | KyleDavisSA/pde-surrogate | UpsamplingBilinear2d | false | 13,956 | [
"MIT"
] | 62 | 41ad2c9eb73c323e389174080f4b3df6cbd3c900 | https://github.com/KyleDavisSA/pde-surrogate/tree/41ad2c9eb73c323e389174080f4b3df6cbd3c900 |
RewardCriterion | import torch
from torch import nn
import torch.nn.init
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward):
input = input.contiguous().view(-1)
reward = reward.contiguous().view(-1)
mask = (seq > ... | 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.init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | KunpengLi1994/VSRN | RewardCriterion | false | 13,957 | [
"Apache-2.0"
] | 238 | 777ae74326fdb6abe69dbd3911d0e545322520d1 | https://github.com/KunpengLi1994/VSRN/tree/777ae74326fdb6abe69dbd3911d0e545322520d1 |
MVCRegularizer | import torch
import torch.nn.parallel
import torch.utils.data
class MVCRegularizer(torch.nn.Module):
"""
penalize MVC with large absolute value and negative values
alpha * large_weight^2 + beta * (negative_weight)^2
"""
def __init__(self, alpha=1.0, beta=1.0, threshold=5.0):
super().__ini... | 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.parall... | KunalMGupta/deep_cage | MVCRegularizer | false | 13,958 | [
"MIT"
] | 123 | d8454c40d650911341b7f594af2fcefcf26f3d1d | https://github.com/KunalMGupta/deep_cage/tree/d8454c40d650911341b7f594af2fcefcf26f3d1d |
MultiplicativeIntegration | import torch
import torch.nn as nn
from typing import List
class MultiplicativeIntegration(nn.Module):
def __init__(self, inputs_sizes: 'List[int]', output_sizes: 'List[int]',
bias: 'bool', bias_start: 'float'=0.0, alpha_start: 'float'=1.0,
beta_start: 'float'=1.0):
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
import torch.nn as nn
from typing import List
assert_size_stride = torch._C._dyn... | KnowingNothing/FlexTensor | MultiplicativeIntegration | false | 13,959 | [
"MIT"
] | 135 | 00f6cd7e038af7714b833fde7034d465fe2dc4a7 | https://github.com/KnowingNothing/FlexTensor/tree/00f6cd7e038af7714b833fde7034d465fe2dc4a7 |
QuanConv | from torch.autograd import Function
import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def quantize(input, nbit):
return Quantizer.apply(input, nbit)
def dorefa_a(input, nbit_a):
return quantize(torch.clamp(0.1 * input, 0, 1), nbit_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Jzz24/pytorch_quantization | QuanConv | false | 13,960 | [
"MIT"
] | 71 | 0c2d93c8ce4f85dd2c34ea6f36c58d14db21bf8e | https://github.com/Jzz24/pytorch_quantization/tree/0c2d93c8ce4f85dd2c34ea6f36c58d14db21bf8e |
SlicedWasserstein | import torch
class SlicedWasserstein(torch.nn.Module):
"""
Implementation of the loss used in
[Sliced Wasserstein Discrepancy for Unsupervised Domain Adaptation](https://arxiv.org/abs/1903.04064)
"""
def __init__(self, m: 'int'=128):
"""
Arguments:
m: The dimensionalit... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | KevinMusgrave/pytorch-adapt | SlicedWasserstein | false | 13,961 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
EncoderImagePrecomp | import torch
import numpy as np
from torch import nn
from collections import OrderedDict
import torch.nn.init
def l2norm(X):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt()
X = torch.div(X, norm)
return X
class EncoderImagePrecomp(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 libdevice
import numpy as np
... | KunpengLi1994/VSRN | EncoderImagePrecomp | false | 13,962 | [
"Apache-2.0"
] | 238 | 777ae74326fdb6abe69dbd3911d0e545322520d1 | https://github.com/KunpengLi1994/VSRN/tree/777ae74326fdb6abe69dbd3911d0e545322520d1 |
SppBlock | import torch
import torch.nn.functional as F
from torch import nn
class SppBlock(nn.Module):
def __init__(self, in_channels):
super(SppBlock, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=[2, 2], stride=2)
self.pool2 = nn.MaxPool2d(kernel_size=[3, 3], stride=3)
self.pool3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | JiYuanFeng/MCTrans | SppBlock | false | 13,963 | [
"Apache-2.0"
] | 84 | 9b8b5677eef584b423d5e1630680a4b667cbe823 | https://github.com/JiYuanFeng/MCTrans/tree/9b8b5677eef584b423d5e1630680a4b667cbe823 |
SymNetsCategoryLoss | import torch
import torch.nn.functional as F
def split_half(x, dim):
d = x.shape[dim] // 2
return torch.split(x, d, dim=dim)
class ConcatSoftmax(torch.nn.Module):
"""
Applies softmax to the concatenation of a list of tensors.
"""
def __init__(self, dim: 'int'=1):
"""
Argumen... | 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
assert_size_stride = t... | KevinMusgrave/pytorch-adapt | SymNetsCategoryLoss | false | 13,964 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
Snake | import torch
import torch.nn as nn
from torch import sin
from torch import pow
from torch.nn import Parameter
from torch.distributions.exponential import Exponential
class Snake(nn.Module):
"""
Implementation of the serpentine-like sine-based periodic activation function
.. math::
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 math as tl_math
import torch.nn as nn
from torch.nn import Parameter
from torch.distribut... | Juju-botu/diffeqml-research | Snake | false | 13,965 | [
"Apache-2.0"
] | 49 | aa796c87447e5299ec4f25a07fc4d032afb1f63e | https://github.com/Juju-botu/diffeqml-research/tree/aa796c87447e5299ec4f25a07fc4d032afb1f63e |
MNISTFeatures | import torch
import torch.nn.functional as F
import torch.nn as nn
class MNISTFeatures(nn.Module):
"""
A small convnet for extracting features
from MNIST.
"""
def __init__(self):
""" """
super().__init__()
self.conv1 = nn.Conv2d(3, 32, 5, 1)
self.conv2 = nn.Conv2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | KevinMusgrave/pytorch-adapt | MNISTFeatures | false | 13,966 | [
"MIT"
] | 131 | ff1491e1bfcc586afb8ee619712c8816ddf10358 | https://github.com/KevinMusgrave/pytorch-adapt/tree/ff1491e1bfcc586afb8ee619712c8816ddf10358 |
MultiHeadAttention | import torch
import numpy as np
import torch.nn as nn
def dot_product_attention(queries, keys, values, normalise=True):
"""
:param queries:[batch_size, N_target, key_size]
:param keys:[batch_size, N_context, key_size]
:param values: []
:param normalise:
:return:
"""
key_size = keys.sha... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JuliusSchwartz/FlowMO | MultiHeadAttention | false | 13,967 | [
"MIT"
] | 53 | e221d989914f906501e1ad19cd3629d88eac1785 | https://github.com/JuliusSchwartz/FlowMO/tree/e221d989914f906501e1ad19cd3629d88eac1785 |
PerformanceModel | import torch
import torch.nn as nn
class PerformanceModel(nn.Module):
def __init__(self, input_len):
super(PerformanceModel, self).__init__()
self.input_len = input_len
self.linear1 = nn.Linear(self.input_len, 32, bias=True)
self.dropout1 = nn.Dropout(p=0.01)
self.activate... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | KnowingNothing/FlexTensor | PerformanceModel | false | 13,968 | [
"MIT"
] | 135 | 00f6cd7e038af7714b833fde7034d465fe2dc4a7 | https://github.com/KnowingNothing/FlexTensor/tree/00f6cd7e038af7714b833fde7034d465fe2dc4a7 |
BinaryLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class BinaryLoss(nn.Module):
def __init__(self):
super(BinaryLoss, self).__init__()
def forward(self, pos_score, neg_score):
pos_loss = -F.log_softmax(pos_score)[:, 1]
neg_loss = -F.log_softmax(neg_score)[:, 0]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Kitware/VAIME | BinaryLoss | false | 13,969 | [
"BSD-3-Clause"
] | 127 | 47b24b9d8a208cf8c621e5bb1088c61fcf507af6 | https://github.com/Kitware/VAIME/tree/47b24b9d8a208cf8c621e5bb1088c61fcf507af6 |
Conv2dZeros | import torch
import torch.nn as nn
class Conv2dZeros(nn.Module):
"""Normal conv2d for reparameterize the latent variable.
- weight and bias initialized to zero
- scale channel-wise after conv2d
"""
def __init__(self, in_channels, out_channels):
super(Conv2dZeros, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | KyleDavisSA/pde-surrogate | Conv2dZeros | false | 13,970 | [
"MIT"
] | 62 | 41ad2c9eb73c323e389174080f4b3df6cbd3c900 | https://github.com/KyleDavisSA/pde-surrogate/tree/41ad2c9eb73c323e389174080f4b3df6cbd3c900 |
RingLoss | import torch
import torch.nn as nn
class RingLoss(nn.Module):
"""Ring loss.
Reference:
Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018.
"""
def __init__(self, weight_ring=1.0):
super(RingLoss, self).__init__()
self.radius = nn.Parameter(to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | LT1st/ReID_Alined_beginer | RingLoss | false | 13,971 | [
"MIT"
] | 370 | 1a12403a32d99900451ac05cd3623a9b770f6d24 | https://github.com/LT1st/ReID_Alined_beginer/tree/1a12403a32d99900451ac05cd3623a9b770f6d24 |
_DenseBlockInput | import torch
import torch.nn as nn
class _DenseLayer(nn.Sequential):
"""One dense layer within dense block, with bottleneck design.
Args:
in_features (int):
growth_rate (int): # out feature maps of every dense layer
drop_rate (float):
bn_size (int): Specifies maximum # feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | KyleDavisSA/pde-surrogate | _DenseBlockInput | false | 13,972 | [
"MIT"
] | 62 | 41ad2c9eb73c323e389174080f4b3df6cbd3c900 | https://github.com/KyleDavisSA/pde-surrogate/tree/41ad2c9eb73c323e389174080f4b3df6cbd3c900 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.