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 |
|---|---|---|---|---|---|---|---|---|---|---|
AffineConstantFlow | import torch
from torch import nn
class AffineConstantFlow(nn.Module):
"""
Scales + Shifts the flow by (learned) constants per dimension.
In NICE paper there is a Scaling layer which is a special case of this where t is None
"""
def __init__(self, dim, scale=True, shift=True):
super().__... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | ilkhem/icebeem | AffineConstantFlow | false | 15,591 | [
"MIT"
] | 48 | 0077f0120c83bcc6d9b199b831485c42bed2401f | https://github.com/ilkhem/icebeem/tree/0077f0120c83bcc6d9b199b831485c42bed2401f |
SomeQNet | import torch
import torch as t
import torch.nn as nn
class SomeQNet(nn.Module):
def __init__(self, state_dim, action_num):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16)
self.fc2 = nn.Linear(16, 16)
self.fc3 = nn.Linear(16, action_num)
def forward(self, state):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | iffiX/machin | SomeQNet | false | 15,592 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
ScaledDotProductAttention | import torch
import torch.optim.lr_scheduler
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, d_model, attention_dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temper = d_model ** 0.5
self.dropout = nn.Dropout(attention_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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | interrogator/self-attentive-parser | ScaledDotProductAttention | false | 15,593 | [
"MIT"
] | 88 | 660d0161cb6ec6455d1525d029ff09362dcf7faf | https://github.com/interrogator/self-attentive-parser/tree/660d0161cb6ec6455d1525d029ff09362dcf7faf |
QNet | import torch
import torch as t
import torch.nn as nn
class QNet(nn.Module):
def __init__(self, state_dim, action_num, atom_num=10):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16)
self.fc2 = nn.Linear(16, 16)
self.fc3 = nn.Linear(16, action_num * atom_num)
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.... | iffiX/machin | QNet | false | 15,594 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
LinearExcitability | import math
import torch
from torch import nn
from torch.nn.parameter import Parameter
def linearExcitability(input, weight, excitability=None, bias=None):
"""Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`.
Shape:
- input: :math:`(N, *, in_features)`
- we... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
from torch import nn
from torch.nn.parameter import Parameter
assert... | ifgovh/continual-learning | LinearExcitability | false | 15,595 | [
"MIT"
] | 891 | 21822801934ad68ca311c1c30ae49cdbd7ca53ed | https://github.com/ifgovh/continual-learning/tree/21822801934ad68ca311c1c30ae49cdbd7ca53ed |
A2CActorCont | import torch
import torch as t
import torch.nn as nn
from torch.distributions import Normal
import torch.nn.functional as F
class A2CActorCont(nn.Module):
def __init__(self, state_dim, action_dim, action_range):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16)
self.fc2 = nn.Linear(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.... | iffiX/machin | A2CActorCont | false | 15,596 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
ActorDiscrete | import torch
import torch as t
import torch.nn as nn
class ActorDiscrete(nn.Module):
def __init__(self, state_dim, action_dim):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16)
self.fc2 = nn.Linear(16, 16)
self.fc3 = nn.Linear(16, action_dim)
def forward(self, state):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | iffiX/machin | ActorDiscrete | false | 15,597 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
PARALoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class PARALoss(nn.Module):
"""
Softmax classifier for sentence-level relation extraction.
"""
def __init__(self):
"""
Args:
sentence_encoder: encoder for sentences
num_class: number of classes
... | 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... | igorvlnascimento/redn | PARALoss | false | 15,598 | [
"MIT"
] | 100 | f40f19a0fdfbb11a7987996d520716a05bafd77b | https://github.com/igorvlnascimento/redn/tree/f40f19a0fdfbb11a7987996d520716a05bafd77b |
Critic | import torch
import torch as t
import torch.nn as nn
class Critic(nn.Module):
def __init__(self, state_dim):
super().__init__()
self.fc1 = nn.Linear(state_dim, 32)
self.fc2 = nn.Linear(32, 32)
self.fc3 = nn.Linear(32, 1)
def forward(self, state):
v = t.relu(self.fc1(s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | iffiX/machin | Critic | false | 15,599 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
DDPGActorCont | import torch
import torch as t
import torch.nn as nn
class DDPGActorCont(nn.Module):
def __init__(self, state_dim, action_dim, action_range):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16)
self.fc2 = nn.Linear(16, 16)
self.fc3 = nn.Linear(16, action_dim)
self.actio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | iffiX/machin | DDPGActorCont | false | 15,600 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
MultiHeadAttention | import torch
import numpy as np
class MultiHeadAttention(torch.nn.Module):
def __init__(self, input_size, output_size, num_heads,
output_attentions=False):
super(MultiHeadAttention, self).__init__()
self.output_attentions = output_attentions
self.num_heads = num_heads
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | igorvlnascimento/redn | MultiHeadAttention | false | 15,601 | [
"MIT"
] | 100 | f40f19a0fdfbb11a7987996d520716a05bafd77b | https://github.com/igorvlnascimento/redn/tree/f40f19a0fdfbb11a7987996d520716a05bafd77b |
ConvD | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
def normalization(planes, norm='gn'):
if norm == 'bn':
m = nn.BatchNorm3d(planes)
elif norm == 'gn':
m = nn.GroupNorm(4, planes)
elif norm == 'in':
m = nn.InstanceNorm3d(p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ieee820/BraTS2018-tumor-segmentation | ConvD | false | 15,602 | [
"MIT"
] | 157 | 22e1a22909a0c21503b5ef5fc6860a1e1131e851 | https://github.com/ieee820/BraTS2018-tumor-segmentation/tree/22e1a22909a0c21503b5ef5fc6860a1e1131e851 |
DDPGCritic | import torch
import torch as t
import torch.nn as nn
class DDPGCritic(nn.Module):
def __init__(self, state_dim, action_dim):
super().__init__()
self.fc1 = nn.Linear(state_dim + action_dim, 16)
self.fc2 = nn.Linear(16, 16)
self.fc3 = nn.Linear(16, 1)
def forward(self, state, 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
assert_... | iffiX/machin | DDPGCritic | false | 15,603 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
RNN | import torch
import torch.nn as nn
from torch.autograd import Variable
class RNN(nn.Module):
def __init__(self, category_size, input_size, hidden_size, output_size):
super(RNN, self).__init__()
self.category_size = category_size
self.input_size = input_size
self.hidden_size = hidd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.autograd import Variable
assert_size_stride = t... | igorwood/practical-pytorch | RNN | false | 15,604 | [
"MIT"
] | 4,847 | c08fc28ba1f7d6838c3938076cc1b03d90dccace | https://github.com/igorwood/practical-pytorch/tree/c08fc28ba1f7d6838c3938076cc1b03d90dccace |
ConvTanh | import torch
import numpy as np
class ConvLayer(torch.nn.Module):
"""Reflection padded convolution layer."""
def __init__(self, in_channels, out_channels, kernel_size, stride, bias
=True):
super(ConvLayer, self).__init__()
reflection_padding = int(np.floor(kernel_size / 2))
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | irsisyphus/reconet | ConvTanh | false | 15,605 | [
"MIT"
] | 56 | 863acf8dde4d45c8521634af27878fe04f3b2e56 | https://github.com/irsisyphus/reconet/tree/863acf8dde4d45c8521634af27878fe04f3b2e56 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Georgetown-IR-Lab/OpenNIR | BertSelfAttention | false | 15,606 | [
"MIT"
] | 140 | 7d93e8643fe311e3e9c7a0678efe9775fd80485e | https://github.com/Georgetown-IR-Lab/OpenNIR/tree/7d93e8643fe311e3e9c7a0678efe9775fd80485e |
EncoderLayer | import math
import torch
from torch import 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, 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | hyunwoongko/transformer | EncoderLayer | false | 15,607 | [
"Apache-2.0"
] | 233 | 8f7aaa19d37b088c156db0512868127ba9bf1a0f | https://github.com/hyunwoongko/transformer/tree/8f7aaa19d37b088c156db0512868127ba9bf1a0f |
LogTaylorSoftmaxV1 | import torch
import torch.nn as nn
def taylor_softmax_v1(x, dim=1, n=4, use_log=False):
assert n % 2 == 0 and n > 0
fn = torch.ones_like(x)
denor = 1.0
for i in range(1, n + 1):
denor *= i
fn = fn + x.pow(i) / denor
out = fn / fn.sum(dim=dim, keepdims=True)
if use_log:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | ishine/DeepKE | LogTaylorSoftmaxV1 | false | 15,608 | [
"MIT"
] | 676 | 75bcfb3e045bb2197ac5c0847693c2a647f76576 | https://github.com/ishine/DeepKE/tree/75bcfb3e045bb2197ac5c0847693c2a647f76576 |
DecoderLayer | import math
import torch
from torch import 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, 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | hyunwoongko/transformer | DecoderLayer | false | 15,609 | [
"Apache-2.0"
] | 233 | 8f7aaa19d37b088c156db0512868127ba9bf1a0f | https://github.com/hyunwoongko/transformer/tree/8f7aaa19d37b088c156db0512868127ba9bf1a0f |
MLP | import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, left_channel, right_channel, out_channel):
super(MLP, self).__init__()
self.left = nn.Linear(left_channel, 128)
self.right = nn.Linear(right_channel, 128)
self.l1 = nn.Linear(256, 256)
self.l2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | imxian/FlexTensor | MLP | false | 15,610 | [
"MIT"
] | 135 | 311af3362856ea1b0073404fffad42c54585c205 | https://github.com/imxian/FlexTensor/tree/311af3362856ea1b0073404fffad42c54585c205 |
Invertible1x1Conv | import torch
from torch.nn import functional as F
from torch.autograd import Variable
import torch.utils.data
class Invertible1x1Conv(torch.nn.Module):
"""
The layer outputs both the convolution, and the log determinant
of its weight matrix. If reverse=True it does convolution with
inverse
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 functional as F
from torch.autograd import Variable
import ... | ishalyminov/shad_speech | Invertible1x1Conv | false | 15,611 | [
"MIT"
] | 83 | e1345d2de929e150b2683190b127a837fbcb34f3 | https://github.com/ishalyminov/shad_speech/tree/e1345d2de929e150b2683190b127a837fbcb34f3 |
Loss | import torch
import torch.nn as nn
import torch.utils.data
class Loss(nn.Module):
def __init__(self):
super(Loss, self).__init__()
def forward(self, gt_region, gt_affinity, pred_region, pred_affinity,
conf_map):
loss = torch.mean(((gt_region - pred_region).pow(2) + (gt_affinity -
... | 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... | ishine/EasyOCR | Loss | false | 15,612 | [
"Apache-2.0"
] | 56 | ab7cebb64482e5e50ee7a37fa50398b8cb7481c7 | https://github.com/ishine/EasyOCR/tree/ab7cebb64482e5e50ee7a37fa50398b8cb7481c7 |
BlockWidth1d | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class BlockWidth1d(nn.Module):
def __init__(self, width) ->None:
super().__init__()
self.conv = nn.Conv1d(width, width, kernel_size=5, padding=2)
def forward(self, x):
x = x + F.leaky_relu(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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | ishine/HiFiplusplus-pytorch | BlockWidth1d | false | 15,613 | [
"MIT"
] | 69 | 8be0d0e0092d4f609c37bfbeede5a9ad9bd7470a | https://github.com/ishine/HiFiplusplus-pytorch/tree/8be0d0e0092d4f609c37bfbeede5a9ad9bd7470a |
PARALossSoftmax | import torch
import torch.nn as nn
import torch.nn.functional as F
class PARALossSoftmax(nn.Module):
"""
Softmax classifier for sentence-level relation extraction.
"""
def __init__(self):
"""
Args:
sentence_encoder: encoder for sentences
num_class: number of cl... | 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
... | igorvlnascimento/redn | PARALossSoftmax | false | 15,614 | [
"MIT"
] | 100 | f40f19a0fdfbb11a7987996d520716a05bafd77b | https://github.com/igorvlnascimento/redn/tree/f40f19a0fdfbb11a7987996d520716a05bafd77b |
AttDot | import torch
import torch.nn.functional as F
class AttDot(torch.nn.Module):
"""
AttDot: Dot attention that can be used by the Alignment module.
"""
def __init__(self, softmax=True):
super().__init__()
self.softmax = softmax
def forward(self, query, y):
att = torch.bmm(que... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/NISQA | AttDot | false | 15,615 | [
"MIT"
] | 223 | 2c8917f30c4e4bbca3a48e9852301f1e2480a741 | https://github.com/ishine/NISQA/tree/2c8917f30c4e4bbca3a48e9852301f1e2480a741 |
AttentionPool | import torch
import torch.nn as nn
class AttentionPool(nn.Module):
"""docstring for AttentionPool"""
def __init__(self, inputdim, outputdim=10, pooldim=1, **kwargs):
super().__init__()
self.inputdim = inputdim
self.outputdim = outputdim
self.pooldim = pooldim
self.tran... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/AudioCaption | AttentionPool | false | 15,616 | [
"MIT"
] | 76 | d121cba8247b96aeed9ff77d2fff073f93e0a63f | https://github.com/ishine/AudioCaption/tree/d121cba8247b96aeed9ff77d2fff073f93e0a63f |
Conv1DBlock | import torch
import torch.nn.functional as F
import torch.nn as nn
class ConvNorm(nn.Module):
""" 1D Convolution """
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=None, dilation=1, bias=True, w_init_gain='linear'):
super(ConvNorm, self).__init__()
if p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ishine/FastPitchFormant | Conv1DBlock | false | 15,617 | [
"MIT"
] | 54 | dd86032953be04fb526b658b19ecdc5600ff25a5 | https://github.com/ishine/FastPitchFormant/tree/dd86032953be04fb526b658b19ecdc5600ff25a5 |
TokenLearnedEncoding | import torch
from torch import nn
class TokenLearnedEncoding(nn.Module):
"""
Learned additive img/word/action token encoding implemented on top of nn.Embedding
"""
def __init__(self, d_model, vocab_size=3, init_range=0.1):
super().__init__()
self.emb = nn.Embedding(vocab_size, d_model... | 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... | ishikasingh/teach | TokenLearnedEncoding | false | 15,618 | [
"MIT"
] | 54 | 5554f02f55c22abfe5c2a749dbb24c13377726c8 | https://github.com/ishikasingh/teach/tree/5554f02f55c22abfe5c2a749dbb24c13377726c8 |
BlockWidth2d | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class BlockWidth2d(nn.Module):
def __init__(self, width) ->None:
super().__init__()
self.conv = nn.Conv2d(width, width, kernel_size=3, padding=1)
def forward(self, x):
x = x + F.leaky_relu(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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | ishine/HiFiplusplus-pytorch | BlockWidth2d | false | 15,619 | [
"MIT"
] | 69 | 8be0d0e0092d4f609c37bfbeede5a9ad9bd7470a | https://github.com/ishine/HiFiplusplus-pytorch/tree/8be0d0e0092d4f609c37bfbeede5a9ad9bd7470a |
ApplyHardAttention | import torch
class ApplyHardAttention(torch.nn.Module):
"""
ApplyHardAttention: Apply hard attention for the purpose of time-alignment.
"""
def __init__(self):
super().__init__()
def forward(self, y, att):
self.idx = att.argmax(2)
y = y[torch.arange(y.shape[0]).unsqueeze(... | 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... | ishine/NISQA | ApplyHardAttention | false | 15,620 | [
"MIT"
] | 223 | 2c8917f30c4e4bbca3a48e9852301f1e2480a741 | https://github.com/ishine/NISQA/tree/2c8917f30c4e4bbca3a48e9852301f1e2480a741 |
EmissionModel | import torch
from torch import nn
import torch.distributions as tdist
class EmissionModel(nn.Module):
"""
Emission Model of the HMM, it represents the probability of emitting an observation based on the current state
"""
def __init__(self):
super(EmissionModel, self).__init__()
self.d... | 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
from torch import nn
import torch.distributions as tdist
assert_size_stri... | ishine/Neural-HMM | EmissionModel | false | 15,621 | [
"MIT"
] | 66 | c0bc23ab88f831173d2d4db29a84503b80c5cdc4 | https://github.com/ishine/Neural-HMM/tree/c0bc23ab88f831173d2d4db29a84503b80c5cdc4 |
StyleEmbedAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
class StyleEmbedAttention(nn.Module):
""" StyleEmbedAttention """
def __init__(self, query_dim, key_dim, num_units, num_heads):
super(StyleEmbedAttention, self).__init__()
self.num_units = num_units
self.num_heads = nu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/Comprehensive-Transformer-TTS | StyleEmbedAttention | false | 15,622 | [
"MIT"
] | 147 | dca252cae50a18464ce2410aa85a21c557c72d7a | https://github.com/ishine/Comprehensive-Transformer-TTS/tree/dca252cae50a18464ce2410aa85a21c557c72d7a |
FCMinibatchStd | import math
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
if input.ndim == 3:
return F.leaky_relu(input + bias.view(1, *rest_dim, bias.shape[0]),
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 math
from to... | ishine/GANsNRoses | FCMinibatchStd | false | 15,623 | [
"MIT"
] | 969 | 414e9e77c3df47d4ecf7941b5dcfdffec67403ee | https://github.com/ishine/GANsNRoses/tree/414e9e77c3df47d4ecf7941b5dcfdffec67403ee |
ModulatedConv2d | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | ishine/GANsNRoses | ModulatedConv2d | false | 15,624 | [
"MIT"
] | 969 | 414e9e77c3df47d4ecf7941b5dcfdffec67403ee | https://github.com/ishine/GANsNRoses/tree/414e9e77c3df47d4ecf7941b5dcfdffec67403ee |
StyleAdaptiveLayerNorm | import torch
import torch.nn as nn
import torch.utils.data.distributed
class AffineLinear(nn.Module):
def __init__(self, in_dim, out_dim):
super(AffineLinear, self).__init__()
affine = nn.Linear(in_dim, out_dim)
self.affine = affine
def forward(self, input):
return self.affin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ishine/StyleSpeech-1 | StyleAdaptiveLayerNorm | false | 15,625 | [
"MIT"
] | 106 | f939cf9cb981db7b738fa9c9c9a7fea2dfdd0766 | https://github.com/ishine/StyleSpeech-1/tree/f939cf9cb981db7b738fa9c9c9a7fea2dfdd0766 |
_DynamicGates | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class _DynamicGates(nn.Module):
"""Internal class to wrap the dynamic gate parameters into a dedicated PyTorch Module"""
def __init__(self, cfg: 'Config', input_size: 'int'):
super(_DynamicGates, 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... | DavidChoi76/neuralhydrology | _DynamicGates | false | 15,626 | [
"BSD-3-Clause"
] | 144 | a4c284b92934ee973c8b3fedf8a60df60c8feae1 | https://github.com/DavidChoi76/neuralhydrology/tree/a4c284b92934ee973c8b3fedf8a60df60c8feae1 |
FastAttention | import torch
import torch.nn as nn
class FastAttention(nn.Module):
""" wuch15's Fastformer Attention module (Official) """
def __init__(self, dim, dim_head, heads, dropout=0.1, initializer_range
=0.02):
super(FastAttention, self).__init__()
self.initializer_range = initializer_range
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/Comprehensive-Transformer-TTS | FastAttention | false | 15,627 | [
"MIT"
] | 147 | dca252cae50a18464ce2410aa85a21c557c72d7a | https://github.com/ishine/Comprehensive-Transformer-TTS/tree/dca252cae50a18464ce2410aa85a21c557c72d7a |
GeGLU | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torch.nn import functional as F
class GeGLU(torch.nn.Module):
def __init__(self, config, layer_id, time_shift=False):
super().__init__()
self.layer_id = layer_id
if time_shift:
self.time_shif... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | BlinkDL/RWKV-LM | GeGLU | false | 15,628 | [
"BSD-2-Clause"
] | 102 | b48aa1d430a71ced8ae6a665c47f5dbd95f6f6ab | https://github.com/BlinkDL/RWKV-LM/tree/b48aa1d430a71ced8ae6a665c47f5dbd95f6f6ab |
StyledResBlock | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | ishine/GANsNRoses | StyledResBlock | false | 15,629 | [
"MIT"
] | 969 | 414e9e77c3df47d4ecf7941b5dcfdffec67403ee | https://github.com/ishine/GANsNRoses/tree/414e9e77c3df47d4ecf7941b5dcfdffec67403ee |
FRM | import torch
import torch.nn as nn
import torch.nn.functional as F
class FRM(nn.Module):
def __init__(self, nb_dim, do_add=True, do_mul=True):
super(FRM, self).__init__()
self.fc = nn.Linear(nb_dim, nb_dim)
self.sig = nn.Sigmoid()
self.do_add = do_add
self.do_mul = do_mul
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ishine/RawNet | FRM | false | 15,630 | [
"MIT"
] | 199 | cddec5afa27049a4b507f3d48bb02b993ea838bb | https://github.com/ishine/RawNet/tree/cddec5afa27049a4b507f3d48bb02b993ea838bb |
ReCoNet | import torch
import numpy as np
class SelectiveLoadModule(torch.nn.Module):
"""Only load layers in trained models with the same name."""
def __init__(self):
super(SelectiveLoadModule, self).__init__()
def forward(self, x):
return x
def load_state_dict(self, state_dict):
"""O... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | irsisyphus/reconet | ReCoNet | false | 15,631 | [
"MIT"
] | 56 | 863acf8dde4d45c8521634af27878fe04f3b2e56 | https://github.com/irsisyphus/reconet/tree/863acf8dde4d45c8521634af27878fe04f3b2e56 |
AttDistance | import torch
import torch.nn.functional as F
class AttDistance(torch.nn.Module):
"""
AttDistance: Distance attention that can be used by the Alignment module.
"""
def __init__(self, dist_norm=1, weight_norm=1):
super().__init__()
self.dist_norm = dist_norm
self.weight_norm = w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | ishine/NISQA | AttDistance | false | 15,632 | [
"MIT"
] | 223 | 2c8917f30c4e4bbca3a48e9852301f1e2480a741 | https://github.com/ishine/NISQA/tree/2c8917f30c4e4bbca3a48e9852301f1e2480a741 |
AFMS | import torch
import torch.nn as nn
import torch.nn.functional as F
class AFMS(nn.Module):
"""
Alpha-Feature map scaling, added to the output of each residual block[1,2].
Reference:
[1] RawNet2 : https://www.isca-speech.org/archive/Interspeech_2020/pdfs/1011.pdf
[2] AMFS : https://www.koreascie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ishine/RawNet | AFMS | false | 15,633 | [
"MIT"
] | 199 | cddec5afa27049a4b507f3d48bb02b993ea838bb | https://github.com/ishine/RawNet/tree/cddec5afa27049a4b507f3d48bb02b993ea838bb |
ToRGB | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch.nn import functional as F
assert_siz... | ishine/GANsNRoses | ToRGB | false | 15,634 | [
"MIT"
] | 969 | 414e9e77c3df47d4ecf7941b5dcfdffec67403ee | https://github.com/ishine/GANsNRoses/tree/414e9e77c3df47d4ecf7941b5dcfdffec67403ee |
EmbedNet | from _paritybench_helpers import _mock_config
import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class EmbedNet(nn.Module):
def __init__(self, cfg):
super(EmbedNet, self).__init__()
self.embed_conv1 = nn.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.utils.data
from ... | hanranCode/mega.pytorch | EmbedNet | false | 15,635 | [
"BSD-2-Clause"
] | 521 | 28c8a184372aa57a942576a944b3526590bc1ace | https://github.com/hanranCode/mega.pytorch/tree/28c8a184372aa57a942576a944b3526590bc1ace |
TransitionModel | import torch
from torch import nn
def log_clamped(x, eps=0.0001):
clamped_x = torch.clamp(x, min=eps)
return torch.log(clamped_x)
def logsumexp(x, dim):
"""
Differentiable LogSumExp: Does not creates nan gradients when all the inputs are -inf
Args:
x : torch.Tensor - The 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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | ishine/Neural-HMM | TransitionModel | false | 15,636 | [
"MIT"
] | 66 | c0bc23ab88f831173d2d4db29a84503b80c5cdc4 | https://github.com/ishine/Neural-HMM/tree/c0bc23ab88f831173d2d4db29a84503b80c5cdc4 |
AttentiveStatsPool | import torch
import torch.nn
import torch.nn as nn
class AttentiveStatsPool(nn.Module):
def __init__(self, in_dim, bottleneck_dim):
super().__init__()
self.linear1 = nn.Conv1d(in_dim, bottleneck_dim, kernel_size=1)
self.linear2 = nn.Conv1d(bottleneck_dim, in_dim, kernel_size=1)
def f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/asv-subtools | AttentiveStatsPool | false | 15,637 | [
"Apache-2.0"
] | 370 | 597dcb29a772b8113dbe7ab64f0d4cc1da298707 | https://github.com/ishine/asv-subtools/tree/597dcb29a772b8113dbe7ab64f0d4cc1da298707 |
InResBlock | import math
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, down_y, pad_x0,
pad_x1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | ishine/GANsNRoses | InResBlock | false | 15,638 | [
"MIT"
] | 969 | 414e9e77c3df47d4ecf7941b5dcfdffec67403ee | https://github.com/ishine/GANsNRoses/tree/414e9e77c3df47d4ecf7941b5dcfdffec67403ee |
AttLuong | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttLuong(torch.nn.Module):
"""
AttLuong: Attention according to Luong that can be used by the
Alignment module.
"""
def __init__(self, q_dim, y_dim, softmax=True):
super().__init__()
self.q_dim = q_dim
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/NISQA | AttLuong | false | 15,639 | [
"MIT"
] | 223 | 2c8917f30c4e4bbca3a48e9852301f1e2480a741 | https://github.com/ishine/NISQA/tree/2c8917f30c4e4bbca3a48e9852301f1e2480a741 |
FinalLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNorm(nn.Module):
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(features))
self.beta = nn.Parameter(torch.zeros(features))
self.eps = 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 import triton_helpers
import torch.nn as nn
import ... | ishine/RPN_KWS | FinalLayer | false | 15,640 | [
"MIT"
] | 53 | b54d4010a701a6ec0a9ddf3ab6177a4be6dd6af5 | https://github.com/ishine/RPN_KWS/tree/b54d4010a701a6ec0a9ddf3ab6177a4be6dd6af5 |
BasicBlockWN | import torch
import torch as t
import torch.nn as nn
from abc import ABC
from torch.nn.utils.weight_norm import weight_norm
def conv1x1(in_planes, out_planes, stride=1):
"""
Create a 1x1 2d convolution block
"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride,
bias=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 import triton_helpers
from torch._inductor.runtime.... | iffiX/machin | BasicBlockWN | false | 15,641 | [
"MIT"
] | 287 | 7fa986b1bafdefff117d6ff73d14644a5488de9d | https://github.com/iffiX/machin/tree/7fa986b1bafdefff117d6ff73d14644a5488de9d |
normrelu | import torch
import torch.nn as nn
import torch.nn.functional as F
class normrelu(nn.Module):
def __init__(self):
super(normrelu, self).__init__()
def forward(self, x):
dim = 1
x = F.relu(x) / torch.max(x, dim, keepdim=True)[0]
return x
def get_inputs():
return [torch.r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ishine/RPN_KWS | normrelu | false | 15,642 | [
"MIT"
] | 53 | b54d4010a701a6ec0a9ddf3ab6177a4be6dd6af5 | https://github.com/ishine/RPN_KWS/tree/b54d4010a701a6ec0a9ddf3ab6177a4be6dd6af5 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""DiceLoss.
.. seealso::
Milletari, Fausto, Nassir Navab, and Seyed-Ahmad Ahmadi. "V-net: Fully convolutional neural networks for
volumetric medical image segmentation." 2016 fourth international conference on 3D vision (3DV). IEE... | 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... | ivadomed-profile-analysis-project/ivadomed | DiceLoss | false | 15,643 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
SE_Connect | import torch
import torch.nn.functional as F
import torch.nn
import torch.nn as nn
class SE_Connect(nn.Module):
def __init__(self, channels, s=4):
super().__init__()
assert channels % s == 0, '{} % {} != 0'.format(channesl, s)
self.linear1 = nn.Linear(channels, channels // s)
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
import torch.... | ishine/asv-subtools | SE_Connect | false | 15,644 | [
"Apache-2.0"
] | 370 | 597dcb29a772b8113dbe7ab64f0d4cc1da298707 | https://github.com/ishine/asv-subtools/tree/597dcb29a772b8113dbe7ab64f0d4cc1da298707 |
LDEPooling | import torch
import torch.nn
class LDEPooling(torch.nn.Module):
"""A novel learnable dictionary encoding layer.
Reference: Weicheng Cai, etc., "A NOVEL LEARNABLE DICTIONARY ENCODING LAYER FOR END-TO-END
LANGUAGE IDENTIFICATION", icassp, 2018
"""
def __init__(self, input_dim, c_num=64,... | 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
assert... | ishine/asv-subtools | LDEPooling | false | 15,645 | [
"Apache-2.0"
] | 370 | 597dcb29a772b8113dbe7ab64f0d4cc1da298707 | https://github.com/ishine/asv-subtools/tree/597dcb29a772b8113dbe7ab64f0d4cc1da298707 |
TdnnAffine | import torch
import torch.nn.functional as F
import torch.nn
def to_device(device_object, tensor):
"""
Select device for non-parameters tensor w.r.t model or tensor which has been specified a device.
"""
if isinstance(device_object, torch.nn.Module):
next(device_object.parameters()).device
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
... | ishine/asv-subtools | TdnnAffine | false | 15,646 | [
"Apache-2.0"
] | 370 | 597dcb29a772b8113dbe7ab64f0d4cc1da298707 | https://github.com/ishine/asv-subtools/tree/597dcb29a772b8113dbe7ab64f0d4cc1da298707 |
AttCosine | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttCosine(torch.nn.Module):
"""
AttCosine: Cosine attention that can be used by the Alignment module.
"""
def __init__(self, softmax=True):
super().__init__()
self.softmax = softmax
self.pdist = nn.Cosine... | 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... | ishine/NISQA | AttCosine | false | 15,647 | [
"MIT"
] | 223 | 2c8917f30c4e4bbca3a48e9852301f1e2480a741 | https://github.com/ishine/NISQA/tree/2c8917f30c4e4bbca3a48e9852301f1e2480a741 |
ChunkSeparationAffine | import torch
import torch.nn.functional as F
import torch.nn
def to_device(device_object, tensor):
"""
Select device for non-parameters tensor w.r.t model or tensor which has been specified a device.
"""
if isinstance(device_object, torch.nn.Module):
next(device_object.parameters()).device
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional as F
import torch.nn
assert_size_stride = torch._C._d... | ishine/asv-subtools | ChunkSeparationAffine | false | 15,648 | [
"Apache-2.0"
] | 370 | 597dcb29a772b8113dbe7ab64f0d4cc1da298707 | https://github.com/ishine/asv-subtools/tree/597dcb29a772b8113dbe7ab64f0d4cc1da298707 |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
"""FocalLoss.
.. seealso::
Lin, Tsung-Yi, et al. "Focal loss for dense object detection."
Proceedings of the IEEE international conference on computer vision. 2017.
Args:
gamma (float): Value from 0 to 5, Control betw... | 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
... | ivadomed-profile-analysis-project/ivadomed | FocalLoss | false | 15,649 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
L2loss | import torch
import torch.nn as nn
class L2loss(nn.Module):
"""
Euclidean loss also known as L2 loss. Compute the sum of the squared difference between the two images.
"""
def __init__(self):
super(L2loss, self).__init__()
def forward(self, input, target):
return torch.sum((input... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ivadomed-profile-analysis-project/ivadomed | L2loss | false | 15,650 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
SoftmaxAffineLayer | import torch
import torch.nn.functional as F
import torch.nn
def to_device(device_object, tensor):
"""
Select device for non-parameters tensor w.r.t model or tensor which has been specified a device.
"""
if isinstance(device_object, torch.nn.Module):
next(device_object.parameters()).device
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ishine/asv-subtools | SoftmaxAffineLayer | false | 15,651 | [
"Apache-2.0"
] | 370 | 597dcb29a772b8113dbe7ab64f0d4cc1da298707 | https://github.com/ishine/asv-subtools/tree/597dcb29a772b8113dbe7ab64f0d4cc1da298707 |
TverskyLoss | import torch
import torch.nn as nn
class TverskyLoss(nn.Module):
"""Tversky Loss.
.. seealso::
Salehi, Seyed Sadegh Mohseni, Deniz Erdogmus, and Ali Gholipour. "Tversky loss function for image segmentation
using 3D fully convolutional deep networks." International Workshop on Machine Learning... | 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... | ivadomed-profile-analysis-project/ivadomed | TverskyLoss | false | 15,652 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
MultiClassDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""DiceLoss.
.. seealso::
Milletari, Fausto, Nassir Navab, and Seyed-Ahmad Ahmadi. "V-net: Fully convolutional neural networks for
volumetric medical image segmentation." 2016 fourth international conference on 3D vision (3DV). IEE... | 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... | ivadomed-profile-analysis-project/ivadomed | MultiClassDiceLoss | false | 15,653 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
LinearGLUBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class LinearGLUBlock(nn.Module):
"""A linear GLU block.
Args:
idim (int): input and output dimension
"""
def __init__(self, idim):
super().__init__()
self.fc = nn.Linear(idim, idim * 2)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ishine/neural_sp | LinearGLUBlock | false | 15,654 | [
"Apache-2.0"
] | 577 | 7995613541d994976b00d80dcc12e2835163acfb | https://github.com/ishine/neural_sp/tree/7995613541d994976b00d80dcc12e2835163acfb |
LayerNorm2D | import torch
import torch.nn as nn
class LayerNorm2D(nn.Module):
"""Layer normalization for CNN outputs."""
def __init__(self, channel, idim, eps=1e-12):
super(LayerNorm2D, self).__init__()
self.norm = nn.LayerNorm([channel, idim], eps=eps)
def forward(self, xs):
"""Forward pass.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ishine/neural_sp | LayerNorm2D | false | 15,655 | [
"Apache-2.0"
] | 577 | 7995613541d994976b00d80dcc12e2835163acfb | https://github.com/ishine/neural_sp/tree/7995613541d994976b00d80dcc12e2835163acfb |
FocalDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""DiceLoss.
.. seealso::
Milletari, Fausto, Nassir Navab, and Seyed-Ahmad Ahmadi. "V-net: Fully convolutional neural networks for
volumetric medical image segmentation." 2016 fourth international conference on 3D vision (3DV). IEE... | 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
... | ivadomed-profile-analysis-project/ivadomed | FocalDiceLoss | false | 15,656 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
AttBahdanau | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttBahdanau(torch.nn.Module):
"""
AttBahdanau: Attention according to Bahdanau that can be used by the
Alignment module.
"""
def __init__(self, q_dim, y_dim, att_dim=128):
super().__init__()
self.q_dim = q_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.... | ishine/NISQA | AttBahdanau | false | 15,657 | [
"MIT"
] | 223 | 2c8917f30c4e4bbca3a48e9852301f1e2480a741 | https://github.com/ishine/NISQA/tree/2c8917f30c4e4bbca3a48e9852301f1e2480a741 |
compute_transform_losses | import torch
import torch.nn as nn
import torch.nn.functional as F
def _gather_feat(feat, ind, mask=None):
dim = feat.size(2)
ind = ind.unsqueeze(2).expand(ind.size(0), ind.size(1), dim)
feat = feat.gather(1, ind)
if mask is not None:
mask = mask.unsqueeze(2).expand_as(feat)
feat = fea... | 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
... | jaidevshriram/cross-view | compute_transform_losses | false | 15,658 | [
"MIT"
] | 75 | 844b4ded335e31fe3144adb412792221703d5246 | https://github.com/jaidevshriram/cross-view/tree/844b4ded335e31fe3144adb412792221703d5246 |
FocalTverskyLoss | import torch
import torch.nn as nn
class TverskyLoss(nn.Module):
"""Tversky Loss.
.. seealso::
Salehi, Seyed Sadegh Mohseni, Deniz Erdogmus, and Ali Gholipour. "Tversky loss function for image segmentation
using 3D fully convolutional deep networks." International Workshop on Machine Learning... | 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_... | ivadomed-profile-analysis-project/ivadomed | FocalTverskyLoss | false | 15,659 | [
"MIT"
] | 87 | 3b53e2cb2b210511943da439401e2471fd387876 | https://github.com/ivadomed-profile-analysis-project/ivadomed/tree/3b53e2cb2b210511943da439401e2471fd387876 |
BertImagePooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertImagePooler(nn.Module):
def __init__(self, config):
super(BertImagePooler, self).__init__()
self.dense = nn.Linear(config.v_hidden_size, config.bi_hidden_size)
self.activation = nn.ReLU()
def f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BigRedT/gpv-1 | BertImagePooler | false | 15,660 | [
"Apache-2.0"
] | 45 | 6a0c2173b44961cb492d00f94864c461aa77641d | https://github.com/BigRedT/gpv-1/tree/6a0c2173b44961cb492d00f94864c461aa77641d |
AdditiveAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdditiveAttention(nn.Module):
def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim,
internal_dim=None):
super(AdditiveAttention, self).__init__()
if internal_dim is None:
internal_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
from torch._inductor.runtime.... | j-scharrenbach/Trajectron-plus-plus | AdditiveAttention | false | 15,661 | [
"MIT"
] | 361 | 37040ca6e3f386c80ab39fbb4aa9984915c94813 | https://github.com/j-scharrenbach/Trajectron-plus-plus/tree/37040ca6e3f386c80ab39fbb4aa9984915c94813 |
TemporallyBatchedAdditiveAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdditiveAttention(nn.Module):
def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim,
internal_dim=None):
super(AdditiveAttention, self).__init__()
if internal_dim is None:
internal_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
from torch._inductor.runtime.... | j-scharrenbach/Trajectron-plus-plus | TemporallyBatchedAdditiveAttention | false | 15,662 | [
"MIT"
] | 361 | 37040ca6e3f386c80ab39fbb4aa9984915c94813 | https://github.com/j-scharrenbach/Trajectron-plus-plus/tree/37040ca6e3f386c80ab39fbb4aa9984915c94813 |
SeqToSeqAtten | import torch
import torch.utils.data
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim=True)[0])
if m is not None:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jamaalhay/Final_Proj | SeqToSeqAtten | false | 15,663 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
ConvModule | import torch
import torch.utils.data.distributed
from torch import nn
import torch.utils.data
class ConvModule(nn.Module):
def __init__(self, input_dim, kernel_size, dropout_rate, causal=False):
super(ConvModule, self).__init__()
self.layer_norm = nn.LayerNorm(input_dim)
self.pw_conv_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.... | ishine/StreamingTransformer | ConvModule | false | 15,664 | [
"Apache-2.0"
] | 252 | 4b56931a311d65686d310c54cc6896a4be4f47de | https://github.com/ishine/StreamingTransformer/tree/4b56931a311d65686d310c54cc6896a4be4f47de |
PointerAttention | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jamaalhay/Final_Proj | PointerAttention | false | 15,665 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
SelfGated | import torch
import torch.utils.data
import torch.nn.functional as F
class SelfGated(torch.nn.Module):
"""
Self-Gated layer. math: \\sigmoid(W*x) * x
"""
def __init__(self, input_size):
super(SelfGated, self).__init__()
self.linear_g = torch.nn.Linear(input_size, input_size)
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size... | jamaalhay/Final_Proj | SelfGated | false | 15,666 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
SFU | import torch
import torch.utils.data
import torch.nn.functional as F
class SFU(torch.nn.Module):
"""
only two input, one input vector and one fusion vector
Args:
- input_size:
- fusions_size:
Inputs:
- input: (seq_len, batch, input_size)
- fusions: (seq_len, batch, fus... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.utils.... | jamaalhay/Final_Proj | SFU | false | 15,667 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
AttentionPooling | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jamaalhay/Final_Proj | AttentionPooling | false | 15,668 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
SegmentationHead | import torch
import torch.nn as nn
import torch.utils.data.dataloader
class SegmentationHead(nn.Module):
def __init__(self, descriptor_dimension, num_classes, **kwargs):
super().__init__()
self.descriptor_dimension = descriptor_dimension
self.classifier = nn.Conv2d(in_channels=descriptor_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.dataloader
assert_size_stride = to... | jamt9000/DVE | SegmentationHead | false | 15,669 | [
"MIT"
] | 72 | 208514419dd1eb0d27ce60876ca836d1ab8c4f4a | https://github.com/jamt9000/DVE/tree/208514419dd1eb0d27ce60876ca836d1ab8c4f4a |
MedianPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.modules.utils import _quadruple
import torch.optim
class MedianPool2d(nn.Module):
""" Median pool (usable as median filter when stride=1) module.
Args:
kernel_size: size of pooli... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
from torch.nn.modules.utils import _pair
from torch... | jammer345/3DGNN_pytorch | MedianPool2d | false | 15,670 | [
"MIT"
] | 231 | 34a5b3890f23e03fa6cc316c79498eeaea635664 | https://github.com/jammer345/3DGNN_pytorch/tree/34a5b3890f23e03fa6cc316c79498eeaea635664 |
ForwardNet | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jamaalhay/Final_Proj | ForwardNet | false | 15,671 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
SelfAttentionGated | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jamaalhay/Final_Proj | SelfAttentionGated | false | 15,672 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
MatchRNNAttention | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jamaalhay/Final_Proj | MatchRNNAttention | false | 15,673 | [
"MIT"
] | 104 | 3f524a90fee5a3cb21466ab76f630d060792045d | https://github.com/jamaalhay/Final_Proj/tree/3f524a90fee5a3cb21466ab76f630d060792045d |
Classifier | import torch
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
import torch.distributed
class Classifier(nn.Module):
def __init__(self, hidden_size):
super(Classifier, self).__init__()
self.linear1 = nn.Linear(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
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import... | jantrienes/guided_summarization | Classifier | false | 15,674 | [
"MIT"
] | 65 | 547beee09ba6e9158f2681279131f9b5d7ed31ab | https://github.com/jantrienes/guided_summarization/tree/547beee09ba6e9158f2681279131f9b5d7ed31ab |
TactileWeightModel | import torch
import torch.utils.data
import torch.nn as nn
from typing import Optional
import torch.linalg
class TactileWeightModel(nn.Module):
def __init__(self, device: 'torch.device', dim: 'int'=3, wt_init:
'Optional[torch.Tensor]'=None):
super().__init__()
wt_init_ = torch.rand(1, dim... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
from typing import Optional
import torch.linalg
assert_size_stride = torch._C._dynamo.guards.a... | jeffin07/theseus | TactileWeightModel | false | 15,676 | [
"MIT"
] | 236 | 3498bbddf9cca740c2703d0c1aa3a78a7264cb15 | https://github.com/jeffin07/theseus/tree/3498bbddf9cca740c2703d0c1aa3a78a7264cb15 |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, 128)
self.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._inductor.runtime.triton_helpers import libdevice
from torch import n... | HebatallaTarek/Empathy-Mental-Health | RobertaClassificationHead | false | 15,677 | [
"BSD-3-Clause"
] | 66 | 16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 | https://github.com/HebatallaTarek/Empathy-Mental-Health/tree/16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 |
UpBlock | import torch
import torch.nn as nn
from torch.nn import functional as F
class UpBlock(nn.Module):
"""Upsample block for DRRG and TextSnake."""
def __init__(self, in_channels, out_channels):
super().__init__()
assert isinstance(in_channels, int)
assert isinstance(out_channels, int)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | jeffreykuang/mmocr-1 | UpBlock | false | 15,678 | [
"Apache-2.0"
] | 206 | b17304edeb493b0a4d7224c23d23b952350d0db5 | https://github.com/jeffreykuang/mmocr-1/tree/b17304edeb493b0a4d7224c23d23b952350d0db5 |
RobustScannerFusionLayer | import torch
import torch.nn as nn
class RobustScannerFusionLayer(nn.Module):
def __init__(self, dim_model, dim=-1):
super().__init__()
self.dim_model = dim_model
self.dim = dim
self.linear_layer = nn.Linear(dim_model * 2, dim_model * 2)
self.glu_layer = nn.GLU(dim=dim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | jeffreykuang/mmocr-1 | RobustScannerFusionLayer | false | 15,679 | [
"Apache-2.0"
] | 206 | b17304edeb493b0a4d7224c23d23b952350d0db5 | https://github.com/jeffreykuang/mmocr-1/tree/b17304edeb493b0a4d7224c23d23b952350d0db5 |
injective_pad | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class injective_pad(nn.Module):
def __init__(self, pad_size):
super(injective_pad, self).__init__()
self.pad_size = pad_size
self.pad = nn.ZeroPad2d((... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
assert_size_st... | jhjacobsen/pytorch-i-revnet | injective_pad | false | 15,680 | [
"MIT"
] | 392 | 307413043e33540cbe9c3746ef420261f8138315 | https://github.com/jhjacobsen/pytorch-i-revnet/tree/307413043e33540cbe9c3746ef420261f8138315 |
MeanMaxPooling | import torch
from torch import nn
class MeanMaxPooling(nn.Module):
def __init__(self):
super(MeanMaxPooling, self).__init__()
def forward(self, doc_state, entity_mapping, entity_lens):
"""
:param doc_state: N x L x d
:param entity_mapping: N x E x L
:param entity_le... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | jennybae1024/DFGN-pytorch | MeanMaxPooling | false | 15,681 | [
"MIT"
] | 191 | 056d9317f772cd10bdd215bfafdbac5cbd330026 | https://github.com/jennybae1024/DFGN-pytorch/tree/056d9317f772cd10bdd215bfafdbac5cbd330026 |
EmbeddingModel | import torch
class EmbeddingModel(torch.nn.Module):
@staticmethod
def forward(inputs):
return inputs.repeat(1, 10)
def get_inputs():
return [torch.rand([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... | jina-ai/finetuner | EmbeddingModel | false | 15,682 | [
"Apache-2.0"
] | 270 | 6b8701c6ca372310364e6791c1c2761700dfc150 | https://github.com/jina-ai/finetuner/tree/6b8701c6ca372310364e6791c1c2761700dfc150 |
MeanPooling | import torch
from torch import nn
class MeanPooling(nn.Module):
def __init__(self):
super(MeanPooling, self).__init__()
def forward(self, doc_state, entity_mapping, entity_lens):
entity_states = entity_mapping.unsqueeze(3) * doc_state.unsqueeze(1)
mean_pooled = torch.sum(entity_state... | 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... | jennybae1024/DFGN-pytorch | MeanPooling | false | 15,683 | [
"MIT"
] | 191 | 056d9317f772cd10bdd215bfafdbac5cbd330026 | https://github.com/jennybae1024/DFGN-pytorch/tree/056d9317f772cd10bdd215bfafdbac5cbd330026 |
DataProcessor | import torch
import torch.nn as nn
class DataProcessor(nn.Module):
def __init__(self):
super(DataProcessor, self).__init__()
self.pool = nn.AdaptiveAvgPool2d((7, 7))
def forward(self, x):
x = self.pool(x)
x = torch.squeeze(x)
x = x.permute(1, 2, 0)
return x.vi... | 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... | jianqingxie/RSTNet | DataProcessor | false | 15,684 | [
"BSD-3-Clause"
] | 68 | aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be | https://github.com/jianqingxie/RSTNet/tree/aaa7b5be08e5ec9e79e14ed3e6a04fc3d50483be |
AddcmulTestModule | import torch
class AddcmulTestModule(torch.nn.Module):
def __init__(self, value):
super(AddcmulTestModule, self).__init__()
self.value = value
def forward(self, x, y, z):
return torch.addcmul(x, self.value, y, z)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | jinfagang/torch2trt_dynamic | AddcmulTestModule | false | 15,685 | [
"MIT"
] | 155 | fad7a7845f13cb59c05de25fcb83e7591acb492c | https://github.com/jinfagang/torch2trt_dynamic/tree/fad7a7845f13cb59c05de25fcb83e7591acb492c |
HLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class HLoss(nn.Module):
def __init__(self):
super(HLoss, self).__init__()
def forward(self, x):
b = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
b =... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | jfc43/robust-ood-detection | HLoss | false | 15,686 | [
"Apache-2.0"
] | 55 | fbeb63017f44b16b2911e61a1f7b7982a2621ee5 | https://github.com/jfc43/robust-ood-detection/tree/fbeb63017f44b16b2911e61a1f7b7982a2621ee5 |
CoFusion | import torch
import torch.nn.functional as F
import torch.nn as nn
class CoFusion(nn.Module):
def __init__(self, in_ch, out_ch):
super(CoFusion, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 64, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jechague/DexiNed | CoFusion | false | 15,687 | [
"MIT"
] | 471 | 370fe9031579b2d815ab706d7dc9daf23b969a87 | https://github.com/jechague/DexiNed/tree/370fe9031579b2d815ab706d7dc9daf23b969a87 |
LBM | import torch
import torch.nn as nn
class LBM(nn.Module):
def __init__(self, l_dim, r_dim):
super(LBM, self).__init__()
self.W = nn.Bilinear(l_dim, r_dim, 1, bias=False)
def forward(self, e1, e2):
"""
e1: tensor of size (*, l_dim)
e2: tensor of size (*, r_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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | jinfenglin/TaxoExpan | LBM | false | 15,688 | [
"Apache-2.0"
] | 55 | 86bd3f805508d03367539f2fdd43889fc0a4f6b2 | https://github.com/jinfenglin/TaxoExpan/tree/86bd3f805508d03367539f2fdd43889fc0a4f6b2 |
ReCoNetMin | import torch
import numpy as np
class SelectiveLoadModule(torch.nn.Module):
"""Only load layers in trained models with the same name."""
def __init__(self):
super(SelectiveLoadModule, self).__init__()
def forward(self, x):
return x
def load_state_dict(self, state_dict):
"""O... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | irsisyphus/reconet | ReCoNetMin | false | 15,689 | [
"MIT"
] | 56 | 863acf8dde4d45c8521634af27878fe04f3b2e56 | https://github.com/irsisyphus/reconet/tree/863acf8dde4d45c8521634af27878fe04f3b2e56 |
ReCoNet2 | import torch
import numpy as np
class SelectiveLoadModule(torch.nn.Module):
"""Only load layers in trained models with the same name."""
def __init__(self):
super(SelectiveLoadModule, self).__init__()
def forward(self, x):
return x
def load_state_dict(self, state_dict):
"""O... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | irsisyphus/reconet | ReCoNet2 | false | 15,690 | [
"MIT"
] | 56 | 863acf8dde4d45c8521634af27878fe04f3b2e56 | https://github.com/irsisyphus/reconet/tree/863acf8dde4d45c8521634af27878fe04f3b2e56 |
Normalize | import torch
import torch.nn as nn
class Normalize(nn.Module):
def __init__(self, features, epsilon=1e-06):
super(Normalize, self).__init__()
self.gain = nn.Parameter(torch.ones(features))
self.bias = nn.Parameter(torch.zeros(features))
self.epsilon = epsilon
def forward(self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | jingraham/struct2seq | Normalize | false | 15,691 | [
"MIT"
] | 106 | 22e497a2b565fe82f17e12ea37e89dcf4e50e92f | https://github.com/jingraham/struct2seq/tree/22e497a2b565fe82f17e12ea37e89dcf4e50e92f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.