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 |
|---|---|---|---|---|---|---|---|---|---|---|
ScaledDotProductAttentionMemory | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, d_model, d_k, d_v, h, m):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionali... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jianqingxie/RSTNet | ScaledDotProductAttentionMemory | false | 15,692 | [
"BSD-3-Clause"
] | 68 | aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be | https://github.com/jianqingxie/RSTNet/tree/aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be |
ScaledDotProductGeometryAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductGeometryAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1, comment=None):
"""
:param d_model: Output dimensionality of the model
:param d_k... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jianqingxie/RSTNet | ScaledDotProductGeometryAttention | false | 15,693 | [
"BSD-3-Clause"
] | 68 | aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be | https://github.com/jianqingxie/RSTNet/tree/aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be |
NTN | import torch
import torch.nn as nn
import torch.nn.functional as F
class NTN(nn.Module):
def __init__(self, l_dim, r_dim, k=4, non_linear=F.tanh):
super(NTN, self).__init__()
self.u_R = nn.Linear(k, 1, bias=False)
self.f = non_linear
self.W = nn.Bilinear(l_dim, r_dim, k, bias=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.triton_helpers import libdevice
import torch.nn as ... | jinfenglin/TaxoExpan | NTN | false | 15,694 | [
"Apache-2.0"
] | 55 | 86bd3f805508d03367539f2fdd43889fc0a4f6b2 | https://github.com/jinfenglin/TaxoExpan/tree/86bd3f805508d03367539f2fdd43889fc0a4f6b2 |
ELU | import torch
import torch.nn as nn
class ActivationFunction(nn.Module):
def __init__(self):
super().__init__()
self.name = self.__class__.__name__
self.config = {'name': self.name}
class ELU(ActivationFunction):
def forward(self, x):
return torch.where(x > 0, x, torch.exp(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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | jiwidi/lightning-tutorials | ELU | false | 15,695 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
LeakyReLU | import torch
import torch.nn as nn
class ActivationFunction(nn.Module):
def __init__(self):
super().__init__()
self.name = self.__class__.__name__
self.config = {'name': self.name}
class LeakyReLU(ActivationFunction):
def __init__(self, alpha=0.1):
super().__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | jiwidi/lightning-tutorials | LeakyReLU | false | 15,696 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
ConcatELU | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConcatELU(nn.Module):
"""Activation function that applies ELU in both direction (inverted and plain).
Allows non-linearity while providing strong gradients for any input (important for final convolution)
"""
def forward(self, x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | jiwidi/lightning-tutorials | ConcatELU | false | 15,697 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
ReLU | import torch
import torch.nn as nn
class ActivationFunction(nn.Module):
def __init__(self):
super().__init__()
self.name = self.__class__.__name__
self.config = {'name': self.name}
class ReLU(ActivationFunction):
def forward(self, x):
return x * (x > 0).float()
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | jiwidi/lightning-tutorials | ReLU | false | 15,698 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
MultiHeadGeometryAttention | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductGeometryAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1, comment=None):
"""
:param d_model: Output dimensionality 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jianqingxie/RSTNet | MultiHeadGeometryAttention | false | 15,699 | [
"BSD-3-Clause"
] | 68 | aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be | https://github.com/jianqingxie/RSTNet/tree/aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be |
Sigmoid | import torch
import torch.nn as nn
class ActivationFunction(nn.Module):
def __init__(self):
super().__init__()
self.name = self.__class__.__name__
self.config = {'name': self.name}
class Sigmoid(ActivationFunction):
def forward(self, x):
return 1 / (1 + torch.exp(-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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | jiwidi/lightning-tutorials | Sigmoid | false | 15,700 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
DisparityConv | import torch
import torch.nn as nn
class DisparityConv(nn.Module):
def __init__(self, max_shift, output_nc):
super().__init__()
self.max_shift = int(max_shift)
self.conv = nn.Conv2d(self.max_shift, output_nc, kernel_size=3,
stride=1, padding=1, bias=True)
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.triton_helpers import math as tl_math
import torch.... | jiupinjia/neural-magic-eye | DisparityConv | false | 15,701 | [
"MIT"
] | 59 | ded1cd4fc2194fe031f76bc3a2c307e761f70d85 | https://github.com/jiupinjia/neural-magic-eye/tree/ded1cd4fc2194fe031f76bc3a2c307e761f70d85 |
DotRole | from _paritybench_helpers import _mock_config
import torch
import torch as th
import torch.nn as nn
class DotRole(nn.Module):
def __init__(self, args):
super(DotRole, self).__init__()
self.args = args
self.n_actions = args.n_actions
self.q_fc = nn.Linear(args.rnn_hidden_dim, args.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch as th
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | jk96491/SMAC | DotRole | false | 15,702 | [
"Apache-2.0"
] | 64 | 7aaf4673b0eecafc4ab25f381eea20fc762af56a | https://github.com/jk96491/SMAC/tree/7aaf4673b0eecafc4ab25f381eea20fc762af56a |
GCNLayer | import torch
import torch.nn as nn
class GCNLayer(nn.Module):
def __init__(self, c_in, c_out):
super().__init__()
self.projection = nn.Linear(c_in, c_out)
def forward(self, node_feats, adj_matrix):
"""
Args:
node_feats: Tensor with node features of 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jiwidi/lightning-tutorials | GCNLayer | false | 15,703 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
BarlowTwinsLoss | import torch
import torch.nn as nn
class BarlowTwinsLoss(nn.Module):
def __init__(self, batch_size, lambda_coeff=0.005, z_dim=128):
super().__init__()
self.z_dim = z_dim
self.batch_size = batch_size
self.lambda_coeff = lambda_coeff
def off_diagonal_ele(self, x):
n, m ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | jiwidi/lightning-tutorials | BarlowTwinsLoss | false | 15,704 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
Conv2dLayer | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
def cal_width_dim_2d(input_dim, kernel_size, stride, padding=1):
return math.floor((input_dim + 2 * padding - kernel_size) / stride + 1)
class Conv2dLayer(nn.Module):
def __init__(self, input_size, in_channel, out_channel, kerne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.nn a... | jiyanglii/OpenTransformer | Conv2dLayer | false | 15,705 | [
"MIT"
] | 321 | f37cc8cbbc96ddb67082dd2962d09303551010c8 | https://github.com/jiyanglii/OpenTransformer/tree/f37cc8cbbc96ddb67082dd2962d09303551010c8 |
TransformerEncoderLayer | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
"""Multi-Head Attention module."""
def __init__(self, n_head=8, d_model=512, d_k=64, d_v=64, dropout=0.1,
qkv_bias=False, mask_value=0):
super().__init__()
self.mask_value = mask_value
self.n_head = n_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jeffreykuang/mmocr-1 | TransformerEncoderLayer | false | 15,706 | [
"Apache-2.0"
] | 206 | b17304edeb493b0a4d7224c23d23b952350d0db5 | https://github.com/jeffreykuang/mmocr-1/tree/b17304edeb493b0a4d7224c23d23b952350d0db5 |
Tanh | import torch
import torch.nn as nn
class ActivationFunction(nn.Module):
def __init__(self):
super().__init__()
self.name = self.__class__.__name__
self.config = {'name': self.name}
class Tanh(ActivationFunction):
def forward(self, x):
x_exp, neg_x_exp = torch.exp(x), 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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | jiwidi/lightning-tutorials | Tanh | false | 15,707 | [
"Apache-2.0"
] | 114 | 70ba437447f345d4d6ba089d5b30fd1da2cbc04b | https://github.com/jiwidi/lightning-tutorials/tree/70ba437447f345d4d6ba089d5b30fd1da2cbc04b |
PrimaryCapsules | import torch
import torch.nn as nn
def squash(s, dim=-1):
"""
"Squashing" non-linearity that shrunks short vectors to almost zero length and long vectors to a length slightly below 1
Eq. (1): v_j = ||s_j||^2 / (1 + ||s_j||^2) * s_j / ||s_j||
Args:
s: Vector before activation
dim: Dimension along which t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | jjcao/capsule-network | PrimaryCapsules | false | 15,708 | [
"MIT"
] | 171 | 0c2d9976b25d64720a90d3db71e5869d2592ab71 | https://github.com/jjcao/capsule-network/tree/0c2d9976b25d64720a90d3db71e5869d2592ab71 |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1, comment=None):
"""
:param d_model: Output dimensionality of the mode... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jianqingxie/RSTNet | MultiHeadAttention | false | 15,709 | [
"BSD-3-Clause"
] | 68 | aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be | https://github.com/jianqingxie/RSTNet/tree/aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be |
MLP | import torch
import torch.nn.functional as F
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
n_hid = 20
n_out = 10
self.l1 = nn.Linear(28 * 28, n_hid)
self.l2 = nn.Linear(n_hid, n_hid)
self.l3 = nn.Linear(n_hid, n_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jjxu217/pytorch-sso | MLP | false | 15,710 | [
"MIT"
] | 121 | 124954a5588120885e2f017c99db7fc540d5b9ab | https://github.com/jjxu217/pytorch-sso/tree/124954a5588120885e2f017c99db7fc540d5b9ab |
CapsuleLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class MarginLoss(nn.Module):
def __init__(self, size_average=False, loss_lambda=0.5):
"""
Margin loss for digit existence
Eq. (4): L_k = T_k * max(0, m+ - ||v_k||)^2 + lambda * (1 - T_k) * max(0, ||v_k|| - m-)^2
Args:
size_ave... | 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.nn.functional as F
assert_size_stride = torch._C._dyna... | jjcao/capsule-network | CapsuleLoss | false | 15,711 | [
"MIT"
] | 171 | 0c2d9976b25d64720a90d3db71e5869d2592ab71 | https://github.com/jjcao/capsule-network/tree/0c2d9976b25d64720a90d3db71e5869d2592ab71 |
DotSelector | from _paritybench_helpers import _mock_config
import torch
import torch as th
from torch.distributions import Categorical
import torch.nn as nn
import torch.nn.functional as F
class DotSelector(nn.Module):
def __init__(self, input_shape, args):
super(DotSelector, self).__init__()
self.args = args... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch as th
from torch... | jk96491/SMAC | DotSelector | false | 15,713 | [
"Apache-2.0"
] | 64 | 7aaf4673b0eecafc4ab25f381eea20fc762af56a | https://github.com/jk96491/SMAC/tree/7aaf4673b0eecafc4ab25f381eea20fc762af56a |
ConvRelu | import torch
import torch.utils.data
import torch.nn as nn
import torch.optim
import torch.backends.cudnn
import torch.onnx
import torch.autograd
class ConvRelu(nn.Module):
"""3x3 convolution followed by ReLU activation building block."""
def __init__(self, num_in, num_out):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | jmargutt/automated-building-detection | ConvRelu | false | 15,714 | [
"MIT"
] | 48 | e1668a470b94252040f27d26098826c293fbb46d | https://github.com/jmargutt/automated-building-detection/tree/e1668a470b94252040f27d26098826c293fbb46d |
ResBlockDiscriminator | import torch
import numpy as np
from torch import nn
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class SpectralNorm(nn.Module):
def __init__(self, module, name='weight', power_iterations=1):
super(SpectralNorm, self).__init__()
self.module = mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jingyang2017/Face-and-Image-super-resolution | ResBlockDiscriminator | false | 15,715 | [
"MIT"
] | 215 | 0351b5f7c71013f022a972306afd036f1af3a8e6 | https://github.com/jingyang2017/Face-and-Image-super-resolution/tree/0351b5f7c71013f022a972306afd036f1af3a8e6 |
wide_basic | import torch
import torch.nn as nn
def get_norm(n_filters, norm):
if norm is None:
return Identity()
elif norm == 'batch':
return nn.BatchNorm2d(n_filters, momentum=0.9)
elif norm == 'instance':
return nn.InstanceNorm2d(n_filters, affine=True)
elif norm == 'layer':
retu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | jliu/HDGE | wide_basic | false | 15,716 | [
"Apache-2.0"
] | 69 | 1615d04d55ec038590fc7f18810344a8257edaa0 | https://github.com/jliu/HDGE/tree/1615d04d55ec038590fc7f18810344a8257edaa0 |
ScaleDotProductAttention | import math
import torch
import torch.nn as nn
class ScaleDotProductAttention(nn.Module):
"""
compute scale dot product attention
Query : given sentence that we focused on (decoder)
Key : every sentence to check relationship with Qeury(encoder)
Value : every sentence same with Key (encoder)
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jkimbf/transformer-1 | ScaleDotProductAttention | false | 15,717 | [
"Apache-2.0"
] | 233 | 6cd29731197822d6db641cdbfad3b045b8a294e4 | https://github.com/jkimbf/transformer-1/tree/6cd29731197822d6db641cdbfad3b045b8a294e4 |
DecoderBlock | import torch
import torch.utils.data
import torch.nn as nn
import torch.optim
import torch.backends.cudnn
import torch.onnx
import torch.autograd
class ConvRelu(nn.Module):
"""3x3 convolution followed by ReLU activation building block."""
def __init__(self, num_in, num_out):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | jmargutt/automated-building-detection | DecoderBlock | false | 15,718 | [
"MIT"
] | 48 | e1668a470b94252040f27d26098826c293fbb46d | https://github.com/jmargutt/automated-building-detection/tree/e1668a470b94252040f27d26098826c293fbb46d |
MultiHeadAttention | import math
import torch
import torch.nn as nn
class ScaleDotProductAttention(nn.Module):
"""
compute scale dot product attention
Query : given sentence that we focused on (decoder)
Key : every sentence to check relationship with Qeury(encoder)
Value : every sentence same with Key (encoder)
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jkimbf/transformer-1 | MultiHeadAttention | false | 15,719 | [
"Apache-2.0"
] | 233 | 6cd29731197822d6db641cdbfad3b045b8a294e4 | https://github.com/jkimbf/transformer-1/tree/6cd29731197822d6db641cdbfad3b045b8a294e4 |
EncoderSteenkiste | import torch
from torch import nn
class EncoderSteenkiste(nn.Module):
def __init__(self, signal_size, latent_dim=10):
"""
Parameters
----------
signal_size : int for length of signal. Defaults to 30
latent_dim : int
Dimensionality of latent output.
Mo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | jnsrch/disentangling-vae-cwt | EncoderSteenkiste | false | 15,720 | [
"MIT"
] | 581 | 0e927bdcd3d149cadb30aa107331f0c071138c41 | https://github.com/jnsrch/disentangling-vae-cwt/tree/0e927bdcd3d149cadb30aa107331f0c071138c41 |
ConvNet | import torch
import torch.nn as nn
class ConvNet(nn.Module):
"""
A network with a single convolution layer. This is used for testing flop
count for convolution layers.
"""
def __init__(self, conv_dim: 'int', input_dim: 'int', output_dim: 'int',
kernel_size: 'int', spatial_dim: 'int', 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | johnanthonyjose/fvcore | ConvNet | false | 15,721 | [
"Apache-2.0"
] | 1,137 | af30fd4028553c1d1e4e5d389f309f52e046e67d | https://github.com/johnanthonyjose/fvcore/tree/af30fd4028553c1d1e4e5d389f309f52e046e67d |
ThreeNet | import torch
import torch.nn as nn
class ThreeNet(nn.Module):
"""
A network with three layers. This is used for testing a network with more
than one operation. The network has a convolution layer followed by two
fully connected layers.
"""
def __init__(self, input_dim: 'int', conv_dim: 'int',... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | johnanthonyjose/fvcore | ThreeNet | false | 15,722 | [
"Apache-2.0"
] | 1,137 | af30fd4028553c1d1e4e5d389f309f52e046e67d | https://github.com/johnanthonyjose/fvcore/tree/af30fd4028553c1d1e4e5d389f309f52e046e67d |
NestedNetInnerModule | import torch
import torch.nn as nn
from typing import Counter
from collections import Counter
class NestedNetInnerModule(nn.Module):
"""
A submodule for the nested net test module below.
"""
def __init__(self, lin_op: 'str'='addmm') ->None:
super().__init__()
conv_input_size = 2, 5
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from typing import Counter
from collections import Counter... | johnanthonyjose/fvcore | NestedNetInnerModule | false | 15,723 | [
"Apache-2.0"
] | 1,137 | af30fd4028553c1d1e4e5d389f309f52e046e67d | https://github.com/johnanthonyjose/fvcore/tree/af30fd4028553c1d1e4e5d389f309f52e046e67d |
MemoryMoCo | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class MemoryMoCo(nn.Module):
"""Fixed-size queue with momentum encoder"""
def __init__(self, feature_dim, queue_size, temperature=0.07, thresh=0):
sup... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.parallel
import torch.optim
im... | john-mlr/CLD-UnsupervisedLearning | MemoryMoCo | false | 15,724 | [
"MIT"
] | 70 | e0cf57dd62ffdcb702d6006278899d20f1d813d6 | https://github.com/john-mlr/CLD-UnsupervisedLearning/tree/e0cf57dd62ffdcb702d6006278899d20f1d813d6 |
SmallConvNet | import torch
from typing import Tuple
import torch.nn as nn
from numpy import prod
class SmallConvNet(nn.Module):
"""
A network with three conv layers. This is used for testing convolution
layers for activation count.
"""
def __init__(self, input_dim: 'int') ->None:
super(SmallConvNet, 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 typing import Tuple
import torch.nn as nn
from numpy import prod
assert_siz... | johnanthonyjose/fvcore | SmallConvNet | false | 15,725 | [
"Apache-2.0"
] | 1,137 | af30fd4028553c1d1e4e5d389f309f52e046e67d | https://github.com/johnanthonyjose/fvcore/tree/af30fd4028553c1d1e4e5d389f309f52e046e67d |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLayer, 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 import triton_helpers
from torch._inductor.runtime.... | jk96491/SMAC | GAT | false | 15,726 | [
"Apache-2.0"
] | 64 | 7aaf4673b0eecafc4ab25f381eea20fc762af56a | https://github.com/jk96491/SMAC/tree/7aaf4673b0eecafc4ab25f381eea20fc762af56a |
AgentConvBlock | import torch
import torch.nn as nn
class AgentConvBlock(nn.Module):
def __init__(self, nin, nout, ksize=3):
super(AgentConvBlock, self).__init__()
self.conv1 = nn.Conv2d(nin, nout, ksize, padding=1)
self.lrelu1 = nn.LeakyReLU(0.2)
self.conv2 = nn.Conv2d(nout, nout, ksize, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jonhare/DifferentiableSketching | AgentConvBlock | false | 15,727 | [
"BSD-3-Clause"
] | 100 | 462551ea2c8d07125352080b0c74e39c7fcbd49e | https://github.com/jonhare/DifferentiableSketching/tree/462551ea2c8d07125352080b0c74e39c7fcbd49e |
Quantize | import torch
from torch import nn
from torch.nn import functional as F
class Quantize(nn.Module):
"""
Discretization bottleneck part of the VQ-VAE.
Inputs:
- n_e : number of embeddings
- e_dim : dimension of embedding
- beta : commitment cost used in loss term, beta * ||z_e(x)-sg[e]||^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 import nn
from torch.nn import functional as F
assert_size_stride = t... | jkulhanek/viewformer | Quantize | false | 15,728 | [
"MIT"
] | 87 | 9ad2c5a2f7abe4b7ff490ced0132bf3d2f07e29c | https://github.com/jkulhanek/viewformer/tree/9ad2c5a2f7abe4b7ff490ced0132bf3d2f07e29c |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, state_size, action_size, action_parameter_size,
hidden_layers=None, init_std=0.01, init_type='normal', activation=
'leaky_relu', squashing_function=False):
super(Actor, self).__in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jordiriu/MP-DQN | Actor | false | 15,729 | [
"MIT"
] | 75 | eec13eb9b4e2c0099649e0639f2a8b93d7d0d5be | https://github.com/jordiriu/MP-DQN/tree/eec13eb9b4e2c0099649e0639f2a8b93d7d0d5be |
SpatialAttn | import torch
from torch import nn
class SpatialAttn(nn.Module):
"""Spatial Attention Layer"""
def __init__(self):
super(SpatialAttn, self).__init__()
def forward(self, x):
x = x.mean(1, keepdim=True)
h = x.size(2)
w = x.size(3)
x = x.view(x.size(0), -1)
z ... | 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... | johnzhang1999/Spatial-Attention | SpatialAttn | false | 15,730 | [
"MIT"
] | 228 | 9e8e90ba624e52dcccba47c7289bb305765f5da6 | https://github.com/johnzhang1999/Spatial-Attention/tree/9e8e90ba624e52dcccba47c7289bb305765f5da6 |
TransferConv3 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.utils.data
class TransferConv3(nn.Module):
def __init__(self, n_channels, n_channels_in=None, residual=False):
super().__init__()
if n_channels_in is None:
n_channels_in = n_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | jozhang97/Side-tuning | TransferConv3 | false | 15,731 | [
"MIT"
] | 56 | dea345691fb7ee0230150fe56ddd644efdffa6ac | https://github.com/jozhang97/Side-tuning/tree/dea345691fb7ee0230150fe56ddd644efdffa6ac |
EncoderLayer | import math
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-12):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_model))
self.beta = nn.Parameter(torch.zeros(d_model))
self.eps = eps
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.... | jkimbf/transformer-1 | EncoderLayer | false | 15,732 | [
"Apache-2.0"
] | 233 | 6cd29731197822d6db641cdbfad3b045b8a294e4 | https://github.com/jkimbf/transformer-1/tree/6cd29731197822d6db641cdbfad3b045b8a294e4 |
DecoderLayer | import math
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-12):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_model))
self.beta = nn.Parameter(torch.zeros(d_model))
self.eps = eps
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.... | jkimbf/transformer-1 | DecoderLayer | false | 15,733 | [
"Apache-2.0"
] | 233 | 6cd29731197822d6db641cdbfad3b045b8a294e4 | https://github.com/jkimbf/transformer-1/tree/6cd29731197822d6db641cdbfad3b045b8a294e4 |
FirstResBlockDiscriminator | import torch
import numpy as np
from torch import nn
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class SpectralNorm(nn.Module):
def __init__(self, module, name='weight', power_iterations=1):
super(SpectralNorm, self).__init__()
self.module = mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jingyang2017/Face-and-Image-super-resolution | FirstResBlockDiscriminator | false | 15,734 | [
"MIT"
] | 215 | 0351b5f7c71013f022a972306afd036f1af3a8e6 | https://github.com/jingyang2017/Face-and-Image-super-resolution/tree/0351b5f7c71013f022a972306afd036f1af3a8e6 |
Attention | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, dim, dim_embed):
super(Encoder, self).__init__()
self.embed = nn.Conv1d(dim, dim_embed, 1)
return
def forward(self, input):
input_2 = input.permute(0, 2, 1)
out = self.embed(input_2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | jomavera/DRL_HFV | Attention | false | 15,735 | [
"MIT"
] | 114 | 043e32805ec79fd35281b864659c194d7b89f5bc | https://github.com/jomavera/DRL_HFV/tree/043e32805ec79fd35281b864659c194d7b89f5bc |
ShortWave | import torch
import torch.nn as nn
import torch.nn.functional as F
class CausalConv1d(nn.Conv1d):
def __init__(self, input_size, hidden_size, kernel_size, stride=1,
dilation=1, groups=1, bias=True, sigmoid=None, tanh=None):
self.left_padding = (kernel_size - 1) * dilation
super(CausalConv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | jpeg729/pytorch-bits | ShortWave | false | 15,736 | [
"MIT"
] | 73 | 5d107094042c27472dfb7dee77506b603f5d3e45 | https://github.com/jpeg729/pytorch-bits/tree/5d107094042c27472dfb7dee77506b603f5d3e45 |
CausalConv1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class CausalConv1d(nn.Conv1d):
def __init__(self, input_size, hidden_size, kernel_size, stride=1,
dilation=1, groups=1, bias=True, sigmoid=None, tanh=None):
self.left_padding = (kernel_size - 1) * dilation
super(CausalConv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | jpeg729/pytorch-bits | CausalConv1d | false | 15,737 | [
"MIT"
] | 73 | 5d107094042c27472dfb7dee77506b603f5d3e45 | https://github.com/jpeg729/pytorch-bits/tree/5d107094042c27472dfb7dee77506b603f5d3e45 |
SparseGate | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import torch.optim
import torch.utils.data
class SparseGate(nn.Module):
def __init__(self, in_features, n_experts, k=2):
"""
Returns a sparsely gated noisy softmax.
See OUTRAGEOUSLY LARGE NEU... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jozhang97/Side-tuning | SparseGate | false | 15,738 | [
"MIT"
] | 56 | dea345691fb7ee0230150fe56ddd644efdffa6ac | https://github.com/jozhang97/Side-tuning/tree/dea345691fb7ee0230150fe56ddd644efdffa6ac |
KL_loss | import torch
import torch.nn.functional
class KL_loss(torch.nn.Module):
def __init__(self):
super(KL_loss, self).__init__()
def forward(self, mu, logvar):
KLD_element = mu.pow(2).add_(logvar.exp()).mul_(-1).add_(1).add_(logvar
)
KLD = torch.sum(KLD_element).mul_(-0.5)
... | 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... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | KL_loss | false | 15,739 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
VGGBase | import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from itertools import product as product
def decimate(tensor, m):
"""
Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value.
This is used when we convert FC layers to equivalent Convolutional 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
import torchvision
import tor... | ildoonet/ai-starthon-2019 | VGGBase | false | 15,740 | [
"MIT"
] | 69 | 148855adcb731741938a86545a2d3282287f0a50 | https://github.com/ildoonet/ai-starthon-2019/tree/148855adcb731741938a86545a2d3282287f0a50 |
SelfAttentionWide | import torch
from torch import nn
import torch.nn.functional as F
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
h, w = matri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jplasser/former | SelfAttentionWide | false | 15,741 | [
"MIT"
] | 674 | 7dabf7b355e94f2f0af966bd0daead539a30675a | https://github.com/jplasser/former/tree/7dabf7b355e94f2f0af966bd0daead539a30675a |
SSD300 | import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt
from itertools import product as product
def decimate(tensor, m):
"""
Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value.
This is used when we convert FC layers to equi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ildoonet/ai-starthon-2019 | SSD300 | false | 15,742 | [
"MIT"
] | 69 | 148855adcb731741938a86545a2d3282287f0a50 | https://github.com/ildoonet/ai-starthon-2019/tree/148855adcb731741938a86545a2d3282287f0a50 |
SoftExp | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftExp(nn.Module):
def __init__(self, input_size):
super(SoftExp, self).__init__()
self.alpha = nn.Parameter(torch.Tensor(input_size))
def forward(self, data):
self.alpha.data.clamp_(-1, 1)
positives = ... | 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
... | jpeg729/pytorch-bits | SoftExp | false | 15,743 | [
"MIT"
] | 73 | 5d107094042c27472dfb7dee77506b603f5d3e45 | https://github.com/jpeg729/pytorch-bits/tree/5d107094042c27472dfb7dee77506b603f5d3e45 |
OcrPtrNet | import math
import torch
from torch import nn
class OcrPtrNet(nn.Module):
def __init__(self, hidden_size, query_key_size=None):
super().__init__()
if query_key_size is None:
query_key_size = hidden_size
self.hidden_size = hidden_size
self.query_key_size = query_key_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
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | junj2ejj/sam-textvqa | OcrPtrNet | false | 15,744 | [
"W3C"
] | 48 | 6bf646d741fb2536e3a8f331c78b594f6199df15 | https://github.com/junj2ejj/sam-textvqa/tree/6bf646d741fb2536e3a8f331c78b594f6199df15 |
Cblock | import torch
import torch.nn as nn
import torch.nn.functional
class Cblock(nn.Module):
def __init__(self, in_ch, out_ch, stride=1):
super(Cblock, self).__init__()
self.block = nn.Conv3d(in_ch, out_ch, kernel_size=3, stride=stride,
padding=1, bias=True)
def forward(self, 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
import torch.nn.functional
assert_size_stride = torch._C._... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | Cblock | false | 15,745 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
Wave | import torch
import torch.nn as nn
import torch.nn.functional as F
class CausalConv1d(nn.Conv1d):
def __init__(self, input_size, hidden_size, kernel_size, stride=1,
dilation=1, groups=1, bias=True, sigmoid=None, tanh=None):
self.left_padding = (kernel_size - 1) * dilation
super(CausalConv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | jpeg729/pytorch-bits | Wave | false | 15,746 | [
"MIT"
] | 73 | 5d107094042c27472dfb7dee77506b603f5d3e45 | https://github.com/jpeg729/pytorch-bits/tree/5d107094042c27472dfb7dee77506b603f5d3e45 |
DoubleConv | import torch
import torch.nn as nn
import torch.nn.functional
class DoubleConv(nn.Module):
"""(convolution => [BN] => ReLU) * 2"""
def __init__(self, in_channels, out_channels, mid_channels=None):
super().__init__()
if not mid_channels:
mid_channels = out_channels
self.con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | DoubleConv | false | 15,747 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
SelfAttentionGPT2 | import torch
from torch import nn
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
h, w = matrices.size(-2), matrices.size(-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._inductor.runtime.... | jplasser/former | SelfAttentionGPT2 | false | 15,749 | [
"MIT"
] | 674 | 7dabf7b355e94f2f0af966bd0daead539a30675a | https://github.com/jplasser/former/tree/7dabf7b355e94f2f0af966bd0daead539a30675a |
Hflip | import torch
import torch.nn as nn
def hflip(input: 'torch.Tensor') ->torch.Tensor:
return torch.flip(input, [-1])
class Hflip(nn.Module):
"""Horizontally flip a tensor image or a batch of tensor images.
Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
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 torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | justanhduc/kornia | Hflip | false | 15,750 | [
"ECL-2.0",
"Apache-2.0"
] | 51 | c14081292dfb2491fad50ba10e27491cad8cb3e3 | https://github.com/justanhduc/kornia/tree/c14081292dfb2491fad50ba10e27491cad8cb3e3 |
convBlock | import torch
import torch.nn as nn
import torch.nn.functional
class convBlock(nn.Module):
"""
A convolutional block including conv, BN, nonliear activiation, residual connection
"""
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, bias=True, batchnorm=False, r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional
assert_size_stride = torch._C._... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | convBlock | false | 15,751 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
BinaryFocalLossWithLogits | import torch
import torch.nn as nn
def binary_focal_loss_with_logits(input: 'torch.Tensor', target:
'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction:
'str'='none', eps: 'float'=1e-08) ->torch.Tensor:
"""Function that computes Binary Focal loss.
.. math::
\\text{FL}(p_t) = -... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | justanhduc/kornia | BinaryFocalLossWithLogits | false | 15,752 | [
"ECL-2.0",
"Apache-2.0"
] | 51 | c14081292dfb2491fad50ba10e27491cad8cb3e3 | https://github.com/justanhduc/kornia/tree/c14081292dfb2491fad50ba10e27491cad8cb3e3 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, dim, dim_embed):
super(Encoder, self).__init__()
self.embed = nn.Conv1d(dim, dim_embed, 1)
return
def forward(self, input):
input_2 = input.permute(0, 2, 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._inductor.runtime.... | jomavera/DRL_HFV | Critic | false | 15,753 | [
"MIT"
] | 114 | 043e32805ec79fd35281b864659c194d7b89f5bc | https://github.com/jomavera/DRL_HFV/tree/043e32805ec79fd35281b864659c194d7b89f5bc |
ConvMeanPool | import torch
from torch import nn
class MyConvo2d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, he_init=True,
stride=1, bias=True):
super(MyConvo2d, self).__init__()
self.he_init = he_init
self.padding = int((kernel_size - 1) / 2)
self.conv = 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | justaboutlola/improved-wgan-pytorch | ConvMeanPool | false | 15,754 | [
"MIT"
] | 412 | 5bb0b729809152d9129ef72a9dd28b3ff83021a2 | https://github.com/justaboutlola/improved-wgan-pytorch/tree/5bb0b729809152d9129ef72a9dd28b3ff83021a2 |
SelfAttention | import torch
from torch import nn
class SelfAttention(nn.Module):
"""Self attention layer, cited from https://github.com/heykeetae/Self-Attention-GAN/blob/master/sagan_models.py"""
def __init__(self, in_dim, activation='relu', k=2):
super().__init__()
self.chanel_in = in_dim
self.acti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jscarlson/zi2zi-pytorch | SelfAttention | false | 15,755 | [
"Apache-2.0"
] | 81 | 3409165b304ccf1d5a5c2329a9f0f0897b3495dc | https://github.com/jscarlson/zi2zi-pytorch/tree/3409165b304ccf1d5a5c2329a9f0f0897b3495dc |
UpSampleConv | import torch
from torch import nn
class MyConvo2d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, he_init=True,
stride=1, bias=True):
super(MyConvo2d, self).__init__()
self.he_init = he_init
self.padding = int((kernel_size - 1) / 2)
self.conv = 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | justaboutlola/improved-wgan-pytorch | UpSampleConv | false | 15,756 | [
"MIT"
] | 412 | 5bb0b729809152d9129ef72a9dd28b3ff83021a2 | https://github.com/justaboutlola/improved-wgan-pytorch/tree/5bb0b729809152d9129ef72a9dd28b3ff83021a2 |
ExtractTensorPatches | import torch
from typing import Optional
from typing import Tuple
import torch.nn as nn
import torch.nn.functional as F
from typing import Union
from torch.nn.modules.utils import _pair
def _extract_tensor_patchesnd(input: 'torch.Tensor', window_sizes:
'Tuple[int, ...]', strides: 'Tuple[int, ...]') ->torch.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 typing import Optional
from typing import Tuple
import torch.nn as nn
import torch.nn.functional as F
from typing import Union
from tor... | justanhduc/kornia | ExtractTensorPatches | false | 15,757 | [
"ECL-2.0",
"Apache-2.0"
] | 51 | c14081292dfb2491fad50ba10e27491cad8cb3e3 | https://github.com/justanhduc/kornia/tree/c14081292dfb2491fad50ba10e27491cad8cb3e3 |
Grad_hyper | import torch
import torch.nn.functional
class Grad_hyper(torch.nn.Module):
"""
N-D gradient loss.
"""
def __init__(self, penalty='l1'):
super(Grad_hyper, self).__init__()
self.penalty = penalty
def forward(self, y_pred, wts):
dy = torch.abs(y_pred[:, :, 1:, :] - y_pred[:,... | 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... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | Grad_hyper | false | 15,758 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
PCC | import torch
import torch.nn.functional
class PCC(torch.nn.Module):
def __init__(self):
super(PCC, self).__init__()
def pcc(self, y_true, y_pred):
A_bar = torch.mean(y_pred, dim=[1, 2, 3, 4], keepdim=True)
B_bar = torch.mean(y_true, dim=[1, 2, 3, 4], keepdim=True)
top = 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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn.functional
a... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | PCC | false | 15,760 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
outblock | import torch
import torch.nn as nn
from torch.distributions.normal import Normal
import torch.nn.functional
class outblock(nn.Module):
def __init__(self, in_ch, out_ch, stride=2, output_padding=1):
super(outblock, self).__init__()
self.upconv = nn.Conv3d(in_ch, out_ch, 3, padding=1, stride=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
import torch.nn as nn
from torch.distributions.normal import Normal
import torch... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | outblock | false | 15,761 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
DeiTEmbeddings | from _paritybench_helpers import _mock_config
import collections
import torch
from torch import nn
import torch.utils.checkpoint
import collections.abc
def to_2tuple(x):
if isinstance(x, collections.abc.Iterable):
return x
return x, x
class PatchEmbeddings(nn.Module):
"""
Image to Patch Embe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 collections
from torch import nn
import torch.utils.checkpoint
import col... | jxhe/unify-parameter-efficient-tuning | DeiTEmbeddings | false | 15,762 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
GroupedLinearLayer | import torch
from torch import nn
import torch.utils.checkpoint
class GroupedLinearLayer(nn.Module):
def __init__(self, input_size, output_size, num_groups):
super().__init__()
self.input_size = input_size
self.output_size = output_size
self.num_groups = num_groups
self.gr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.checkpoint
assert_size_stride = torch._C... | jxhe/unify-parameter-efficient-tuning | GroupedLinearLayer | false | 15,763 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
ConvBlock | import torch
import torch.nn as nn
import torch.utils.data
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1):
super(ConvBlock, self).__init__()
self.Mconv = nn.Conv2d(in_channels=in_channels, out_channels=
out_channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | kacel33/ActionAI_PC | ConvBlock | false | 15,764 | [
"MIT"
] | 1,311 | a0528f49ea61cc07d7c1e9a3cd6846e5f50cfae7 | https://github.com/kacel33/ActionAI_PC/tree/a0528f49ea61cc07d7c1e9a3cd6846e5f50cfae7 |
HubertFeatureProjection | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class HubertFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.
layer_norm_eps)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | jxhe/unify-parameter-efficient-tuning | HubertFeatureProjection | false | 15,765 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
MegatronBertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class MegatronBertOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.checkpoint
assert_size_stride = torch._C... | jxhe/unify-parameter-efficient-tuning | MegatronBertOutput | false | 15,766 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
IBertLMHead | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class IBertLMHead(nn.Module):
"""I-BERT Head for masked language modelin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | jxhe/unify-parameter-efficient-tuning | IBertLMHead | false | 15,767 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
Conv3d_wd | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.functional
class Conv3d_wd(nn.Conv3d):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1,
1), padding=(0, 0, 0), dilation=(1, 1, 1), groups=1, bias=False):
super(Conv3d_wd, self).__init__(in_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | Conv3d_wd | false | 15,768 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
MPNetSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
class MPNetSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if (config.hidden_size % config.num_attention_heads != 0 and not
hasattr(config... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jxhe/unify-parameter-efficient-tuning | MPNetSelfAttention | false | 15,769 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
NoNorm | import torch
from torch import nn
import torch.utils.checkpoint
class NoNorm(nn.Module):
def __init__(self, feat_size, eps=None):
super().__init__()
self.bias = nn.Parameter(torch.zeros(feat_size))
self.weight = nn.Parameter(torch.ones(feat_size))
def forward(self, input_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 import nn
import torch.utils.checkpoint
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | jxhe/unify-parameter-efficient-tuning | NoNorm | false | 15,770 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
ConvDropoutLayerNorm | import torch
from torch import nn
import torch.utils.checkpoint
class SqueezeBertLayerNorm(nn.LayerNorm):
"""
This is a nn.LayerNorm subclass that accepts NCW data layout and performs normalization in the C dimension.
N = batch C = channels W = sequence length
"""
def __init__(self, hidden_size,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | jxhe/unify-parameter-efficient-tuning | ConvDropoutLayerNorm | false | 15,771 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
DeiTAttention | from _paritybench_helpers import _mock_config
import math
import torch
from typing import List
from typing import Tuple
from torch import nn
from typing import Set
import torch.utils.checkpoint
def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int',
head_size: 'int', already_pruned_heads: 'Set[in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jxhe/unify-parameter-efficient-tuning | DeiTAttention | false | 15,772 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
MobileBertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
class MobileBertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.attention_head_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
from torch._inductor.runtime.... | jxhe/unify-parameter-efficient-tuning | MobileBertSelfAttention | false | 15,773 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_size, action_size, action_parameter_size,
hidden_layers=None, action_input_layer=0, init_type='normal',
activation='leaky_relu', init_std=0.01):
super(Critic, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jordiriu/MP-DQN | Critic | false | 15,774 | [
"MIT"
] | 75 | eec13eb9b4e2c0099649e0639f2a8b93d7d0d5be | https://github.com/jordiriu/MP-DQN/tree/eec13eb9b4e2c0099649e0639f2a8b93d7d0d5be |
DistillationOrthogonalProjectionLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class DistillationOrthogonalProjectionLoss(nn.Module):
def __init__(self):
super(DistillationOrthogonalProjectionLoss, 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 import triton_helpers
from torch._inductor.runtime.... | kahnchana/opl | DistillationOrthogonalProjectionLoss | false | 15,775 | [
"MIT"
] | 64 | 1db31de3f95ced16c769f5b18325bdef46f317f4 | https://github.com/kahnchana/opl/tree/1db31de3f95ced16c769f5b18325bdef46f317f4 |
MSE | import torch
import torch.nn as nn
from torch.optim import *
class MSE(nn.Module):
def __init__(self):
super().__init__()
def forward(self, outputs, target, *args):
val_pixels = (target > 0.001).float()
loss = target * val_pixels - outputs * val_pixels
return loss ** 2
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.optim import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._... | kakaxi314/GuideNet | MSE | false | 15,776 | [
"MIT"
] | 142 | 9f53b4086d707e94d48a47bbac7dd87aaba9fdea | https://github.com/kakaxi314/GuideNet/tree/9f53b4086d707e94d48a47bbac7dd87aaba9fdea |
ResBlock | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.functional
def Activation_layer(activation_cfg, inplace=True):
out = None
if activation_cfg == 'ReLU':
out = nn.ReLU(inplace=inplace)
else:
out = nn.LeakyReLU(ne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.fun... | junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration | ResBlock | false | 15,777 | [
"MIT"
] | 82 | dfa24a47a564a000aa9b4eea95a6e83a24568359 | https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/tree/dfa24a47a564a000aa9b4eea95a6e83a24568359 |
RMSE | import torch
import torch.nn as nn
from torch.optim import *
class RMSE(nn.Module):
def __init__(self):
super().__init__()
def forward(self, outputs, target, *args):
val_pixels = (target > 0.001).float()
err = (target * val_pixels - outputs * val_pixels) ** 2
loss = torch.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.triton_helpers import libdevice
import torch.nn as nn
from torch.optim import *
assert_size_stride = torch._C._... | kakaxi314/GuideNet | RMSE | false | 15,778 | [
"MIT"
] | 142 | 9f53b4086d707e94d48a47bbac7dd87aaba9fdea | https://github.com/kakaxi314/GuideNet/tree/9f53b4086d707e94d48a47bbac7dd87aaba9fdea |
mySConv | import torch
import torch.nn as nn
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import InstanceNorm2d
class mySConv(nn.Module):
def __init__(self, num_filter=128, stride=1, in_channels=128):
super(mySConv, self).__init__()
self.conv = Conv2d(out_channels=num_filter, 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._inductor.runtime.... | junhocho/ShapeMatchingGAN | mySConv | false | 15,779 | [
"MIT"
] | 117 | b90e9c2490bfdf62c5da9b1eb6b0cdf0618cf570 | https://github.com/junhocho/ShapeMatchingGAN/tree/b90e9c2490bfdf62c5da9b1eb6b0cdf0618cf570 |
Scale | import torch
from torch import nn
from torch.nn import *
class Scale(nn.Module):
def __init__(self, scale):
super().__init__()
self.scale = scale
def forward(self, x):
return x * self.scale
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 import nn
from torch.nn import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._d... | kcorder/autonomous-learning-library | Scale | false | 15,780 | [
"MIT"
] | 584 | 0266195fa47564e51a32087bc007bff6dda5e263 | https://github.com/kcorder/autonomous-learning-library/tree/0266195fa47564e51a32087bc007bff6dda5e263 |
MultiLayeredConv1d | import torch
class MultiLayeredConv1d(torch.nn.Module):
"""Multi-layered conv1d for Transformer block.
This is a module of multi-leyered conv1d designed to replace positionwise feed-forward network
in Transforner block, which is introduced in `FastSpeech: Fast, Robust and Controllable Text to Speech`_.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | karan-deepsync/FastSpeech2 | MultiLayeredConv1d | false | 15,781 | [
"Apache-2.0"
] | 148 | 84ad261db4a865536b2e15dfb8346644c3192704 | https://github.com/karan-deepsync/FastSpeech2/tree/84ad261db4a865536b2e15dfb8346644c3192704 |
mySBlock | import torch
import torch.nn as nn
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import InstanceNorm2d
class mySConv(nn.Module):
def __init__(self, num_filter=128, stride=1, in_channels=128):
super(mySConv, self).__init__()
self.conv = Conv2d(out_channels=num_filter, 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._inductor.runtime.... | junhocho/ShapeMatchingGAN | mySBlock | false | 15,782 | [
"MIT"
] | 117 | b90e9c2490bfdf62c5da9b1eb6b0cdf0618cf570 | https://github.com/junhocho/ShapeMatchingGAN/tree/b90e9c2490bfdf62c5da9b1eb6b0cdf0618cf570 |
LayerNorm | import torch
class LayerNorm(torch.nn.Module):
def __init__(self, nout: 'int'):
super(LayerNorm, self).__init__()
self.layer_norm = torch.nn.LayerNorm(nout, eps=1e-12)
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
x = self.layer_norm(x.transpose(1, -1))
x = x.transpose... | 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... | karan-deepsync/FastSpeech2 | LayerNorm | false | 15,783 | [
"Apache-2.0"
] | 148 | 84ad261db4a865536b2e15dfb8346644c3192704 | https://github.com/karan-deepsync/FastSpeech2/tree/84ad261db4a865536b2e15dfb8346644c3192704 |
AlbertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from typing import List
from typing import Tuple
from torch import nn
from typing import Set
import torch.utils.checkpoint
def find_pruneable_heads_and_indices(heads: 'List[int]', n_heads: 'int',
head_size: 'int', already_pruned_heads: 'Set[in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jxhe/unify-parameter-efficient-tuning | AlbertAttention | false | 15,784 | [
"Apache-2.0"
] | 101 | 3222ce2c0079566a28043e22380eb4ab6ad14389 | https://github.com/jxhe/unify-parameter-efficient-tuning/tree/3222ce2c0079566a28043e22380eb4ab6ad14389 |
L2Norm | import torch
import torch.nn as nn
import torch.nn.init
class L2Norm(nn.Module):
def __init__(self):
super(L2Norm, self).__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.sum(x * x, dim=1) + self.eps)
x = x / norm.unsqueeze(-1).expand_as(x)
ret... | 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.nn.init
assert_size_stride = torch._C._dynam... | keeeeenw/image-matching-benchmark-baselines | L2Norm | false | 15,785 | [
"Apache-2.0"
] | 103 | 1a11bedbe3c57f477ab9de302591811115ada37a | https://github.com/keeeeenw/image-matching-benchmark-baselines/tree/1a11bedbe3c57f477ab9de302591811115ada37a |
BCELoss | import torch
import torch.utils.data
from torch import nn
class BCELoss(nn.Module):
def __init__(self):
super(self.__class__, self).__init__()
def forward(self, input, target):
return -torch.mean(torch.sum(target * torch.log(torch.clamp(input,
min=1e-10)) + (1 - target) * torch.l... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | kejiejiang/UnsupervisedDeepLearning-Pytorch | BCELoss | false | 15,786 | [
"MIT"
] | 87 | 6ea7b7151ae62bf0130b56cc023f2be068aa87f0 | https://github.com/kejiejiang/UnsupervisedDeepLearning-Pytorch/tree/6ea7b7151ae62bf0130b56cc023f2be068aa87f0 |
stage_block | import torch
import torch.nn as nn
import torch.utils.data
class dilation_layer(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, padding=
'same_padding', dilation=1):
super(dilation_layer, self).__init__()
if padding == 'same_padding':
padding = int((ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | kacel33/ActionAI_PC | stage_block | false | 15,787 | [
"MIT"
] | 1,311 | a0528f49ea61cc07d7c1e9a3cd6846e5f50cfae7 | https://github.com/kacel33/ActionAI_PC/tree/a0528f49ea61cc07d7c1e9a3cd6846e5f50cfae7 |
MSELoss | import torch
import torch.utils.data
from torch import nn
class MSELoss(nn.Module):
def __init__(self):
super(self.__class__, self).__init__()
def forward(self, input, target):
return torch.mean(torch.sum((input - target) ** 2, 1))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | kejiejiang/UnsupervisedDeepLearning-Pytorch | MSELoss | false | 15,788 | [
"MIT"
] | 87 | 6ea7b7151ae62bf0130b56cc023f2be068aa87f0 | https://github.com/kejiejiang/UnsupervisedDeepLearning-Pytorch/tree/6ea7b7151ae62bf0130b56cc023f2be068aa87f0 |
StageBlock | import torch
import torch.nn as nn
import torch.utils.data
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1):
super(ConvBlock, self).__init__()
self.Mconv = nn.Conv2d(in_channels=in_channels, out_channels=
out_channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | kacel33/ActionAI_PC | StageBlock | false | 15,789 | [
"MIT"
] | 1,311 | a0528f49ea61cc07d7c1e9a3cd6846e5f50cfae7 | https://github.com/kacel33/ActionAI_PC/tree/a0528f49ea61cc07d7c1e9a3cd6846e5f50cfae7 |
SeparableConv | import torch
import torch.nn as nn
import torch.utils
import torch.nn.parallel
class SeparableConv(nn.Module):
def __init__(self, in_planes, out_planes, kernel_size, bias):
super(SeparableConv, self).__init__()
padding = (kernel_size - 1) // 2
self.depthwise = nn.Conv2d(in_planes, in_plan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.parallel
assert_size_st... | kcyu2014/eval-nas | SeparableConv | false | 15,790 | [
"MIT"
] | 47 | 385376a3ef96336b54ee7e696af1d02b97aa5c32 | https://github.com/kcyu2014/eval-nas/tree/385376a3ef96336b54ee7e696af1d02b97aa5c32 |
ConstractiveLoss | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class ConstractiveLoss(nn.Module):
def __init__(self, margin=2.0, dist_flag='l2'):
super(ConstractiveLoss, self).__init__()
self.margin = margin
self.dist_flag = dist_flag
def various_distance(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 numpy as np
import to... | kensakurada/SceneChangeDet | ConstractiveLoss | false | 15,791 | [
"MIT"
] | 199 | 0530e0162863fec0c5296188526f0d27e0109814 | https://github.com/kensakurada/SceneChangeDet/tree/0530e0162863fec0c5296188526f0d27e0109814 |
l1normalization | import torch
import torch.nn as nn
class l1normalization(nn.Module):
def __init__(self, scale):
super(l1normalization, self).__init__()
self.scale = scale
def forward(self, x, dim=1):
return self.scale * x * x.pow(1).sum(dim).clamp(min=1e-12).rsqrt(
).expand_as(x)
def g... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | kensakurada/SceneChangeDet | l1normalization | false | 15,792 | [
"MIT"
] | 199 | 0530e0162863fec0c5296188526f0d27e0109814 | https://github.com/kensakurada/SceneChangeDet/tree/0530e0162863fec0c5296188526f0d27e0109814 |
QueryModule | import torch
from torch import nn
from torch.nn import functional as F
class QueryModule(nn.Module):
"""
A neural module that takes as input a feature map and an attention and produces a feature
map as output.
Extended Summary
----------------
A :class:`QueryModule` takes a feature map and an... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | kdexd/probnmn-clevr | QueryModule | false | 15,793 | [
"MIT"
] | 69 | 9c1b2286cf30e9fb045370153c9242a39760e02e | https://github.com/kdexd/probnmn-clevr/tree/9c1b2286cf30e9fb045370153c9242a39760e02e |
ComparisonModule | import torch
from torch import nn
from torch.nn import functional as F
class ComparisonModule(nn.Module):
"""
A neural module that takes as input two feature maps and produces a feature map as output.
Extended Summary
----------------
A :class:`ComparisonModule` takes two feature maps as input an... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | kdexd/probnmn-clevr | ComparisonModule | false | 15,794 | [
"MIT"
] | 69 | 9c1b2286cf30e9fb045370153c9242a39760e02e | https://github.com/kdexd/probnmn-clevr/tree/9c1b2286cf30e9fb045370153c9242a39760e02e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.