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 |
|---|---|---|---|---|---|---|---|---|---|---|
M_VDNMixer | from _paritybench_helpers import _mock_config
import torch
import numpy as np
import torch.nn as nn
def to_torch(input):
return torch.from_numpy(input) if type(input) == np.ndarray else input
class M_VDNMixer(nn.Module):
"""
Computes total Q values given agent q values and global states.
:param args... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | Maxtoq/off-policy | M_VDNMixer | false | 16,099 | [
"MIT"
] | 76 | e866f13a3d144a29552c38f104bcdfb411036138 | https://github.com/Maxtoq/off-policy/tree/e866f13a3d144a29552c38f104bcdfb411036138 |
ycbcr_to_rgb_jpeg | import torch
import numpy as np
import torch.nn as nn
class ycbcr_to_rgb_jpeg(nn.Module):
""" Converts YCbCr image to RGB JPEG
Input:
image(tensor): batch x height x width x 3
Outpput:
result(tensor): batch x 3 x height x width
"""
def __init__(self):
super(ycbcr_to_rgb_jp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | mlomnitz/DifferentiableJPEG | ycbcr_to_rgb_jpeg | false | 16,100 | [
"MIT"
] | 86 | a5767feba955a1bcb78600135a09c36a806f6249 | https://github.com/mlomnitz/DifferentiableJPEG/tree/a5767feba955a1bcb78600135a09c36a806f6249 |
LightHead | import torch
from torch import nn
class RMSNorm(nn.Module):
"""An implementation of RMS Normalization.
# https://catalyst-team.github.io/catalyst/_modules/catalyst/contrib/nn/modules/rms_norm.html#RMSNorm
"""
def __init__(self, dimension: 'int', epsilon: 'float'=1e-08, is_bias:
'bool'=False)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | mohamedbakrey12/prpjectINDeepLearning | LightHead | false | 16,101 | [
"MIT"
] | 122 | b6106ee13ff9377e4a84bee4814bd54a34156930 | https://github.com/mohamedbakrey12/prpjectINDeepLearning/tree/b6106ee13ff9377e4a84bee4814bd54a34156930 |
TVLoss | import torch
from torch import nn
from torch.nn import functional as F
class TVLoss(nn.Module):
def forward(self, input):
input = F.pad(input, (0, 1, 0, 1), 'replicate')
x_diff = input[..., :-1, 1:] - input[..., :-1, :-1]
y_diff = input[..., 1:, :-1] - input[..., :-1, :-1]
diff = ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | momo-the-monster/vqgan-clip-app | TVLoss | false | 16,102 | [
"MIT"
] | 63 | 56cfc0a53928d6d8f90ed8c79439afb4430bc118 | https://github.com/momo-the-monster/vqgan-clip-app/tree/56cfc0a53928d6d8f90ed8c79439afb4430bc118 |
ClassicalConv2 | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.utils.prune
import torch.backends.cudnn
import torch.cuda
import torch.nn
import torch.utils.data
class ClassicalConv2(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 4, 2, 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
from torch._inductor.runtime.... | mit-han-lab/pytorch-quantum | ClassicalConv2 | false | 16,103 | [
"MIT"
] | 98 | 05cf000d689307f6b1fe02d12744ad455685935b | https://github.com/mit-han-lab/pytorch-quantum/tree/05cf000d689307f6b1fe02d12744ad455685935b |
Anchor3DHead | import torch
import numpy as np
import torch.nn as nn
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-06):
"""Calculate overlap between two set of bboxes.
If ``is_aligned `` is ``False``, then calculate the overlaps between each
bbox of bboxes1 and bboxes2, otherwise the overlaps... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | mi-exwzd/Open3D-ML | Anchor3DHead | false | 16,104 | [
"MIT"
] | 447 | d58b24edd37de7889446360164cd5500e0bde060 | https://github.com/mi-exwzd/Open3D-ML/tree/d58b24edd37de7889446360164cd5500e0bde060 |
CRF | import torch
from torch import nn
class CRF(nn.Module):
def __init__(self, num_nodes, iteration=10):
"""Initialize the CRF module
Args:
num_nodes: int, number of nodes/patches within the fully CRF
iteration: int, number of mean field iterations, e.g. 10
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | mingrui/NCRF | CRF | false | 16,105 | [
"Apache-2.0"
] | 734 | d3dcb50739a9eb8621d42ea98b7d0496afe430ca | https://github.com/mingrui/NCRF/tree/d3dcb50739a9eb8621d42ea98b7d0496afe430ca |
AODnet | import torch
import torch.nn as nn
import torch.nn.functional as F
class AODnet(nn.Module):
def __init__(self):
super(AODnet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=3, kernel_size=1)
self.conv2 = nn.Conv2d(in_channels=3, out_channels=3, kernel_size=3,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | misads/cv_template | AODnet | false | 16,106 | [
"MIT"
] | 69 | 9976ee0ada449a494d26f896c598610f233edc10 | https://github.com/misads/cv_template/tree/9976ee0ada449a494d26f896c598610f233edc10 |
ClassicalConv5 | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.utils.prune
import torch.backends.cudnn
import torch.cuda
import torch.nn
import torch.utils.data
class ClassicalConv5(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1, 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
from torch._inductor.runtime.... | mit-han-lab/pytorch-quantum | ClassicalConv5 | false | 16,107 | [
"MIT"
] | 98 | 05cf000d689307f6b1fe02d12744ad455685935b | https://github.com/mit-han-lab/pytorch-quantum/tree/05cf000d689307f6b1fe02d12744ad455685935b |
Generator | import torch
from torch import nn
def gumbel_softmax(logits, tau=1.0, hard=False, log_mode=True, dim=-1):
while True:
gumbels = -torch.empty_like(logits).exponential_().log()
gumbels = (logits + gumbels) / tau
if log_mode:
y_soft = gumbels.log_softmax(dim)
else:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mosespv96/SCAPT-ABSA | Generator | false | 16,108 | [
"MIT"
] | 49 | 6f7f89a131127f262a8d1fd2774e5a96b58e7193 | https://github.com/mosespv96/SCAPT-ABSA/tree/6f7f89a131127f262a8d1fd2774e5a96b58e7193 |
ShiftSoftplus | import torch
import numpy as np
from torch.nn import Softplus
class ShiftSoftplus(Softplus):
"""
Shiftsoft plus activation function:
1/beta * (log(1 + exp**(beta * x)) - log(shift))
"""
def __init__(self, beta=1, shift=2, threshold=20):
super().__init__(beta, threshold)
self.s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.nn import Softplus
assert_size_stride = torch._C._d... | mufeili/Alchemy | ShiftSoftplus | false | 16,109 | [
"MIT"
] | 116 | 659c59fbbe93d406f8b3e0711e5a048e58c9c43c | https://github.com/mufeili/Alchemy/tree/659c59fbbe93d406f8b3e0711e5a048e58c9c43c |
Sinh | import torch
import torch.onnx
import torch.nn as nn
class Sinh(nn.Module):
def forward(self, x):
return torch.sinh(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.triton_helpers import libdevice
import torch.onnx
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | mil-tokyo/webdnn | Sinh | false | 16,110 | [
"MIT"
] | 1,967 | 38a60fd3e1a4e72bc01108189a3aa51e0752aecd | https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd |
VAE | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(784, 400)
self.fc21 = nn.Linear(400, 20)
self.fc22 = nn.Linear(400, 20)
self.fc3 = nn.Linear(20, 400)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | momohatt/chainer-compiler | VAE | false | 16,111 | [
"MIT"
] | 116 | 26782cd29a5becf8e2badf268b47d98b3a6aea1d | https://github.com/momohatt/chainer-compiler/tree/26782cd29a5becf8e2badf268b47d98b3a6aea1d |
idct_8x8 | import itertools
import torch
import numpy as np
import torch.nn as nn
class idct_8x8(nn.Module):
""" Inverse discrete Cosine Transformation
Input:
dcp(tensor): batch x height x width
Output:
image(tensor): batch x height x width
"""
def __init__(self):
super(idct_8x8, 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
import itertools
import numpy as np
import torch.nn as nn
assert_size_stride = t... | mlomnitz/DifferentiableJPEG | idct_8x8 | false | 16,112 | [
"MIT"
] | 86 | a5767feba955a1bcb78600135a09c36a806f6249 | https://github.com/mlomnitz/DifferentiableJPEG/tree/a5767feba955a1bcb78600135a09c36a806f6249 |
NextSentencePrediction | import torch
import torch.nn as nn
class NextSentencePrediction(nn.Module):
"""
2-class classification model : is_next, is_not_next
"""
def __init__(self, hidden):
"""
:param hidden: BERT model output size
"""
super().__init__()
self.linear = nn.Linear(hidden, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mortonjt/BERT-pytorch | NextSentencePrediction | false | 16,113 | [
"Apache-2.0"
] | 5,013 | d10dc4f9d5a6f2ca74380f62039526eb7277c671 | https://github.com/mortonjt/BERT-pytorch/tree/d10dc4f9d5a6f2ca74380f62039526eb7277c671 |
ClassicalConv6 | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.utils.prune
import torch.backends.cudnn
import torch.cuda
import torch.nn
import torch.utils.data
class ClassicalConv6(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1, 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
from torch._inductor.runtime.... | mit-han-lab/pytorch-quantum | ClassicalConv6 | false | 16,114 | [
"MIT"
] | 98 | 05cf000d689307f6b1fe02d12744ad455685935b | https://github.com/mit-han-lab/pytorch-quantum/tree/05cf000d689307f6b1fe02d12744ad455685935b |
ComplexDropout | import torch
from torch import nn
import torch.utils
class ComplexDropout(nn.Module):
def __init__(self, p=0.5, inplace=False):
super(ComplexDropout, self).__init__()
self.p = p
self.inplace = inplace
self.dropout_r = nn.Dropout(p, inplace)
self.dropout_i = nn.Dropout(p, i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | muqiaoy/dl_signal | ComplexDropout | false | 16,115 | [
"MIT"
] | 54 | 3a30d14982016644bfc96a7d1ca0109b441f17fd | https://github.com/muqiaoy/dl_signal/tree/3a30d14982016644bfc96a7d1ca0109b441f17fd |
SeparableBlock | from torch.nn import Module
import torch
from torch.nn import Linear
class SeparableBlock(Module):
def __init__(self, input_size, kernel_channels_in, kernel_channels_out,
kernel_size):
super(SeparableBlock, self).__init__()
self.input_size = input_size
self.kernel_size = kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch.nn import Linear
assert_size_stride = tor... | morzh/hyperstyle | SeparableBlock | false | 16,116 | [
"MIT"
] | 692 | ed87f620143d045f374aa42712a43abd751a90e6 | https://github.com/morzh/hyperstyle/tree/ed87f620143d045f374aa42712a43abd751a90e6 |
ComplexReLU | import torch
from torch import nn
import torch.utils
class ComplexReLU(nn.Module):
def __init__(self):
super(ComplexReLU, self).__init__()
self.relu_r = nn.ReLU()
self.relu_i = nn.ReLU()
def forward(self, input_r, input_i):
return self.relu_r(input_r), self.relu_i(input_i)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils
assert_size_stride = torch._C._dynamo.guards.asse... | muqiaoy/dl_signal | ComplexReLU | false | 16,117 | [
"MIT"
] | 54 | 3a30d14982016644bfc96a7d1ca0109b441f17fd | https://github.com/muqiaoy/dl_signal/tree/3a30d14982016644bfc96a7d1ca0109b441f17fd |
LabelSmoothing | import torch
import torch.nn as nn
class LabelSmoothing(nn.Module):
"""
NLL loss with label smoothing.
"""
def __init__(self, smoothing=0.0, n_cls=2):
"""
Constructor for the LabelSmoothing module.
:param smoothing: label smoothing factor
"""
super(LabelSmoothi... | 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
... | mrblasco/kaggle_moa_winner_hungry_for_gold | LabelSmoothing | false | 16,118 | [
"Apache-2.0"
] | 89 | 00df6d0aa4a48e526cee3e36f6e723a1534bfa08 | https://github.com/mrblasco/kaggle_moa_winner_hungry_for_gold/tree/00df6d0aa4a48e526cee3e36f6e723a1534bfa08 |
ComplexConv1d | import torch
from torch import nn
import torch.utils
class ComplexConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=0, dilation=1, groups=1, bias=True):
super(ComplexConv1d, self).__init__()
self.conv_r = nn.Conv1d(in_channels, out_channels,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils
assert_size_stride = torch._C._dynamo.gu... | muqiaoy/dl_signal | ComplexConv1d | false | 16,119 | [
"MIT"
] | 54 | 3a30d14982016644bfc96a7d1ca0109b441f17fd | https://github.com/muqiaoy/dl_signal/tree/3a30d14982016644bfc96a7d1ca0109b441f17fd |
ComplexMaxPool1d | import torch
from torch import nn
import torch.utils
class ComplexMaxPool1d(nn.Module):
def __init__(self, kernel_size, stride=None, padding=0, dilation=1,
return_indices=False, ceil_mode=False):
super(ComplexMaxPool1d, self).__init__()
self.kernel_size = kernel_size
self.stride =... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils
assert_size_stride = torch._C._dynamo.guards.asse... | muqiaoy/dl_signal | ComplexMaxPool1d | false | 16,120 | [
"MIT"
] | 54 | 3a30d14982016644bfc96a7d1ca0109b441f17fd | https://github.com/muqiaoy/dl_signal/tree/3a30d14982016644bfc96a7d1ca0109b441f17fd |
LinearWithGroupNorm | import torch
import torch.utils.data
from torch import nn
from math import gcd
import torch.cuda
class LinearWithGroupNorm(nn.Module):
"""Linear layer with group normalization activation used in LaneGCN."""
def __init__(self, n_in: 'int', n_out: 'int', num_groups: 'int'=32,
activation: 'bool'=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._inductor.runtime.... | motional/nuplan-devkit | LinearWithGroupNorm | false | 16,121 | [
"Apache-2.0"
] | 128 | e39029e788b17f47f2fcadb774098ef8fbdd0d67 | https://github.com/motional/nuplan-devkit/tree/e39029e788b17f47f2fcadb774098ef8fbdd0d67 |
CRNNcell | import torch
import torch.nn as nn
class CRNNcell(nn.Module):
"""
Convolutional RNN cell that evolves over both time and iterations
Parameters
-----------------
input: 4d tensor, shape (batch_size, channel, width, height)
hidden: hidden states in temporal dimension, 4d tensor, shape (batch_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | myyaqubpython/https-github.com-cq615-Deep-MRI-Reconstruction | CRNNcell | false | 16,122 | [
"Apache-2.0"
] | 260 | 4484cff9f1e19ff9874c279c5c5d6cf2a317ddbf | https://github.com/myyaqubpython/https-github.com-cq615-Deep-MRI-Reconstruction/tree/4484cff9f1e19ff9874c279c5c5d6cf2a317ddbf |
ComplexLinear | import torch
from torch import nn
import torch.utils
class ComplexLinear(nn.Module):
def __init__(self, in_features, out_features):
super(ComplexLinear, self).__init__()
self.fc_r = nn.Linear(in_features, out_features)
self.fc_i = nn.Linear(in_features, out_features)
def forward(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils
assert_size_stride = torch._C._dynamo.gu... | muqiaoy/dl_signal | ComplexLinear | false | 16,123 | [
"MIT"
] | 54 | 3a30d14982016644bfc96a7d1ca0109b441f17fd | https://github.com/muqiaoy/dl_signal/tree/3a30d14982016644bfc96a7d1ca0109b441f17fd |
LovaszLoss | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from itertools import filterfalse
def jaccard(outputs, targets, per_image=False, non_empty=False, min_pixels=5):
batch_size = outputs.size()[0]
eps = 0.001
if not per_image:
batch_size = 1
dice_target = 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 numpy as np
from torch import nn
import torch.nn.functional as F
from itertools im... | kevinkwshin/kaggle-pneumothorax | LovaszLoss | false | 16,124 | [
"MIT"
] | 74 | 24b91a9425097023f0cc7781a9380cb247babe22 | https://github.com/kevinkwshin/kaggle-pneumothorax/tree/24b91a9425097023f0cc7781a9380cb247babe22 |
RZTXDecoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class RZTXDecoderLayer(nn.Module):
"""RZTXDecoderLayer is made up of self-attn and feedforward network with
residual weights for faster convergece.
This encoder layer is based on the paper "ReZero is All You Need:
Fast Convergence at L... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | mpariente/rezero | RZTXDecoderLayer | false | 16,125 | [
"MIT"
] | 376 | 6bcf1df00bc9a3560b093a2bbe12dade92f86eba | https://github.com/mpariente/rezero/tree/6bcf1df00bc9a3560b093a2bbe12dade92f86eba |
LearnableClsToken | import torch
import torch as th
from torch import nn
class LearnableClsToken(nn.Module):
"""
Layer that adds learnable CLS tokens to sequence input.
"""
def __init__(self, d_model: 'int'):
super().__init__()
cls_token = th.zeros(d_model)
self.cls_param = nn.Parameter(cls_token... | 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 as th
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | mzolfaghari/coot-videotext | LearnableClsToken | false | 16,126 | [
"Apache-2.0"
] | 213 | ee09c56c2600f56581167773d7f7dc5d036cc5e6 | https://github.com/mzolfaghari/coot-videotext/tree/ee09c56c2600f56581167773d7f7dc5d036cc5e6 |
RZTXEncoderLayer | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.modules.activation import MultiheadAttention
from torch.nn.modules.dropout import Dropout
from torch.nn.modules.linear import Linear
class RZTXEncoderLayer(Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mpariente/rezero | RZTXEncoderLayer | false | 16,127 | [
"MIT"
] | 376 | 6bcf1df00bc9a3560b093a2bbe12dade92f86eba | https://github.com/mpariente/rezero/tree/6bcf1df00bc9a3560b093a2bbe12dade92f86eba |
AddCoords | import torch
import torch.nn as nn
class AddCoords(nn.Module):
"""
Add Coords to a tensor
"""
def __init__(self, with_r=False):
super(AddCoords, self).__init__()
self.with_r = with_r
def forward(self, x):
"""
:param x: shape (batch, channel, x_dim, y_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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | nandbhat/dressing-in-order | AddCoords | false | 16,128 | [
"BSD-3-Clause"
] | 172 | 93ed967f588de9f3f80dcc40c51d5790569fbcab | https://github.com/nandbhat/dressing-in-order/tree/93ed967f588de9f3f80dcc40c51d5790569fbcab |
CoordConv | import torch
import torch.nn as nn
from torch.nn.utils.spectral_norm import spectral_norm as SpectralNorm
def spectral_norm(module, use_spect=True):
"""use spectral normal layer to stable the training process"""
if use_spect:
return SpectralNorm(module)
else:
return module
class AddCoord... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn.utils.spectral_norm import spectral_norm as ... | nandbhat/dressing-in-order | CoordConv | false | 16,129 | [
"BSD-3-Clause"
] | 172 | 93ed967f588de9f3f80dcc40c51d5790569fbcab | https://github.com/nandbhat/dressing-in-order/tree/93ed967f588de9f3f80dcc40c51d5790569fbcab |
SLN | import torch
import torch.nn as nn
class SLN(nn.Module):
"""
Self-modulated LayerNorm
"""
def __init__(self, num_features):
super(SLN, self).__init__()
self.ln = nn.LayerNorm(num_features)
self.gamma = nn.Parameter(torch.randn(1, 1, 1))
self.beta = nn.Parameter(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | nandkishore1/TransformersInVision | SLN | false | 16,130 | [
"MIT"
] | 94 | 134ef26b63916d2b9ae384124de7365a97102b06 | https://github.com/nandkishore1/TransformersInVision/tree/134ef26b63916d2b9ae384124de7365a97102b06 |
ToLongTensor | import torch
from torch import Tensor
from typing import List
import torch.nn as nn
class ToLongTensor(nn.Module):
"""Convert a list of integers to long tensor
"""
def __init__(self):
super(ToLongTensor, self).__init__()
def forward(self, tokens: 'List[List[int]]') ->Tensor:
return 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | nateanl/text | ToLongTensor | false | 16,131 | [
"BSD-3-Clause"
] | 3,172 | b26e9350ad387a84aefe131443bbbf1c51a8a618 | https://github.com/nateanl/text/tree/b26e9350ad387a84aefe131443bbbf1c51a8a618 |
BucketingEmbedding | import torch
import torch.nn as nn
class BucketingEmbedding(nn.Module):
def __init__(self, min_val, max_val, count, dim, use_log_scale=False):
super().__init__()
self.min_val = min_val
self.max_val = max_val
self.count = count
self.dim = dim
self.use_log_scale = us... | 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... | narekvslife/OccupancyAnticipation | BucketingEmbedding | false | 16,132 | [
"MIT"
] | 53 | 19b9f4d72b114339d07bd225a1c3feed73e982c2 | https://github.com/narekvslife/OccupancyAnticipation/tree/19b9f4d72b114339d07bd225a1c3feed73e982c2 |
conv_head_pooling | import torch
from torch import nn
class conv_head_pooling(nn.Module):
def __init__(self, in_feature, out_feature, stride, padding_mode='zeros'):
super(conv_head_pooling, self).__init__()
self.conv = nn.Conv2d(in_feature, out_feature, kernel_size=stride +
1, padding=stride // 2, stride... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | naver-ai/PfLayer | conv_head_pooling | false | 16,133 | [
"Apache-2.0"
] | 59 | da8f80b2ea3b6bd7fbee3beee8b1516c89bc0441 | https://github.com/naver-ai/PfLayer/tree/da8f80b2ea3b6bd7fbee3beee8b1516c89bc0441 |
Dec | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') != -1:
m.weight.data.norm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | naraysa/gzsl-od | Dec | false | 16,134 | [
"MIT"
] | 50 | be771e12e17a4c02386c70697c4b26e3170a7557 | https://github.com/naraysa/gzsl-od/tree/be771e12e17a4c02386c70697c4b26e3170a7557 |
MultiheadAttention | import torch
from torch import nn
import torch.utils
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from torch.nn import Parameter
class MultiheadAttention(nn.Module):
"""Multi-headed attention.
See "Attention Is All You Need" for more details.
"""
def __init__(self, embed_d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | muqiaoy/dl_signal | MultiheadAttention | false | 16,135 | [
"MIT"
] | 54 | 3a30d14982016644bfc96a7d1ca0109b441f17fd | https://github.com/muqiaoy/dl_signal/tree/3a30d14982016644bfc96a7d1ca0109b441f17fd |
AdaptiveFeatureNorm | import torch
import torch.nn as nn
import torch.utils.data
class AdaptiveFeatureNorm(nn.Module):
"""
The `Stepwise Adaptive Feature Norm loss (ICCV 2019) <https://arxiv.org/pdf/1811.07456v2.pdf>`_
Instead of using restrictive scalar R to match the corresponding feature norm, Stepwise Adaptive Feature Nor... | 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... | neka-nat/Transfer-Learning-Library | AdaptiveFeatureNorm | false | 16,136 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
BatchSpectralPenalizationLoss | import torch
import torch.nn as nn
import torch.utils.data
class BatchSpectralPenalizationLoss(nn.Module):
"""Batch spectral penalization loss from `Transferability vs. Discriminability: Batch
Spectral Penalization for Adversarial Domain Adaptation (ICML 2019)
<http://ise.thss.tsinghua.edu.cn/~mlong/doc/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
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | neka-nat/Transfer-Learning-Library | BatchSpectralPenalizationLoss | false | 16,137 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
conv_embedding | import torch
from torch import nn
class conv_embedding(nn.Module):
def __init__(self, in_channels, out_channels, patch_size, stride, padding):
super(conv_embedding, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=
patch_size, stride=stride, padding=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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | naver-ai/PfLayer | conv_embedding | false | 16,138 | [
"Apache-2.0"
] | 59 | da8f80b2ea3b6bd7fbee3beee8b1516c89bc0441 | https://github.com/naver-ai/PfLayer/tree/da8f80b2ea3b6bd7fbee3beee8b1516c89bc0441 |
MLP_G | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') != -1:
m.weight.data.norm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | naraysa/gzsl-od | MLP_G | false | 16,139 | [
"MIT"
] | 50 | be771e12e17a4c02386c70697c4b26e3170a7557 | https://github.com/naraysa/gzsl-od/tree/be771e12e17a4c02386c70697c4b26e3170a7557 |
PyramidPoolingModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class PyramidPoolingModule(nn.Module):
def __init__(self, pyramids=[1, 2, 3, 6]):
super(PyramidPoolingModule, self).__init__()
self.pyramids = pyramids
def forward(self, input):
feat = input
height, width = 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | nassir90/ICNet-pytorch | PyramidPoolingModule | false | 16,140 | [
"MIT"
] | 83 | af6eec01a4419ce43c52d295bc502c366478fbd7 | https://github.com/nassir90/ICNet-pytorch/tree/af6eec01a4419ce43c52d295bc502c366478fbd7 |
RobertaClassificationHead | import torch
import torch.nn as nn
from typing import Optional
class RobertaClassificationHead(nn.Module):
def __init__(self, num_classes, input_dim, inner_dim: 'Optional[int]'=
None, dropout: 'float'=0.1, activation=nn.ReLU):
super().__init__()
if not inner_dim:
inner_dim = 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.nn as nn
from ty... | nateanl/text | RobertaClassificationHead | false | 16,141 | [
"BSD-3-Clause"
] | 3,172 | b26e9350ad387a84aefe131443bbbf1c51a8a618 | https://github.com/nateanl/text/tree/b26e9350ad387a84aefe131443bbbf1c51a8a618 |
BatchSpectralShrinkage | import torch
import torch.nn as nn
import torch.utils.data
class BatchSpectralShrinkage(nn.Module):
"""
The regularization term in `Catastrophic Forgetting Meets Negative Transfer:
Batch Spectral Shrinkage for Safe Transfer Learning (NIPS 2019) <https://proceedings.neurips.cc/paper/2019/file/c6bff625bdb03... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | neka-nat/Transfer-Learning-Library | BatchSpectralShrinkage | false | 16,142 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
CIFAR10_Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class CIFAR10_Net(nn.Module):
def __init__(self):
super(CIFAR10_Net, self).__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=5)
self.conv2 = nn.Conv2d(32, 32, kernel_size=5)
self.conv3 = nn.Conv2d(32, 64, 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
import torch.nn as nn
assert_... | nannullna/deep-active-learning | CIFAR10_Net | false | 16,143 | [
"MIT"
] | 465 | c54a995640c63ba4679129c5a1fd5cec9a2858e6 | https://github.com/nannullna/deep-active-learning/tree/c54a995640c63ba4679129c5a1fd5cec9a2858e6 |
BridgeFeatLoss | import torch
import torch.nn as nn
import torch.utils.data
class BridgeFeatLoss(nn.Module):
def __init__(self):
super(BridgeFeatLoss, self).__init__()
def forward(self, f_s, f_t, f_mixed, lam):
dist_mixed2s = ((f_mixed - f_s) ** 2).sum(1, keepdim=True)
dist_mixed2t = ((f_mixed - f_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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | neka-nat/Transfer-Learning-Library | BridgeFeatLoss | false | 16,144 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
DirectedGraphConvolution | import torch
import torch.nn as nn
import torch.nn.functional as F
def normalize_adj(adj):
last_dim = adj.size(-1)
rowsum = adj.sum(2, keepdim=True).repeat(1, 1, last_dim)
return torch.div(adj, rowsum)
class DirectedGraphConvolution(nn.Module):
def __init__(self, in_features, out_features):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | naszilla/naszilla | DirectedGraphConvolution | false | 16,145 | [
"Apache-2.0"
] | 112 | 5575cc8c95e79ce5743e8ea7ef53d6da900f8480 | https://github.com/naszilla/naszilla/tree/5575cc8c95e79ce5743e8ea7ef53d6da900f8480 |
ShapedSineModel | import torch
import torch.utils.data
class ShapedSineModel(torch.nn.Module):
def __init__(self, theta=None):
super(ShapedSineModel, self).__init__()
if theta is None:
self.freq = torch.nn.Parameter(torch.Tensor([0.1]))
else:
self.freq = torch.nn.Parameter(torch.Ten... | 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.utils.data
assert_size_stride = torch._C._dynamo.guards.asse... | neha191091/LearningToLearn | ShapedSineModel | false | 16,146 | [
"MIT"
] | 76 | 3619d27bb3b7a836d9423dfbdd8da82460d4fa73 | https://github.com/neha191091/LearningToLearn/tree/3619d27bb3b7a836d9423dfbdd8da82460d4fa73 |
VanillaGenerativeAdversarialLoss | import torch
import torch.nn as nn
import torch.utils.data
class VanillaGenerativeAdversarialLoss(nn.Module):
"""
Loss for `Vanilla Generative Adversarial Network <https://arxiv.org/abs/1406.2661>`_
Args:
reduction (str, optional): Specifies the reduction to apply to the output:
``'none... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | neka-nat/Transfer-Learning-Library | VanillaGenerativeAdversarialLoss | false | 16,147 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
LeastSquaresGenerativeAdversarialLoss | import torch
import torch.nn as nn
import torch.utils.data
class LeastSquaresGenerativeAdversarialLoss(nn.Module):
"""
Loss for `Least Squares Generative Adversarial Network (LSGAN) <https://arxiv.org/abs/1611.04076>`_
Args:
reduction (str, optional): Specifies the reduction to apply to the outpu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | neka-nat/Transfer-Learning-Library | LeastSquaresGenerativeAdversarialLoss | false | 16,148 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
Theta | from torch.autograd import Function
import torch
import torch.nn as nn
from typing import Tuple
from typing import Optional
from typing import Any
import torch.utils.data
class GradientReverseFunction(Function):
@staticmethod
def forward(ctx: 'Any', input: 'torch.Tensor', coeff: 'Optional[float]'=1.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
from torch.autograd import Function
import torch.nn as nn
from typing import Tup... | neka-nat/Transfer-Learning-Library | Theta | false | 16,149 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
GaussianKernel | import torch
import torch.nn as nn
from typing import Optional
import torch.utils.data
class GaussianKernel(nn.Module):
"""Gaussian Kernel Matrix
Gaussian Kernel k is defined by
.. math::
k(x_1, x_2) = \\exp \\left( - \\dfrac{\\| x_1 - x_2 \\|^2}{2\\sigma^2} \\right)
where :math:`x_1, x_2 \... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | neka-nat/Transfer-Learning-Library | GaussianKernel | false | 16,150 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
DivLoss | import torch
import torch.nn as nn
import torch.utils.data
class DivLoss(nn.Module):
def __init__(self):
super(DivLoss, self).__init__()
def forward(self, lam):
mu = lam.mean(0)
std = ((lam - mu) ** 2).mean(0, keepdim=True).clamp(min=1e-12).sqrt()
loss_std = -std.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 libdevice
import torch.nn as nn
import... | neka-nat/Transfer-Learning-Library | DivLoss | false | 16,151 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
CorrelationAlignmentLoss | import torch
import torch.nn as nn
import torch.utils.data
class CorrelationAlignmentLoss(nn.Module):
"""The `Correlation Alignment Loss` in
`Deep CORAL: Correlation Alignment for Deep Domain Adaptation (ECCV 2016) <https://arxiv.org/pdf/1607.01719.pdf>`_.
Given source features :math:`f_S` and target fea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | neka-nat/Transfer-Learning-Library | CorrelationAlignmentLoss | false | 16,152 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
Accuracy | from torch.nn import Module
import torch
from torch import Tensor
class Accuracy(Module):
"""
Class for calculating the accuracy for a given prediction and the labels
for comparison.
Expects the inputs to be from a range of 0 to 1 and sets a crossing threshold at 0.5
the labels are similarly round... | 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
from torch import Tensor
assert_size_stride = torch._C._dynam... | neuralmagic/sparseml | Accuracy | false | 16,153 | [
"Apache-2.0"
] | 922 | 3fe5f4d75796eba43508401de4070cb494370683 | https://github.com/neuralmagic/sparseml/tree/3fe5f4d75796eba43508401de4070cb494370683 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, smooth=0, eps=1e-07):
super(DiceLoss, self).__init__()
self.smooth = smooth
self.eps = eps
def forward(self, output, target):
return 1 - (2 * torch.sum(output * target) + self.smooth) / (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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | neptune-ml/data-science-bowl-2018 | DiceLoss | false | 16,154 | [
"MIT"
] | 92 | 2f76f2fc9836e53ada16d1e084afa0108b119011 | https://github.com/neptune-ml/data-science-bowl-2018/tree/2f76f2fc9836e53ada16d1e084afa0108b119011 |
FocalLoss | import torch
import torch.nn as nn
import torch.optim
class FocalLoss(torch.nn.Module):
"""Sigmoid focal cross entropy loss.
Focal loss down-weights well classified examples and focusses on the hard
examples. See https://arxiv.org/pdf/1708.02002.pdf for the loss definition.
"""
def __init__(self, gamma... | 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... | neuralsyn/self-supervised-relational-reasoning | FocalLoss | false | 16,155 | [
"MIT"
] | 130 | 6ecfafcf4a36c2eacef7ddd5bd1b23c28fbb14c8 | https://github.com/neuralsyn/self-supervised-relational-reasoning/tree/6ecfafcf4a36c2eacef7ddd5bd1b23c28fbb14c8 |
StackTime | import torch
from torchvision.models.quantization import *
class StackTime(torch.nn.Module):
__constants__ = ['factor']
def __init__(self, factor):
super().__init__()
self.factor = int(factor)
def forward(self, x, x_lens):
r = torch.transpose(x, 0, 1)
s = r.shape
... | 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 torchvision.models.quantization import *
assert_size_stride = torch._C._dy... | mlperf/inference | StackTime | false | 16,156 | [
"Apache-2.0"
] | 388 | b284212941bcce7a558813c31ba2d356bac71885 | https://github.com/mlperf/inference/tree/b284212941bcce7a558813c31ba2d356bac71885 |
SVHN_Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class SVHN_Net(nn.Module):
def __init__(self):
super(SVHN_Net, self).__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=3)
self.conv2 = nn.Conv2d(32, 32, kernel_size=3)
self.conv3 = nn.Conv2d(32, 32, kernel_size=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | nannullna/deep-active-learning | SVHN_Net | false | 16,157 | [
"MIT"
] | 465 | c54a995640c63ba4679129c5a1fd5cec9a2858e6 | https://github.com/nannullna/deep-active-learning/tree/c54a995640c63ba4679129c5a1fd5cec9a2858e6 |
TripletLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms.functional as F
import torch.utils.data
def hard_examples_mining(dist_mat, identity_mat, return_idxes=False):
"""Select hard positives and hard negatives according to `In defense of the Triplet Loss for Person
Re-... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | neka-nat/Transfer-Learning-Library | TripletLoss | false | 16,158 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
MockOpticalFlowModel | import torch
import torch.nn as nn
class MockOpticalFlowModel(nn.Module):
def __init__(self, img_channels):
super().__init__()
self.model = nn.Conv2d(img_channels * 2, 2, kernel_size=1)
def forward(self, img1, img2):
x = torch.cat([img1, img2], dim=-3)
return self.model(x)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | neu-vig/ezflow | MockOpticalFlowModel | false | 16,159 | [
"MIT"
] | 94 | 1eb6f675e72b1de6db7b35d61ca4ef0082bae890 | https://github.com/neu-vig/ezflow/tree/1eb6f675e72b1de6db7b35d61ca4ef0082bae890 |
Softplus | import torch
import torch.onnx
import torch.nn as nn
class Softplus(nn.Module):
def forward(self, x):
return torch.nn.Softplus()(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.triton_helpers import libdevice, math as tl_math
import torch.onnx
import torch.nn as nn
assert_size_stride = t... | mil-tokyo/webdnn | Softplus | false | 16,160 | [
"MIT"
] | 1,967 | 38a60fd3e1a4e72bc01108189a3aa51e0752aecd | https://github.com/mil-tokyo/webdnn/tree/38a60fd3e1a4e72bc01108189a3aa51e0752aecd |
RepresentationSubspaceDistance | import torch
import torch.nn as nn
import torch.utils.data
class RepresentationSubspaceDistance(nn.Module):
"""
`Representation Subspace Distance (ICML 2021) <http://ise.thss.tsinghua.edu.cn/~mlong/doc/Representation-Subspace-Distance-for-Domain-Adaptation-Regression-icml21.pdf>`_
Args:
trade_off... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | neka-nat/Transfer-Learning-Library | RepresentationSubspaceDistance | false | 16,161 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
CMul | import torch
import torch.nn
import torch.nn as nn
import torch.nn.parallel
class CMul(nn.Module):
"""
nn.CMul in Torch7.
"""
def __init__(self):
super(CMul, self).__init__()
def forward(self, x):
return x[0] * x[1]
def __repr__(self):
return self.__class__.__name__
... | 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
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided... | nhonth/DeLF-pytorch | CMul | false | 16,162 | [
"MIT"
] | 315 | 5577a447a0330b9e976cff56a10fc91669216b8c | https://github.com/nhonth/DeLF-pytorch/tree/5577a447a0330b9e976cff56a10fc91669216b8c |
BesselBasis | import math
import torch
import torch.jit
import torch.nn.functional
from torch import nn
import torch.nn
import torch.utils.data
class BesselBasis(nn.Module):
r_max: 'float'
prefactor: 'float'
def __init__(self, r_max, num_basis=8, trainable=True):
"""Radial Bessel Basis, as proposed in DimeNet:... | 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 math
import torch.jit
import torch.nn.functional
from torch import... | mir-group/nequip | BesselBasis | false | 16,163 | [
"MIT"
] | 153 | 4e6a0914a289cf000da57a6b6e79678efdf3347f | https://github.com/mir-group/nequip/tree/4e6a0914a289cf000da57a6b6e79678efdf3347f |
PriorDiscriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class PriorDiscriminator(nn.Module):
"""The prior discriminator class.
This discriminate between a vector drawn from random uniform,
and the vector y obtained as output of the encoder.
It enforces y to be close to a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | neuralsyn/self-supervised-relational-reasoning | PriorDiscriminator | false | 16,164 | [
"MIT"
] | 130 | 6ecfafcf4a36c2eacef7ddd5bd1b23c28fbb14c8 | https://github.com/neuralsyn/self-supervised-relational-reasoning/tree/6ecfafcf4a36c2eacef7ddd5bd1b23c28fbb14c8 |
MaskedMSE | import torch
import torch.nn as nn
class MaskedMSE(nn.Module):
def __init__(self):
super(MaskedMSE, self).__init__()
self.criterion = nn.MSELoss()
def forward(self, input, target, mask):
self.loss = self.criterion(input, target * mask)
return self.loss
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ngerstle/soccerontable | MaskedMSE | false | 16,165 | [
"BSD-2-Clause"
] | 465 | 25426ff0f8fe0ce008b99c5c0fdbb35091d8d92c | https://github.com/ngerstle/soccerontable/tree/25426ff0f8fe0ce008b99c5c0fdbb35091d8d92c |
MaskedBCE | import torch
import torch.nn as nn
class MaskedBCE(nn.Module):
def __init__(self):
super(MaskedBCE, self).__init__()
self.criterion = nn.BCELoss()
def forward(self, input, target, mask):
self.loss = self.criterion(input, target * mask)
return self.loss
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ngerstle/soccerontable | MaskedBCE | false | 16,166 | [
"BSD-2-Clause"
] | 465 | 25426ff0f8fe0ce008b99c5c0fdbb35091d8d92c | https://github.com/ngerstle/soccerontable/tree/25426ff0f8fe0ce008b99c5c0fdbb35091d8d92c |
PSAModule | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
def conv(in_planes, out_planes, kernel_size=3, stride=1, padding=1,
dilation=1, groups=1):
"""standard convolution with padding"""
return nn.Conv2d(in_planes, out_plane... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | murufeng/EPSANet | PSAModule | false | 16,167 | [
"MIT"
] | 120 | 9955041a1db4591fae080d2e6edb25e2a2914d47 | https://github.com/murufeng/EPSANet/tree/9955041a1db4591fae080d2e6edb25e2a2914d47 |
TripletLossXBM | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms.functional as F
import torch.utils.data
def hard_examples_mining(dist_mat, identity_mat, return_idxes=False):
"""Select hard positives and hard negatives according to `In defense of the Triplet Loss for Person
Re-... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | neka-nat/Transfer-Learning-Library | TripletLossXBM | false | 16,168 | [
"MIT"
] | 1,474 | a3b27b0d7562fa90a02e914140b37ab438469e6c | https://github.com/neka-nat/Transfer-Learning-Library/tree/a3b27b0d7562fa90a02e914140b37ab438469e6c |
FeatExemplarAvgBlock | import torch
import torch.nn as nn
import torch.optim
import torch.nn.parallel
class FeatExemplarAvgBlock(nn.Module):
def __init__(self, nFeat):
super(FeatExemplarAvgBlock, self).__init__()
def forward(self, features_train, labels_train):
labels_train_transposed = labels_train.transpose(1, 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
import torch.nn as nn
import torch.optim
import torch.nn.parallel
assert_size_st... | nikran1/Few_shot | FeatExemplarAvgBlock | false | 16,169 | [
"MIT"
] | 497 | 5298c98e208411e44ee7767e6f4d457006d373cb | https://github.com/nikran1/Few_shot/tree/5298c98e208411e44ee7767e6f4d457006d373cb |
ResidualConnection | import torch
from torch import nn
class ResidualConnection(nn.Module):
def __init__(self, alpha=0.5):
super(ResidualConnection, self).__init__()
self.alpha = alpha
def forward(self, Xs: 'list'):
assert len(Xs) >= 1
return Xs[-1] if len(Xs) == 1 else (1 - self.alpha) * Xs[-1
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | ngohienduong/Deep_GCN_Benchmarking | ResidualConnection | false | 16,170 | [
"MIT"
] | 70 | 3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 | https://github.com/ngohienduong/Deep_GCN_Benchmarking/tree/3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 |
mean_norm | import torch
class mean_norm(torch.nn.Module):
def __init__(self):
super(mean_norm, self).__init__()
def forward(self, x):
col_mean = x.mean(dim=0)
x = x - col_mean
return 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ngohienduong/Deep_GCN_Benchmarking | mean_norm | false | 16,171 | [
"MIT"
] | 70 | 3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 | https://github.com/ngohienduong/Deep_GCN_Benchmarking/tree/3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 |
LocalDiscriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class LocalDiscriminator(nn.Module):
"""The local discriminator class.
A network that analyses the relation between the
output of the encoder y, and the feature map M.
It is called "local" because it compares y with... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | neuralsyn/self-supervised-relational-reasoning | LocalDiscriminator | false | 16,172 | [
"MIT"
] | 130 | 6ecfafcf4a36c2eacef7ddd5bd1b23c28fbb14c8 | https://github.com/neuralsyn/self-supervised-relational-reasoning/tree/6ecfafcf4a36c2eacef7ddd5bd1b23c28fbb14c8 |
LinearDiag | import torch
import torch.nn as nn
import torch.optim
import torch.nn.parallel
class LinearDiag(nn.Module):
def __init__(self, num_features, bias=False):
super(LinearDiag, self).__init__()
weight = torch.FloatTensor(num_features).fill_(1)
self.weight = nn.Parameter(weight, 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.optim
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_stri... | nikran1/Few_shot | LinearDiag | false | 16,173 | [
"MIT"
] | 497 | 5298c98e208411e44ee7767e6f4d457006d373cb | https://github.com/nikran1/Few_shot/tree/5298c98e208411e44ee7767e6f4d457006d373cb |
node_norm | import torch
class node_norm(torch.nn.Module):
def __init__(self, node_norm_type='n', unbiased=False, eps=1e-05,
power_root=2, **kwargs):
super(node_norm, self).__init__()
self.unbiased = unbiased
self.eps = eps
self.node_norm_type = node_norm_type
self.power = 1 /... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ngohienduong/Deep_GCN_Benchmarking | node_norm | false | 16,174 | [
"MIT"
] | 70 | 3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 | https://github.com/ngohienduong/Deep_GCN_Benchmarking/tree/3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 |
InitialConnection | import torch
from torch import nn
class InitialConnection(nn.Module):
def __init__(self, alpha=0.5):
super(InitialConnection, self).__init__()
self.alpha = alpha
def forward(self, Xs: 'list'):
assert len(Xs) >= 1
return Xs[-1] if len(Xs) == 1 else (1 - self.alpha) * Xs[-1
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | ngohienduong/Deep_GCN_Benchmarking | InitialConnection | false | 16,175 | [
"MIT"
] | 70 | 3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 | https://github.com/ngohienduong/Deep_GCN_Benchmarking/tree/3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 |
MaskedSmoothL1 | import torch
import torch.nn as nn
class MaskedSmoothL1(nn.Module):
def __init__(self):
super(MaskedSmoothL1, self).__init__()
self.criterion = nn.SmoothL1Loss(size_average=True)
def forward(self, input, target, mask):
self.loss = self.criterion(input, target * mask)
return 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ngerstle/soccerontable | MaskedSmoothL1 | false | 16,176 | [
"BSD-2-Clause"
] | 465 | 25426ff0f8fe0ce008b99c5c0fdbb35091d8d92c | https://github.com/ngerstle/soccerontable/tree/25426ff0f8fe0ce008b99c5c0fdbb35091d8d92c |
Unet | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False, norm=
'batch', residual=True, activation='leakyrelu', transpose=False):
super(ConvBlock, self).__init__()
self.dropout = dropout
self.residual = residual
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | mlepori1/noise2self | Unet | false | 16,177 | [
"MIT"
] | 257 | 78cbda2d0f62973f1ba0232bd48a941307cf78f9 | https://github.com/mlepori1/noise2self/tree/78cbda2d0f62973f1ba0232bd48a941307cf78f9 |
AconC | import torch
import torch.nn as nn
class AconC(nn.Module):
""" ACON activation (activate or not).
# AconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is a learnable parameter
# according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>.
"""
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | nmaac/acon | AconC | false | 16,178 | [
"MIT"
] | 163 | 99fd67928a6ffb0543b54614303caada96c756f5 | https://github.com/nmaac/acon/tree/99fd67928a6ffb0543b54614303caada96c756f5 |
Keypoint2DLoss | import torch
import torch.nn as nn
class Keypoint2DLoss(nn.Module):
def __init__(self, loss_type: 'str'='l1'):
"""
2D keypoint loss module.
Args:
loss_type (str): Choose between l1 and l2 losses.
"""
super(Keypoint2DLoss, self).__init__()
if loss_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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | nkolot/ProHMR | Keypoint2DLoss | false | 16,179 | [
"BSD-3-Clause"
] | 120 | dac2409c0b451b6dd5d91f03cbe7132aa495792f | https://github.com/nkolot/ProHMR/tree/dac2409c0b451b6dd5d91f03cbe7132aa495792f |
MatchingNetwork | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.optim
import torch.nn.functional as F
import torch.nn.parallel
class MatchingNetwork(nn.Module):
def __init__(self, opt):
super(MatchingNetwork, self).__init__()
scale_cls = opt['scale_cls'] if 'scale_cl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | nikran1/Few_shot | MatchingNetwork | false | 16,180 | [
"MIT"
] | 497 | 5298c98e208411e44ee7767e6f4d457006d373cb | https://github.com/nikran1/Few_shot/tree/5298c98e208411e44ee7767e6f4d457006d373cb |
NormalizeScaleController | import torch
class ScaleControllerBase(torch.nn.Module):
"""
The base class for ScaleController.
ScaleController is a callable class that re-scale input tensor's value.
Traditional scale method may include:
soft-max, L2 normalize, relu and so on.
Advanced method:
Learnable scale pa... | 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... | niloofar17/MetaDialog | NormalizeScaleController | false | 16,181 | [
"Apache-2.0"
] | 204 | d75b84a02807d53d9596e72c2f698e5a4f180369 | https://github.com/niloofar17/MetaDialog/tree/d75b84a02807d53d9596e72c2f698e5a4f180369 |
ParameterLoss | import torch
import torch.nn as nn
class ParameterLoss(nn.Module):
def __init__(self):
"""
SMPL parameter loss module.
"""
super(ParameterLoss, self).__init__()
self.loss_fn = nn.MSELoss(reduction='none')
def forward(self, pred_param: 'torch.Tensor', gt_param: '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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | nkolot/ProHMR | ParameterLoss | false | 16,182 | [
"BSD-3-Clause"
] | 120 | dac2409c0b451b6dd5d91f03cbe7132aa495792f | https://github.com/nkolot/ProHMR/tree/dac2409c0b451b6dd5d91f03cbe7132aa495792f |
Keypoint3DLoss | import torch
import torch.nn as nn
class Keypoint3DLoss(nn.Module):
def __init__(self, loss_type: 'str'='l1'):
"""
3D keypoint loss module.
Args:
loss_type (str): Choose between l1 and l2 losses.
"""
super(Keypoint3DLoss, self).__init__()
if loss_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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | nkolot/ProHMR | Keypoint3DLoss | false | 16,183 | [
"BSD-3-Clause"
] | 120 | dac2409c0b451b6dd5d91f03cbe7132aa495792f | https://github.com/nkolot/ProHMR/tree/dac2409c0b451b6dd5d91f03cbe7132aa495792f |
pair_norm | import torch
class pair_norm(torch.nn.Module):
def __init__(self):
super(pair_norm, self).__init__()
def forward(self, x):
col_mean = x.mean(dim=0)
x = x - col_mean
rownorm_mean = (1e-06 + x.pow(2).sum(dim=1).mean()).sqrt()
x = x / rownorm_mean
return x
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ngohienduong/Deep_GCN_Benchmarking | pair_norm | false | 16,184 | [
"MIT"
] | 70 | 3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 | https://github.com/ngohienduong/Deep_GCN_Benchmarking/tree/3ee57a265bbfd62d8e6f3ee6e3e9062dd5a44633 |
PrototypicalNetwork | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.optim
import torch.nn.parallel
def L2SquareDist(A, B, average=True):
assert A.dim() == 3
assert B.dim() == 3
assert A.size(0) == B.size(0) and A.size(2) == B.size(2)
nB = A.size(0)
Na = A.size(1)
Nb =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.parallel
assert_size_st... | nikran1/Few_shot | PrototypicalNetwork | false | 16,185 | [
"MIT"
] | 497 | 5298c98e208411e44ee7767e6f4d457006d373cb | https://github.com/nikran1/Few_shot/tree/5298c98e208411e44ee7767e6f4d457006d373cb |
FixedScaleController | import torch
class ScaleControllerBase(torch.nn.Module):
"""
The base class for ScaleController.
ScaleController is a callable class that re-scale input tensor's value.
Traditional scale method may include:
soft-max, L2 normalize, relu and so on.
Advanced method:
Learnable scale pa... | 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... | niloofar17/MetaDialog | FixedScaleController | false | 16,186 | [
"Apache-2.0"
] | 204 | d75b84a02807d53d9596e72c2f698e5a4f180369 | https://github.com/niloofar17/MetaDialog/tree/d75b84a02807d53d9596e72c2f698e5a4f180369 |
UpsampleNet | import torch
import numpy as np
import torch.nn as nn
class SqueezeLayer(nn.Module):
def __init__(self, factor):
super(SqueezeLayer, self).__init__()
self.factor = factor
def forward(self, input, logdet=None, reverse=False, **kwargs):
if not reverse:
assert input.size(-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 numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | npuichigo/waveglow | UpsampleNet | false | 16,187 | [
"Apache-2.0"
] | 214 | 44e5cae59842ddb5f692085472b5e09fa18cce42 | https://github.com/npuichigo/waveglow/tree/44e5cae59842ddb5f692085472b5e09fa18cce42 |
encoder_block | import torch
import torch.nn as nn
class encoder_block(nn.Module):
def __init__(self, input_feature, output_feature, use_dropout):
super(encoder_block, self).__init__()
self.conv_input = nn.Conv3d(input_feature, output_feature, 3, 1, 1, 1)
self.conv_inblock1 = nn.Conv3d(output_feature, ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ninamiolane/quicksilver | encoder_block | false | 16,188 | [
"Apache-2.0"
] | 126 | 1baf251360dadea0afa3daaa09942d9d2d7c71fb | https://github.com/ninamiolane/quicksilver/tree/1baf251360dadea0afa3daaa09942d9d2d7c71fb |
MultiHeadAttention | import torch
import numpy as np
import torch.nn as nn
import torch.distributions
class MultiHeadAttention(nn.Module):
def __init__(self, d_model, n_heads, kq_same=False, bias=True):
super().__init__()
"""
It has projection layer for getting keys, queries and values. Followed by attention.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | nmrenyi/ReChorus | MultiHeadAttention | false | 16,189 | [
"MIT"
] | 314 | 9ab632579d0464b0aaf365539f87b04866920b66 | https://github.com/nmrenyi/ReChorus/tree/9ab632579d0464b0aaf365539f87b04866920b66 |
ViTStemPatchify | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn as nn
def patchify2d(w_in, w_out, k, *, bias=True):
"""Helper for building a patchify layer as used by ViT models."""
return nn.Conv2d(w_in, w_out, k, stride=k, padding=0, bias=bias)
def patchify2d_cx(cx, w_in, w_out, k, *, 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.nn import Module
import torch.utils.data
import torch.nn as nn
assert... | om00839/pycls | ViTStemPatchify | false | 16,190 | [
"MIT"
] | 1,975 | 8c79a8e2adfffa7cae3a88aace28ef45e52aa7e5 | https://github.com/om00839/pycls/tree/8c79a8e2adfffa7cae3a88aace28ef45e52aa7e5 |
GAT | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class GraphAttention(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttention, 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.... | new2scala/graph-cnn.pytorch | GAT | false | 16,191 | [
"MIT"
] | 330 | 8bee0c2ed687dcfdb277c71b70c8ea747b6ca9c7 | https://github.com/new2scala/graph-cnn.pytorch/tree/8bee0c2ed687dcfdb277c71b70c8ea747b6ca9c7 |
SpatialAttention2d | import torch
import torch.nn
import torch.nn as nn
import torch.nn.parallel
class SpatialAttention2d(nn.Module):
"""
SpatialAttention2d
2-layer 1x1 conv network with softplus activation.
<!!!> attention score normalization will be added for experiment.
"""
def __init__(self, in_c, act_fn='rel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | nhonth/DeLF-pytorch | SpatialAttention2d | false | 16,192 | [
"MIT"
] | 315 | 5577a447a0330b9e976cff56a10fc91669216b8c | https://github.com/nhonth/DeLF-pytorch/tree/5577a447a0330b9e976cff56a10fc91669216b8c |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, state_dim, action_dim):
super(Discriminator, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, 1)
def forward(self, sta... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | nikhilbarhate99/Deterministic-GAIL-PyTorch | Discriminator | false | 16,193 | [
"MIT"
] | 64 | 36843739dd7b0ca58e9fcaf923cc6735a5d7ffef | https://github.com/nikhilbarhate99/Deterministic-GAIL-PyTorch/tree/36843739dd7b0ca58e9fcaf923cc6735a5d7ffef |
MLP | import torch
from torch import nn
import torch.nn.functional as F
from torch.utils.data import *
class MLP(nn.Module):
def __init__(self):
super(MLP, self).__init__()
self.fc1 = nn.Linear(784, 512)
self.fc2 = nn.Linear(512, 128)
self.fc3 = nn.Linear(128, 10)
def forward(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.... | nox-410/nnfusion | MLP | false | 16,194 | [
"MIT"
] | 639 | 0777e297299c4e7a5071dc2ee97b87adcd22840e | https://github.com/nox-410/nnfusion/tree/0777e297299c4e7a5071dc2ee97b87adcd22840e |
TrTimeInvFIRFilter | import torch
from torch import nn
from torch.nn import functional as F
class TrTimeInvFIRFilter(nn.Conv1d):
"""Trainable Time-invatiant FIR filter implementation
H(z) = \\sigma_{k=0}^{filt_dim} b_{k}z_{-k}
Note that b_{0} is fixed to 1 if fixed_0th is True.
Args:
channels (int): input chann... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | oatsu-gh/nnsvs | TrTimeInvFIRFilter | false | 16,195 | [
"MIT"
] | 298 | 510f37bc1d1f15282646e4d34435b5d63686cf40 | https://github.com/oatsu-gh/nnsvs/tree/510f37bc1d1f15282646e4d34435b5d63686cf40 |
SoftmaxScaleController | import torch
class ScaleControllerBase(torch.nn.Module):
"""
The base class for ScaleController.
ScaleController is a callable class that re-scale input tensor's value.
Traditional scale method may include:
soft-max, L2 normalize, relu and so on.
Advanced method:
Learnable scale pa... | 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... | niloofar17/MetaDialog | SoftmaxScaleController | false | 16,196 | [
"Apache-2.0"
] | 204 | d75b84a02807d53d9596e72c2f698e5a4f180369 | https://github.com/niloofar17/MetaDialog/tree/d75b84a02807d53d9596e72c2f698e5a4f180369 |
TimeIntervalMultiHeadAttention | import torch
import numpy as np
import torch.nn as nn
import torch.distributions
class TimeIntervalMultiHeadAttention(nn.Module):
def __init__(self, d_model, n_heads, kq_same=False, bias=True):
super().__init__()
"""
It also needs position and interaction (time interval) key/value input.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | nmrenyi/ReChorus | TimeIntervalMultiHeadAttention | false | 16,197 | [
"MIT"
] | 314 | 9ab632579d0464b0aaf365539f87b04866920b66 | https://github.com/nmrenyi/ReChorus/tree/9ab632579d0464b0aaf365539f87b04866920b66 |
MaxPooling | import torch
import torch.utils.data
import torch.nn as nn
import torch as torch
class MaxPooling(nn.Module):
def __init__(self):
super(MaxPooling, self).__init__()
def forward(self, input):
_b, _c, h, _w = input.size()
f_pool = nn.MaxPool2d((h, 1), (1, 1))
conv = f_pool(inpu... | 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
import torch as torch
assert_size_stride = ... | olivernina/nephi | MaxPooling | false | 16,198 | [
"MIT"
] | 50 | a25e74e58c24edb7dc051b79d106b3bc51c7a998 | https://github.com/olivernina/nephi/tree/a25e74e58c24edb7dc051b79d106b3bc51c7a998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.