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 |
|---|---|---|---|---|---|---|---|---|---|---|
Glu | import torch
import torch.nn as nn
class Glu(nn.Module):
def __init__(self, dim):
super(Glu, self).__init__()
self.dim = dim
def forward(self, x):
x_in, x_gate = x.chunk(2, dim=self.dim)
return x_in * x_gate.sigmoid()
def get_inputs():
return [torch.rand([4, 4, 4, 4, 4]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | debasish-mihup/EfficientConformer | Glu | false | 10,335 | [
"Apache-2.0"
] | 0 | bddd927cebcde044a999aaa7766fa6d44dc20576 | https://github.com/debasish-mihup/EfficientConformer/tree/bddd927cebcde044a999aaa7766fa6d44dc20576 |
WeightNet | import torch
import torch.nn as nn
class WeightNet(nn.Module):
"""WeightNet in Temporal interlace module.
The WeightNet consists of two parts: one convolution layer
and a sigmoid function. Following the convolution layer, the sigmoid
function and rescale module can scale our output to the range (0, 2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | giahaowjx/mmaction2 | WeightNet | false | 10,336 | [
"Apache-2.0"
] | 0 | 4f95e9b91354acdcae768ce94e01d3821bba0154 | https://github.com/giahaowjx/mmaction2/tree/4f95e9b91354acdcae768ce94e01d3821bba0154 |
UpscaleBlock | import math
import torch
import torch.jit
import torch.nn as nn
import torch.nn.init as init
import torch.onnx
def _initialize_orthogonal(conv):
prelu_gain = math.sqrt(2)
init.orthogonal(conv.weight, gain=prelu_gain)
if conv.bias is not None:
conv.bias.data.zero_()
class UpscaleBlock(nn.Module):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.jit
import torch.nn as nn
import torch.nn.init as init
... | jamesr66a/onnx-fb-universe | UpscaleBlock | false | 10,337 | [
"MIT"
] | 0 | 3c0d1ea06d90c3788c47c0d32d160499afabe2fb | https://github.com/jamesr66a/onnx-fb-universe/tree/3c0d1ea06d90c3788c47c0d32d160499afabe2fb |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
from torch import nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimens... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jmhessel/meshed-memory-transformer | MultiHeadAttention | false | 10,338 | [
"BSD-3-Clause"
] | 0 | b502da2522f2e25d602fba547ed6ebf7968857a9 | https://github.com/jmhessel/meshed-memory-transformer/tree/b502da2522f2e25d602fba547ed6ebf7968857a9 |
BMNLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def binary_logistic_regression_loss(reg_score, label, threshold=0.5,
ratio_range=(1.05, 21), eps=1e-05):
"""Binary Logistic Regression Loss."""
label = label.view(-1)
reg_score = reg_score.contiguous().view(-1)
pmask = (label > thr... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_ma... | giahaowjx/mmaction2 | BMNLoss | false | 10,339 | [
"Apache-2.0"
] | 0 | 4f95e9b91354acdcae768ce94e01d3821bba0154 | https://github.com/giahaowjx/mmaction2/tree/4f95e9b91354acdcae768ce94e01d3821bba0154 |
ResidualAttentionBlock | import torch
from torch import nn
import torch.utils.checkpoint
from collections import OrderedDict
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(LayerNorm, 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.... | jiazheng-xing/Swin_Multimodal | ResidualAttentionBlock | false | 10,340 | [
"MIT"
] | 0 | 7bc41977fe7d8d4f0091852c63a6a32a0fada0fb | https://github.com/jiazheng-xing/Swin_Multimodal/tree/7bc41977fe7d8d4f0091852c63a6a32a0fada0fb |
VideoAttText | import torch
from torch import nn
import torch.utils.checkpoint
from collections import OrderedDict
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(LayerNorm, 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.... | jiazheng-xing/Swin_Multimodal | VideoAttText | false | 10,341 | [
"MIT"
] | 0 | 7bc41977fe7d8d4f0091852c63a6a32a0fada0fb | https://github.com/jiazheng-xing/Swin_Multimodal/tree/7bc41977fe7d8d4f0091852c63a6a32a0fada0fb |
Word2Vec | import torch
from torch import nn
import torch.functional as F
import torch.nn.functional as F
class Word2Vec(torch.nn.Module):
def __init__(self, vocab_size, embedding_size=300):
super(Word2Vec, self).__init__()
self.E = nn.Linear(vocab_size, embedding_size, bias=False)
self.W = nn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | kfaRabi/NNTI-WS2021-NLP-Project | Word2Vec | false | 10,342 | [
"MIT"
] | 0 | 9b0d28e64e3abc373e88265e47a4be4503d59a93 | https://github.com/kfaRabi/NNTI-WS2021-NLP-Project/tree/9b0d28e64e3abc373e88265e47a4be4503d59a93 |
GroupedMultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Linear):
def __init__(self, in_features, out_features, bias=True):
super(Linear, self).__init__(in_features=in_features, out_features=
out_features, bias=bias)
self.noise = None
self.vn_std = No... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | debasish-mihup/EfficientConformer | GroupedMultiHeadAttention | false | 10,343 | [
"Apache-2.0"
] | 0 | bddd927cebcde044a999aaa7766fa6d44dc20576 | https://github.com/debasish-mihup/EfficientConformer/tree/bddd927cebcde044a999aaa7766fa6d44dc20576 |
Conv1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv1d(nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding='same', dilation=1, groups=1, bias=True):
super(Conv1d, self).__init__(in_channels=in_channels, out_channels=
out_ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | debasish-mihup/EfficientConformer | Conv1d | false | 10,344 | [
"Apache-2.0"
] | 0 | bddd927cebcde044a999aaa7766fa6d44dc20576 | https://github.com/debasish-mihup/EfficientConformer/tree/bddd927cebcde044a999aaa7766fa6d44dc20576 |
InnerProductLayer | import torch
import torch.nn as nn
from sklearn.metrics import *
import torch.onnx
import torch as torch
class InnerProductLayer(nn.Module):
"""InnerProduct Layer used in PNN that compute the element-wise
product or inner product between feature vectors.
Input shape
- a list of 3D tensor with sh... | 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 sklearn.metrics import *
import torch.onnx
import torch as torch
assert_size_stride = torch._C._dynamo.guards.ass... | dulvqingyunLT/DeepCTR-Torch | InnerProductLayer | false | 10,345 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
SequenceBias | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from torch.nn.parameter import Parameter
class SequenceBias(nn.Module):
""" Adds one bias element to the end of the sequence
Args:
embed_dim: Embedding dimension
Shape:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from torch.nn.parameter import Pa... | jyhong836/pytorch-dp | SequenceBias | false | 10,346 | [
"Apache-2.0"
] | 0 | e050b98d630d4db50cacc4fff82575daf345f012 | https://github.com/jyhong836/pytorch-dp/tree/e050b98d630d4db50cacc4fff82575daf345f012 |
AGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
import torch.onnx
import torch as torch
class AGRUCell(nn.Module):
""" Attention based GRU (AGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arX... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dulvqingyunLT/DeepCTR-Torch | AGRUCell | false | 10,347 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
NoiseInjection | import torch
from torch import nn
class NoiseInjection(nn.Module):
def __init__(self, channel):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1, channel, 1, 1))
def forward(self, image, noise):
return image + self.weight * noise
def get_inputs():
return [torch.rand(... | 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... | jeromepl/style-based-gan-pytorch | NoiseInjection | false | 10,348 | [
"MIT"
] | 0 | 97c13e54316dc57a7cb44c0cb910c29aaed11738 | https://github.com/jeromepl/style-based-gan-pytorch/tree/97c13e54316dc57a7cb44c0cb910c29aaed11738 |
MultiHeadLinearAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Linear):
def __init__(self, in_features, out_features, bias=True):
super(Linear, self).__init__(in_features=in_features, out_features=
out_features, bias=bias)
self.noise = None
self.vn_std = No... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | debasish-mihup/EfficientConformer | MultiHeadLinearAttention | false | 10,349 | [
"Apache-2.0"
] | 0 | bddd927cebcde044a999aaa7766fa6d44dc20576 | https://github.com/debasish-mihup/EfficientConformer/tree/bddd927cebcde044a999aaa7766fa6d44dc20576 |
AdaptiveInstanceNorm | import torch
from torch import nn
from math import sqrt
def equal_lr(module, name='weight'):
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
weight = getattr(module, self.name + '_orig')
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.triton_helpers import libdevice
from torch import n... | jeromepl/style-based-gan-pytorch | AdaptiveInstanceNorm | false | 10,350 | [
"MIT"
] | 0 | 97c13e54316dc57a7cb44c0cb910c29aaed11738 | https://github.com/jeromepl/style-based-gan-pytorch/tree/97c13e54316dc57a7cb44c0cb910c29aaed11738 |
ATT | import torch
import torch.nn as nn
import torch.nn.functional as F
class ATT(nn.Module):
def __init__(self, din):
super(ATT, self).__init__()
self.fc1 = nn.Linear(din, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, 1)
def forward(self, x):
y = F.relu(self.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_... | jungwoohan72/DGN_pytorch | ATT | false | 10,351 | [
"MIT"
] | 0 | 65fe7ab4df661d97725f2a72a1fdb49df1b2ea44 | https://github.com/jungwoohan72/DGN_pytorch/tree/65fe7ab4df661d97725f2a72a1fdb49df1b2ea44 |
LocalMultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Linear):
def __init__(self, in_features, out_features, bias=True):
super(Linear, self).__init__(in_features=in_features, out_features=
out_features, bias=bias)
self.noise = None
self.vn_std = No... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | debasish-mihup/EfficientConformer | LocalMultiHeadAttention | false | 10,352 | [
"Apache-2.0"
] | 0 | bddd927cebcde044a999aaa7766fa6d44dc20576 | https://github.com/debasish-mihup/EfficientConformer/tree/bddd927cebcde044a999aaa7766fa6d44dc20576 |
MLPTanH | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class MLPTanH(nn.Module):
def __init__(self, input_dim, hidden_dim, vocab_size):
super(MLPTanH, self).__init__()
self.input_dim = input_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.triton_helpers import libdevice
import torch.nn as ... | kiathwe97/examples | MLPTanH | false | 10,353 | [
"BSD-3-Clause"
] | 0 | b4a8792023db8c50c7e9fb186bd982edd0dce3ce | https://github.com/kiathwe97/examples/tree/b4a8792023db8c50c7e9fb186bd982edd0dce3ce |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, num_inputs, num_actions):
super(Critic, self).__init__()
self.fc1 = nn.Linear(num_inputs, 100)
self.state_value = nn.Linear(100, 1)
def forward(self, x):
x = torch.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_... | kama1kant/rl-autonomous-driving | Critic | false | 10,354 | [
"MIT"
] | 0 | 8f8687ff81892874a32c6a556c6be2e686012731 | https://github.com/kama1kant/rl-autonomous-driving/tree/8f8687ff81892874a32c6a556c6be2e686012731 |
CustomGruCell | import torch
import numpy as np
from torch import nn
class CustomGruCell(nn.Module):
"""
A forward only GRU cell.
Input should be: (sequence length x batch size x input_size).
The output is the output of the final forward call.
It's not clear if it would be possible to use the output from each cel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | kouohhashi/PySyft | CustomGruCell | false | 10,355 | [
"Apache-2.0"
] | 0 | 7415961b459f1d25f762467b346b7b94c1d6943f | https://github.com/kouohhashi/PySyft/tree/7415961b459f1d25f762467b346b7b94c1d6943f |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, num_inputs, num_actions):
super(Actor, self).__init__()
self.fc1 = nn.Linear(num_inputs, 100)
self.action_head = nn.Linear(100, num_actions)
def forward(self, x):
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.... | kama1kant/rl-autonomous-driving | Actor | false | 10,356 | [
"MIT"
] | 0 | 8f8687ff81892874a32c6a556c6be2e686012731 | https://github.com/kama1kant/rl-autonomous-driving/tree/8f8687ff81892874a32c6a556c6be2e686012731 |
AttModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttModel(nn.Module):
def __init__(self, n_node, din, hidden_dim, dout):
super(AttModel, self).__init__()
self.fcv = nn.Linear(din, hidden_dim)
self.fck = nn.Linear(din, hidden_dim)
self.fcq = nn.Linear(din, h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jungwoohan72/DGN_pytorch | AttModel | false | 10,357 | [
"MIT"
] | 0 | 65fe7ab4df661d97725f2a72a1fdb49df1b2ea44 | https://github.com/jungwoohan72/DGN_pytorch/tree/65fe7ab4df661d97725f2a72a1fdb49df1b2ea44 |
Downsample | import torch
import torch.nn as nn
import torch.nn.parallel
class Downsample(nn.Module):
"""
Image to Patch Embedding, downsampling between stage1 and stage2
"""
def __init__(self, in_embed_dim, out_embed_dim, patch_size):
super().__init__()
self.proj = nn.Conv2d(in_embed_dim, out_emb... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dy... | javierrodenas/clearml_javi | Downsample | false | 10,358 | [
"Apache-2.0"
] | 0 | b6326104fe6a6f522223c2ac3d87468990a9e6f2 | https://github.com/javierrodenas/clearml_javi/tree/b6326104fe6a6f522223c2ac3d87468990a9e6f2 |
BiInteractionPooling | import torch
import torch.nn as nn
from sklearn.metrics import *
import torch.onnx
import torch as torch
class BiInteractionPooling(nn.Module):
"""Bi-Interaction Layer used in Neural FM,compress the
pairwise element-wise product of features into one single vector.
Input shape
- A 3D tensor wit... | 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 sklearn.metrics import *
import torch.onnx
import torch as torch
assert_size_stride = torch._C._dynamo.guards.ass... | dulvqingyunLT/DeepCTR-Torch | BiInteractionPooling | false | 10,359 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
SoftTargetCrossEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class SoftTargetCrossEntropy(nn.Module):
"""
The native CE loss with soft target
input: x is output of model, target is ground truth
return: loss
"""
def __init__(self, weights):
super(SoftTarg... | 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
... | javierrodenas/clearml_javi | SoftTargetCrossEntropy | false | 10,360 | [
"Apache-2.0"
] | 0 | b6326104fe6a6f522223c2ac3d87468990a9e6f2 | https://github.com/javierrodenas/clearml_javi/tree/b6326104fe6a6f522223c2ac3d87468990a9e6f2 |
SqueezeAndExcitationModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
def forward(self, x):
return x * x.sigmoid()
class Conv1d(nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | debasish-mihup/EfficientConformer | SqueezeAndExcitationModule | false | 10,361 | [
"Apache-2.0"
] | 0 | bddd927cebcde044a999aaa7766fa6d44dc20576 | https://github.com/debasish-mihup/EfficientConformer/tree/bddd927cebcde044a999aaa7766fa6d44dc20576 |
DGN | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, din=32, hidden_dim=128):
super(Encoder, self).__init__()
self.fc = nn.Linear(din, hidden_dim)
def forward(self, x):
embedding = F.relu(self.fc(x))
return embedding
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jungwoohan72/DGN_pytorch | DGN | false | 10,362 | [
"MIT"
] | 0 | 65fe7ab4df661d97725f2a72a1fdb49df1b2ea44 | https://github.com/jungwoohan72/DGN_pytorch/tree/65fe7ab4df661d97725f2a72a1fdb49df1b2ea44 |
CircleLoss | import torch
from torch import Tensor
from torch import nn
class CircleLoss(nn.Module):
def __init__(self, m: 'float', gamma: 'float') ->None:
super(CircleLoss, self).__init__()
self.m = m
self.gamma = gamma
self.soft_plus = nn.Softplus()
def forward(self, sp: 'Tensor', sn: '... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | kagawa123/Person_reID_baseline_pytorch | CircleLoss | false | 10,363 | [
"MIT"
] | 0 | a503af2fa329406e97c5347bf3b13629ad0ffd10 | https://github.com/kagawa123/Person_reID_baseline_pytorch/tree/a503af2fa329406e97c5347bf3b13629ad0ffd10 |
PatchEmbed | import torch
import torch.nn as nn
import torch.nn.parallel
class PatchEmbed(nn.Module):
"""
Image to Patch Embedding.
Different with ViT use 1 conv layer, we use 4 conv layers to do patch embedding
"""
def __init__(self, img_size=224, stem_conv=False, stem_stride=1,
patch_size=8, in_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dy... | javierrodenas/clearml_javi | PatchEmbed | false | 10,364 | [
"Apache-2.0"
] | 0 | b6326104fe6a6f522223c2ac3d87468990a9e6f2 | https://github.com/javierrodenas/clearml_javi/tree/b6326104fe6a6f522223c2ac3d87468990a9e6f2 |
C3D | import logging
import torch
import torch.nn as nn
class C3D(nn.Module):
def __init__(self, pretrained=None, modality='RGB'):
super(C3D, self).__init__()
self.pretrained = pretrained
self.modality = modality
inplace = True
assert modality in ['RGB']
self.conv1a = 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 logging
import torch.n... | hushunda/mmaction | C3D | false | 10,365 | [
"Apache-2.0"
] | 0 | b599273ddb80fd74ecf51ef5fa0c81639ea723c5 | https://github.com/hushunda/mmaction/tree/b599273ddb80fd74ecf51ef5fa0c81639ea723c5 |
MeanStd | import torch
import torch.nn as nn
class MeanStd(nn.Module):
def __init__(self):
super(MeanStd, self).__init__()
def forward(self, x):
x = x.view(x.size(0), x.size(1), -1)
mean_x = torch.mean(x, dim=2)
var_x = torch.mean(x ** 2, dim=2) - mean_x * mean_x
return torch.c... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | jwen307/pytorch_GAN_zoo | MeanStd | false | 10,366 | [
"BSD-3-Clause"
] | 0 | b1e538a2f03fda42bd7a12872238b770ea5e0f23 | https://github.com/jwen307/pytorch_GAN_zoo/tree/b1e538a2f03fda42bd7a12872238b770ea5e0f23 |
InnerProductNetwork | import torch
import torch.utils.data
class InnerProductNetwork(torch.nn.Module):
def forward(self, x):
"""
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
"""
num_fields = x.shape[1]
row, col = list(), list()
for i in range(num_fields - 1):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | jqsl2012/pytorch-fm | InnerProductNetwork | false | 10,367 | [
"MIT"
] | 0 | de6240d0a17750303bbc97dba676b667c3a27829 | https://github.com/jqsl2012/pytorch-fm/tree/de6240d0a17750303bbc97dba676b667c3a27829 |
ConvNet | import torch
import torch.nn as nn
class ConvNet(nn.Module):
def __init__(self):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=
5, padding=2)
self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size
=3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | krishsethi19/dffml | ConvNet | false | 10,368 | [
"MIT"
] | 0 | 2dd0a9c4a125a9739d27228128bbd381a8e0fef4 | https://github.com/krishsethi19/dffml/tree/2dd0a9c4a125a9739d27228128bbd381a8e0fef4 |
learned_similarity_8 | import torch
import torch.nn as nn
class learned_similarity_8(nn.Module):
def __init__(self, in_size=1024):
super(learned_similarity_8, self).__init__()
self.lin = nn.Linear(1, 1)
self.lin2 = nn.Linear(1, 1)
self.tanh = nn.Tanh()
self.sigmoid = nn.Sigmoid()
def forwar... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | laurinwagner/grouploss_plus | learned_similarity_8 | false | 10,369 | [
"MIT"
] | 0 | add9e3e7b4fcfccf0393124aeb6e1f35a442ed88 | https://github.com/laurinwagner/grouploss_plus/tree/add9e3e7b4fcfccf0393124aeb6e1f35a442ed88 |
OutlookAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class OutlookAttention(nn.Module):
"""
Implementation of outlook attention
--dim: hidden dim
--num_heads: number of heads
--kernel_size: kernel size in each window for outlook attention
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | javierrodenas/clearml_javi | OutlookAttention | false | 10,370 | [
"Apache-2.0"
] | 0 | b6326104fe6a6f522223c2ac3d87468990a9e6f2 | https://github.com/javierrodenas/clearml_javi/tree/b6326104fe6a6f522223c2ac3d87468990a9e6f2 |
AdaIN | import math
import torch
import torch.nn as nn
from numpy import prod
def getLayerNormalizationFactor(x, gain, fromTF):
"""
Get He's constant for the given layer
https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf
"""
size = x.weight.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.... | jwen307/pytorch_GAN_zoo | AdaIN | false | 10,371 | [
"BSD-3-Clause"
] | 0 | b1e538a2f03fda42bd7a12872238b770ea5e0f23 | https://github.com/jwen307/pytorch_GAN_zoo/tree/b1e538a2f03fda42bd7a12872238b770ea5e0f23 |
Model | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.conv1 = nn.Conv2d(1, 60, kernel_size=5)
self.conv2 = nn.Conv2d(60, 60, kernel_size=5)
self.conv3 = nn.Conv2d(60... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | kproshakov/SudokuCV | Model | false | 10,372 | [
"MIT"
] | 0 | 8c29f4f1ac32513e7bd7d194d1fefb249c5d7921 | https://github.com/kproshakov/SudokuCV/tree/8c29f4f1ac32513e7bd7d194d1fefb249c5d7921 |
LNN | import math
import torch
from torch.nn import functional as F
import torch.utils.data
class LNN(torch.nn.Module):
"""
A pytorch implementation of LNN layer
Input shape
- A 3D tensor with shape: ``(batch_size,field_size,embedding_size)``.
Output shape
- 2D tensor with shape:``(batch_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jqsl2012/pytorch-fm | LNN | false | 10,373 | [
"MIT"
] | 0 | de6240d0a17750303bbc97dba676b667c3a27829 | https://github.com/jqsl2012/pytorch-fm/tree/de6240d0a17750303bbc97dba676b667c3a27829 |
ClassBlock | import torch
import torch.nn as nn
import torch.nn.parallel
class Mlp(nn.Module):
"""Implementation of MLP"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | javierrodenas/clearml_javi | ClassBlock | false | 10,374 | [
"Apache-2.0"
] | 0 | b6326104fe6a6f522223c2ac3d87468990a9e6f2 | https://github.com/javierrodenas/clearml_javi/tree/b6326104fe6a6f522223c2ac3d87468990a9e6f2 |
Conv2D | import torch
import torch.utils.data
from torch import nn
class Conv2D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, dilation_h
=1, dilation_w=1, causal=True):
super(Conv2D, self).__init__()
self.causal = causal
self.dilation_h, self.dilation_w = dilatio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | leoauri/WaveFlow | Conv2D | false | 10,375 | [
"BSD-3-Clause"
] | 0 | a34843f06a8b70acf8d4a3ffa5c2e8d5a07a7d66 | https://github.com/leoauri/WaveFlow/tree/a34843f06a8b70acf8d4a3ffa5c2e8d5a07a7d66 |
LatentAtten | import math
import torch
import torch.nn as nn
class LatentAtten(nn.Module):
"""
Attention on latent representation
"""
def __init__(self, h_dim, key_dim=None) ->None:
super(LatentAtten, self).__init__()
if key_dim is None:
key_dim = h_dim
self.key_dim = key_dim
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | kage08/CAMul | LatentAtten | false | 10,376 | [
"MIT"
] | 0 | 79f8a27f472943229fb087bae8e405e38e5e0b47 | https://github.com/kage08/CAMul/tree/79f8a27f472943229fb087bae8e405e38e5e0b47 |
SpatialPyramidPooling | import torch
import torch.nn as nn
class SpatialPyramidPooling(nn.Module):
def __init__(self, pool_sizes=[5, 9, 13]):
super(SpatialPyramidPooling, self).__init__()
self.maxpools = nn.ModuleList([nn.MaxPool2d(pool_size, 1, pool_size //
2) for pool_size in pool_sizes])
def forward(... | 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... | janewen134/fyp | SpatialPyramidPooling | false | 10,377 | [
"Apache-2.0"
] | 0 | 8fb93ac22d21d5d862035ba794fe9d264add2e63 | https://github.com/janewen134/fyp/tree/8fb93ac22d21d5d862035ba794fe9d264add2e63 |
Affine | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch import optim as optim
class Affine(nn.Module):
def __init__(self, dim):
super().__init__()
self.alpha = nn.Parameter(torch.ones((1, 1, dim)))
self.beta = nn.Parameter(torch.zeros((1, 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.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch import optim as optim
assert_size_stride = torch._C._dynam... | liangmuxue/pytorch-image-models | Affine | false | 10,378 | [
"Apache-2.0"
] | 0 | 84da7fdbedda76b1cb513ae128c612ab885e5e3f | https://github.com/liangmuxue/pytorch-image-models/tree/84da7fdbedda76b1cb513ae128c612ab885e5e3f |
EqualLinear | import torch
from torch import nn
from math import sqrt
def equal_lr(module, name='weight'):
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
weight = getattr(module, self.name + '_orig')
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 import nn
from math import sqrt
assert_size_stride = torch._C._dynamo... | jeromepl/style-based-gan-pytorch | EqualLinear | false | 10,379 | [
"MIT"
] | 0 | 97c13e54316dc57a7cb44c0cb910c29aaed11738 | https://github.com/jeromepl/style-based-gan-pytorch/tree/97c13e54316dc57a7cb44c0cb910c29aaed11738 |
SentinelMBSI | import torch
from typing import *
class SentinelMBSI(torch.nn.Module):
def __init__(self, band_count):
super(SentinelMBSI, self).__init__()
self.no_weights = True
def forward(self, x):
self.red = x[:, 3:4, :, :]
self.green = x[:, 2:3, :, :]
return 2 * (self.red - 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 typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | geotrellis/deeplab-nlcd | SentinelMBSI | false | 10,380 | [
"MIT"
] | 0 | 9444299597e1d1bc34ee187f2092890449c188be | https://github.com/geotrellis/deeplab-nlcd/tree/9444299597e1d1bc34ee187f2092890449c188be |
CNN | import torch
from torch import nn
import torch.nn.functional as F
class CNN(torch.nn.Module):
"""Basic CNN architecture."""
def __init__(self, in_channels=1):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(in_channels, 64, 8, 1)
self.conv2 = nn.Conv2d(64, 128, 6, 2)
self.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 import nn
assert_s... | kylematoba/cleverhans | CNN | false | 10,381 | [
"MIT"
] | 0 | acfd87e065ec5aabff1295ffbffafaf54057cb6c | https://github.com/kylematoba/cleverhans/tree/acfd87e065ec5aabff1295ffbffafaf54057cb6c |
Flip | import torch
import torch.nn as nn
class Flip(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
xf = torch.flip(x, [2])
y1 = xf[:, :, 0::2, :]
y2 = xf[:, :, 1::2, :]
y = torch.cat((y1, y2), dim=2)
return y
def get_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | liorkad3/ncnn | Flip | false | 10,382 | [
"BSD-3-Clause"
] | 0 | bcabffdf1ddc3739dc1051accba53a7f0a43863d | https://github.com/liorkad3/ncnn/tree/bcabffdf1ddc3739dc1051accba53a7f0a43863d |
StyleResidual | import torch
from torch import nn
import torch.utils.data
import torch.optim
class StyleResidual(nn.Module):
"""Styling."""
def __init__(self, d_channel: 'int', d_style: 'int', kernel_size: 'int'=1):
super().__init__()
self.rs = nn.Conv1d(in_channels=d_style, out_channels=d_channel,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.optim
assert_size_stri... | jinsongpan/NeMo | StyleResidual | false | 10,383 | [
"Apache-2.0"
] | 0 | 27f5f2dc6ecf7e0fd4225eedb2500cee6284e7d7 | https://github.com/jinsongpan/NeMo/tree/27f5f2dc6ecf7e0fd4225eedb2500cee6284e7d7 |
Relation | import torch
import torch.utils.data
import torch.nn as nn
from torch.nn import functional as F
class Relation(nn.Module):
def __init__(self, C, H, out_size):
super(Relation, self).__init__()
self.out_size = out_size
self.M = torch.nn.Parameter(torch.randn(H, H, out_size))
self.W ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | liangshb/few-shot-text-classification | Relation | false | 10,384 | [
"Apache-2.0"
] | 0 | 3bb2b3e87215ccf0fb6d5b0d436774557ac9ddd0 | https://github.com/liangshb/few-shot-text-classification/tree/3bb2b3e87215ccf0fb6d5b0d436774557ac9ddd0 |
MultAttention | import torch
import torch.nn as nn
class MultAttention(nn.Module):
"""
Multiplicative attention similar to Vaswani et al.
"""
def __init__(self, key_dim: 'int', val_dim: 'int', out_dim: 'int'):
super(MultAttention, self).__init__()
self.key_encoder = nn.Linear(key_dim, out_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.... | kage08/CAMul | MultAttention | false | 10,385 | [
"MIT"
] | 0 | 79f8a27f472943229fb087bae8e405e38e5e0b47 | https://github.com/kage08/CAMul/tree/79f8a27f472943229fb087bae8e405e38e5e0b47 |
FusedLeakyReLU | import torch
from torch import nn
from torch.nn.functional import leaky_relu
class FusedLeakyReLU(nn.Module):
def __init__(self, channel, negative_slope=0.2, scale=2 ** 0.5):
super().__init__()
self.bias = nn.Parameter(torch.zeros(channel))
self.negative_slope = negative_slope
sel... | 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... | jchetboun/anycost-gan | FusedLeakyReLU | false | 10,386 | [
"MIT"
] | 0 | 7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 | https://github.com/jchetboun/anycost-gan/tree/7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 |
MixedCycleLoss | import torch
from torch import nn
import torch.nn.functional as F
class MixedCycleLoss(nn.Module):
def __init__(self, reduction: 'str'='none') ->None:
super(MixedCycleLoss, self).__init__()
self.reduction = reduction
def forward(self, input_2d, input_3d, target_2d, target_3d, w_cycle=1,
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | koustav123/SemGCN | MixedCycleLoss | false | 10,387 | [
"Apache-2.0"
] | 0 | e74014378933c19027865499080629b36ac6a5c9 | https://github.com/koustav123/SemGCN/tree/e74014378933c19027865499080629b36ac6a5c9 |
EqualLinear | import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.functional import leaky_relu
def fused_leaky_relu(input_, bias, negative_slope=0.2, scale=2 ** 0.5):
return scale * leaky_relu(input_ + bias[:input_.shape[1]],
negative_slope, inplace=True)
class EqualLinear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.functional import leaky_relu
asse... | jchetboun/anycost-gan | EqualLinear | false | 10,388 | [
"MIT"
] | 0 | 7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 | https://github.com/jchetboun/anycost-gan/tree/7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 |
EqualConv2d | import math
import torch
from torch import nn
from torch.nn import functional as F
class EqualConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_channel, in_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 math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | jchetboun/anycost-gan | EqualConv2d | false | 10,389 | [
"MIT"
] | 0 | 7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 | https://github.com/jchetboun/anycost-gan/tree/7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 |
GeM | import torch
import torch.nn as nn
class GeM(nn.Module):
def __init__(self, dim=1, p=0.0, eps=1e-06):
super(GeM, self).__init__()
self.p = nn.Parameter(torch.ones(()) * p, requires_grad=True)
self.eps = eps
self.dim = dim
def forward(self, x):
return self.gem(x, p=sel... | 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... | layumi/dgcnn | GeM | false | 10,390 | [
"MIT"
] | 0 | a7b58796ffe549f2d8bdb06a84f62aba03e1d3a1 | https://github.com/layumi/dgcnn/tree/a7b58796ffe549f2d8bdb06a84f62aba03e1d3a1 |
BertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.utils.checkpoint
import torch.utils.tensorboard
class BertOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | ali-senguel/fairo-explore | BertOutput | false | 10,391 | [
"MIT"
] | 0 | 893481da270eed1e6d504c71e483d685ca9218d1 | https://github.com/ali-senguel/fairo-explore/tree/893481da270eed1e6d504c71e483d685ca9218d1 |
AttentionConv | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class AttentionConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=False):
super(AttentionConv, self).__init__()
self.out_channels = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | khy0809/Stand-Alone-Self-Attention | AttentionConv | false | 10,392 | [
"MIT"
] | 0 | 019718c8983faac24d69bd9b37eaf33cd28e1c4a | https://github.com/khy0809/Stand-Alone-Self-Attention/tree/019718c8983faac24d69bd9b37eaf33cd28e1c4a |
Transformer | import torch
import torch.nn as nn
import torch.nn.parallel
class Mlp(nn.Module):
"""Implementation of MLP"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | javierrodenas/clearml_javi | Transformer | false | 10,393 | [
"Apache-2.0"
] | 0 | b6326104fe6a6f522223c2ac3d87468990a9e6f2 | https://github.com/javierrodenas/clearml_javi/tree/b6326104fe6a6f522223c2ac3d87468990a9e6f2 |
MSEWithLogitsLoss | import torch
from torch import nn
from torch.nn import MSELoss
class MSEWithLogitsLoss(MSELoss):
"""
This loss combines a `Sigmoid` layer and the `MSELoss` in one single class.
"""
def __init__(self):
super(MSEWithLogitsLoss, self).__init__()
self.sigmoid = nn.Sigmoid()
def forwa... | 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
from torch.nn import MSELoss
assert_size_stride = torch._C._dynamo.g... | joowlim/pytorch-3dunet | MSEWithLogitsLoss | false | 10,394 | [
"MIT"
] | 0 | d08049f60b619627521efd0fb171247e1536b262 | https://github.com/joowlim/pytorch-3dunet/tree/d08049f60b619627521efd0fb171247e1536b262 |
ToRGB | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.functional import leaky_relu
def fused_leaky_relu(input_, bias, negative_slope=0.2, scale=2 ** 0.5):
return scale * leaky_relu(input_ + bias[:input_.shape[1]],
negative_slop... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
from torch import nn
from torch.... | jchetboun/anycost-gan | ToRGB | false | 10,395 | [
"MIT"
] | 0 | 7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 | https://github.com/jchetboun/anycost-gan/tree/7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.functional import leaky_relu
def fused_leaky_relu(input_, bias, negative_slope=0.2, scale=2 ** 0.5):
return scale * leaky_relu(input_ + bias[:input_.shape[1]],
negative_slop... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.autograd... | jchetboun/anycost-gan | ModulatedConv2d | false | 10,396 | [
"MIT"
] | 0 | 7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 | https://github.com/jchetboun/anycost-gan/tree/7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 |
MarginCosineProduct | import torch
import torch.nn as nn
from torch.nn import Parameter
import torch.utils.data
import torch.optim
def cosine_sim(x1, x2, dim=1, eps=1e-08):
ip = torch.mm(x1, x2.t())
w1 = torch.norm(x1, 2, dim)
w2 = torch.norm(x2, 2, dim)
return ip / torch.ger(w1, w2).clamp(min=eps)
class MarginCosineProd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | lindsey98/CosFace_pytorch | MarginCosineProduct | false | 10,397 | [
"MIT"
] | 0 | 39bddf763e06c7ccd21fbf45d0c7f1f4a9d8d24d | https://github.com/lindsey98/CosFace_pytorch/tree/39bddf763e06c7ccd21fbf45d0c7f1f4a9d8d24d |
SplitDim | import torch
from torch import nn as nn
import torch.utils.data
class SplitDim(nn.Module):
def __init__(self, nonlin_col=1, nonlin_type=torch.nn.functional.
softplus, correction=True):
super(SplitDim, self).__init__()
self.nonlinearity = nonlin_type
self.col = nonlin_col
i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch import nn as nn
import torch.utils.data
assert_size... | junmokane/rlkit_jm | SplitDim | false | 10,398 | [
"MIT"
] | 0 | 34a1bcf47706d4c98e9ce3b7edfd96fee6f2dd70 | https://github.com/junmokane/rlkit_jm/tree/34a1bcf47706d4c98e9ce3b7edfd96fee6f2dd70 |
StyledConv | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.functional import leaky_relu
def fused_leaky_relu(input_, bias, negative_slope=0.2, scale=2 ** 0.5):
return scale * leaky_relu(input_ + bias[:input_.shape[1]],
negative_slop... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.autograd... | jchetboun/anycost-gan | StyledConv | false | 10,399 | [
"MIT"
] | 0 | 7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 | https://github.com/jchetboun/anycost-gan/tree/7e0005e50b915e2dfeb90fe7a9846c5df38d7c06 |
DiceLoss | import torch
from torch import nn
from torch.autograd import Variable
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes are transformed as follows:
(N, C, D, H, W) -> (C, N * D * H * W)
"""
C = tensor.size(1)
axis_order = (1, 0) + tuple(range(2,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | joowlim/pytorch-3dunet | DiceLoss | false | 10,400 | [
"MIT"
] | 0 | d08049f60b619627521efd0fb171247e1536b262 | https://github.com/joowlim/pytorch-3dunet/tree/d08049f60b619627521efd0fb171247e1536b262 |
InferenceNetLSTMCell | import torch
import torch.nn as nn
class InferenceNetLSTMCell(nn.Module):
def __init__(self, z_dim: 'int', input_dim: 'int', hidden_hat_dim:
'int', hidden_dim: 'int'):
super(InferenceNetLSTMCell, self).__init__()
self.w_hh = nn.Linear(hidden_hat_dim, z_dim)
self.w_hx = nn.Linear(h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | kingofpigeon/hypernlp | InferenceNetLSTMCell | false | 10,401 | [
"MIT"
] | 0 | 1270ae318e698775160a6299db35752823fda7c7 | https://github.com/kingofpigeon/hypernlp/tree/1270ae318e698775160a6299db35752823fda7c7 |
MinMaxNorm | import torch
import torch.nn as nn
class MinMaxNorm(nn.Module):
def __init__(self, min, max, a=0, b=1):
super(MinMaxNorm, self).__init__()
self.min, self.max = min, max
self.a, self.b = a, b
def forward(self, x):
return self.a + (x - self.min) * (self.b - self.a) / (self.max ... | 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... | iclementine/speedyspeech | MinMaxNorm | false | 10,402 | [
"BSD-3-Clause"
] | 0 | db527587a3699b71082d61c9e9fad7ed795d1980 | https://github.com/iclementine/speedyspeech/tree/db527587a3699b71082d61c9e9fad7ed795d1980 |
CCAMDec | from torch.nn import Module
import torch
from torch.nn import Parameter
from torch.nn import Softmax
from torch.nn.parameter import Parameter
class CCAMDec(Module):
"""
CCAM decoding module
"""
def __init__(self):
super(CCAMDec, self).__init__()
self.softmax = Softmax(dim=-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.... | bfjei2825401/siamban | CCAMDec | false | 10,403 | [
"Apache-2.0"
] | 0 | c41d58742b146dfc8960053453227c6e9fec1bac | https://github.com/bfjei2825401/siamban/tree/c41d58742b146dfc8960053453227c6e9fec1bac |
PAM_Module | from torch.nn import Module
import torch
from torch.nn import Conv2d
from torch.nn import Parameter
from torch.nn import Softmax
from torch.nn.parameter import Parameter
class PAM_Module(Module):
""" Position attention module"""
def __init__(self, in_dim):
super(PAM_Module, self).__init__()
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | bfjei2825401/siamban | PAM_Module | false | 10,404 | [
"Apache-2.0"
] | 0 | c41d58742b146dfc8960053453227c6e9fec1bac | https://github.com/bfjei2825401/siamban/tree/c41d58742b146dfc8960053453227c6e9fec1bac |
Encoder | import torch
from torch import nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding=1):
"""
Create a lis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | joowlim/pytorch-3dunet | Encoder | false | 10,405 | [
"MIT"
] | 0 | d08049f60b619627521efd0fb171247e1536b262 | https://github.com/joowlim/pytorch-3dunet/tree/d08049f60b619627521efd0fb171247e1536b262 |
StandardNorm | import torch
import torch.nn as nn
class StandardNorm(nn.Module):
def __init__(self, mean, std):
super(StandardNorm, self).__init__()
self.mean = mean
self.std = std
def forward(self, x):
return (x - self.mean) / self.std
def inverse(self, x):
return x * self.std... | 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... | iclementine/speedyspeech | StandardNorm | false | 10,406 | [
"BSD-3-Clause"
] | 0 | db527587a3699b71082d61c9e9fad7ed795d1980 | https://github.com/iclementine/speedyspeech/tree/db527587a3699b71082d61c9e9fad7ed795d1980 |
EuclideanComparator_1 | import torch
from dataclasses import dataclass
from collections import defaultdict
import torch.optim
from torch import nn
class Base(nn.Module):
registered = defaultdict(dict)
@dataclass
class Config:
pass
@property
def config(self):
return self._config
def __init__(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
from dataclasses import data... | lavis-nlp/irtm | EuclideanComparator_1 | false | 10,407 | [
"MIT"
] | 0 | e6c96519918795cfaa0c09ef2d4164f451265518 | https://github.com/lavis-nlp/irtm/tree/e6c96519918795cfaa0c09ef2d4164f451265518 |
AffineConstantFlow | import torch
from torch import Tensor
from torch import nn
class FlowBlock(nn.Module):
"""
Abstract base class for any flow blocks.
"""
def __init__(self, dimension):
super(FlowBlock, self).__init__()
self.dimension = dimension
def forward(self, x: 'Tensor') ->(Tensor, 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.triton_helpers import math as tl_math
from torch import Tensor
from torch import nn
assert_size_stride = torch.... | lleonart1984/generative_modeling | AffineConstantFlow | false | 10,408 | [
"MIT"
] | 0 | d47c53d34b9eb704b6e8b2c334262b53fe7f4f32 | https://github.com/lleonart1984/generative_modeling/tree/d47c53d34b9eb704b6e8b2c334262b53fe7f4f32 |
MaxPoolingAggregator_1 | import torch
from dataclasses import dataclass
from collections import defaultdict
import torch.optim
from torch import nn
class Base(nn.Module):
registered = defaultdict(dict)
@dataclass
class Config:
pass
@property
def config(self):
return self._config
def __init__(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 dataclasses import dataclass
from collections import defaultdict
import torch.optim
... | lavis-nlp/irtm | MaxPoolingAggregator_1 | false | 10,409 | [
"MIT"
] | 0 | e6c96519918795cfaa0c09ef2d4164f451265518 | https://github.com/lavis-nlp/irtm/tree/e6c96519918795cfaa0c09ef2d4164f451265518 |
CPAMDec | from torch.nn import Module
import torch
from torch.nn import Conv2d
from torch.nn import Parameter
from torch.nn import Softmax
from torch.nn import Linear
from torch.nn.parameter import Parameter
class CPAMDec(Module):
"""
CPAM decoding module
"""
def __init__(self, in_channels):
super(CPAM... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | bfjei2825401/siamban | CPAMDec | false | 10,410 | [
"Apache-2.0"
] | 0 | c41d58742b146dfc8960053453227c6e9fec1bac | https://github.com/bfjei2825401/siamban/tree/c41d58742b146dfc8960053453227c6e9fec1bac |
LearnedPositionalEncoding | import torch
from torch import nn
class LayerNorm(nn.Module):
"""A layernorm module in the TF style (epsilon inside the square root)."""
def __init__(self, d_model, variance_epsilon=1e-12):
super().__init__()
self.gamma = nn.Parameter(torch.ones(d_model))
self.beta = nn.Parameter(torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | longnsl1998/vietocr | LearnedPositionalEncoding | false | 10,411 | [
"Apache-2.0"
] | 0 | 686dd6c9d897e0401c20e7dcadb07a07c1dbc284 | https://github.com/longnsl1998/vietocr/tree/686dd6c9d897e0401c20e7dcadb07a07c1dbc284 |
CrossNet | import torch
import torch.nn as nn
from sklearn.metrics import *
import torch.onnx
import torch as torch
class CrossNet(nn.Module):
"""The Cross Network part of Deep&Cross Network model,
which leans both low and high degree cross feature.
Input shape
- 2D tensor with shape: ``(batch_size, units)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 sklearn.metrics import *
import torch.onnx
import tor... | dulvqingyunLT/DeepCTR-Torch | CrossNet | false | 10,412 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
ExtResNetBlock | import torch
from torch import nn
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups,
padding=1):
"""
Create a lis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | joowlim/pytorch-3dunet | ExtResNetBlock | false | 10,413 | [
"MIT"
] | 0 | d08049f60b619627521efd0fb171247e1536b262 | https://github.com/joowlim/pytorch-3dunet/tree/d08049f60b619627521efd0fb171247e1536b262 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=296,
fc2_units=296):
"""Initialize parameters and build model.
Params
======
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_... | luiz-rocha94/navigation | QNetwork | false | 10,414 | [
"MIT"
] | 0 | fd5e00d8b9051e82dfe15793e53f8d1f86e8ecbe | https://github.com/luiz-rocha94/navigation/tree/fd5e00d8b9051e82dfe15793e53f8d1f86e8ecbe |
Coskx | import torch
from torch import nn
class Coskx(nn.Module):
def __init__(self, k=50):
super(Coskx, self).__init__()
self.k = k
def forward(self, input):
return torch.cos(input * self.k)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | jiaj15/SAIL | Coskx | false | 10,415 | [
"MIT"
] | 0 | 734be06a2b0ae70801f59c191b86332592da97cf | https://github.com/jiaj15/SAIL/tree/734be06a2b0ae70801f59c191b86332592da97cf |
GroupNorm32 | import torch
import torch.nn.functional as F
from torch import nn
class GroupNorm32(nn.GroupNorm):
def __init__(self, num_groups, num_channels, swish, eps=1e-05):
super().__init__(num_groups=num_groups, num_channels=num_channels,
eps=eps)
self.swish = swish
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | litevxx/glid-3 | GroupNorm32 | false | 10,416 | [
"MIT"
] | 0 | d7bd53e671d642b0cbc8af81197170b585c7e624 | https://github.com/litevxx/glid-3/tree/d7bd53e671d642b0cbc8af81197170b585c7e624 |
Qnet | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class Qnet(nn.Module):
def __init__(self):
super(Qnet, self).__init__()
self.fc1 = nn.Linear(4, 128)
self.fc2 = nn.Linear(128, 128)
self.fc3 = nn.Linear(128, 2)
def forward(self, x):
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
import random
import torch.nn... | linklab/link_rl_book_codes | Qnet | false | 10,417 | [
"MIT"
] | 0 | b272b46d5ecd2802f34648440ff53641c68cbbf0 | https://github.com/linklab/link_rl_book_codes/tree/b272b46d5ecd2802f34648440ff53641c68cbbf0 |
ScaledDotAttention | import torch
import torch.nn as nn
from torch.nn import LayerNorm
def scaled_dot_attention(q, k, v, mask=None, noise=0, dropout=lambda x: x):
"""
:param q: queries, (batch, time1, channels1)
:param k: keys, (batch, time2, channels1)
:param v: values, (batch, time2, channels2)
:param mask: boolean ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | iclementine/speedyspeech | ScaledDotAttention | false | 10,418 | [
"BSD-3-Clause"
] | 0 | db527587a3699b71082d61c9e9fad7ed795d1980 | https://github.com/iclementine/speedyspeech/tree/db527587a3699b71082d61c9e9fad7ed795d1980 |
Decoder | import torch
import torch.nn.functional as F
from torch import nn
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class Decoder(torch.nn.Module):
def __init__(self, input_dim, out_dim, hidden_size=128):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | jiaj15/SAIL | Decoder | false | 10,419 | [
"MIT"
] | 0 | 734be06a2b0ae70801f59c191b86332592da97cf | https://github.com/jiaj15/SAIL/tree/734be06a2b0ae70801f59c191b86332592da97cf |
PolicyNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class PolicyNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size=256):
super(PolicyNetwork, self).__init__()
self.num_actions = num_actions
self.linear1 = nn.Linear(num_inputs, hidden_size)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | linklab/link_rl_book_codes | PolicyNetwork | false | 10,420 | [
"MIT"
] | 0 | b272b46d5ecd2802f34648440ff53641c68cbbf0 | https://github.com/linklab/link_rl_book_codes/tree/b272b46d5ecd2802f34648440ff53641c68cbbf0 |
ActorCriticNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ActorCriticNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size=256):
super(ActorCriticNetwork, self).__init__()
self.num_actions = num_actions
self.critic_linear1 = nn.Linear(num_inputs, hidde... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | linklab/link_rl_book_codes | ActorCriticNetwork | false | 10,421 | [
"MIT"
] | 0 | b272b46d5ecd2802f34648440ff53641c68cbbf0 | https://github.com/linklab/link_rl_book_codes/tree/b272b46d5ecd2802f34648440ff53641c68cbbf0 |
SE | import torch
import torch.nn as nn
import torch.nn.functional as F
def swish(x):
return x * x.sigmoid()
class SE(nn.Module):
"""Squeeze-and-Excitation block with Swish."""
def __init__(self, in_planes, se_planes):
super(SE, self).__init__()
self.se1 = nn.Conv2d(in_planes, se_planes, ker... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | liormagram/pytorch-cifar | SE | false | 10,422 | [
"MIT"
] | 0 | 2ed0fabe6cbd4a468c5c4d155fb76c5b9ad4a764 | https://github.com/liormagram/pytorch-cifar/tree/2ed0fabe6cbd4a468c5c4d155fb76c5b9ad4a764 |
MultiHeadQKVAttention | import math
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def qkv_attention(queries, keys, values, presence=None):
"""
Transformer-like self-attention.
Args:
queries: Tensor of shape [B, N, d_k].
keys: Tensor of shape [B, M, d_k].
values: : Tensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | karayanni/torch-scae | MultiHeadQKVAttention | false | 10,423 | [
"Apache-2.0"
] | 0 | e044662d8942d8d1923d13d071f375144cf4a1e8 | https://github.com/karayanni/torch-scae/tree/e044662d8942d8d1923d13d071f375144cf4a1e8 |
AFMLayer | import itertools
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
import torch.onnx
import torch as torch
class AFMLayer(nn.Module):
"""Attentonal Factorization Machine models pairwise (order-2) feature
interactions without linear term and bias.
Input shap... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dulvqingyunLT/DeepCTR-Torch | AFMLayer | false | 10,424 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
DRRN | import torch
import torch.nn as nn
from math import sqrt
class DRRN(nn.Module):
def __init__(self):
super(DRRN, self).__init__()
self.input = nn.Conv2d(in_channels=1, out_channels=128, kernel_size
=3, stride=1, padding=1, bias=False)
self.conv1 = nn.Conv2d(in_channels=128, out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from ma... | loyo1990/DRRN-pytorch | DRRN | false | 10,425 | [
"MIT"
] | 0 | 63d7dfd4c6bcb4f7b668fc2f5b4e2031cbba6619 | https://github.com/loyo1990/DRRN-pytorch/tree/63d7dfd4c6bcb4f7b668fc2f5b4e2031cbba6619 |
UpSampleX2 | import torch
from torchvision.transforms import *
class DeconvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=4, stride=2,
padding=1, bias=True, activation='prelu', norm=None):
super(DeconvBlock, self).__init__()
self.deconv = torch.nn.ConvTranspose2d(input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | lizatish/My_CNN | UpSampleX2 | false | 10,426 | [
"MIT"
] | 0 | b13818bcce2f8a3697d20e34157e3dce53f953ee | https://github.com/lizatish/My_CNN/tree/b13818bcce2f8a3697d20e34157e3dce53f953ee |
InteractingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
import torch.onnx
import torch as torch
class InteractingLayer(nn.Module):
"""A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism.
Input sh... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dulvqingyunLT/DeepCTR-Torch | InteractingLayer | false | 10,427 | [
"Apache-2.0"
] | 0 | f40cf08f3469aa471f9ca69e44c5de51180341cc | https://github.com/dulvqingyunLT/DeepCTR-Torch/tree/f40cf08f3469aa471f9ca69e44c5de51180341cc |
CriticMlp | import torch
import torch.nn as nn
import torch.nn.functional as F
def init_weights(layer, gain):
for p in layer.parameters():
if len(p.data.shape) >= 2:
nn.init.orthogonal_(p, gain=gain)
else:
p.data.zero_()
def all_init_weights(m, gain=2 ** 0.5):
init_weights(m, gai... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | heavenlysf/thesis | CriticMlp | false | 10,428 | [
"MIT"
] | 0 | 646553c45860f337c91a48ab7f666a174784472f | https://github.com/heavenlysf/thesis/tree/646553c45860f337c91a48ab7f666a174784472f |
LayerNorm | import torch
import torch.nn as nn
from torch.nn import Parameter
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
self.affine = affine
self.eps = eps
if self.affine:
... | 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.nn import Parameter
assert_size_stride = torch... | kangzhiq/DeepFillv2_Pytorch | LayerNorm | false | 10,429 | [
"MIT"
] | 0 | 9c7ed61b25bb995713f89108b712490737abe1b1 | https://github.com/kangzhiq/DeepFillv2_Pytorch/tree/9c7ed61b25bb995713f89108b712490737abe1b1 |
SAB | import math
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def qkv_attention(queries, keys, values, presence=None):
"""
Transformer-like self-attention.
Args:
queries: Tensor of shape [B, N, d_k].
keys: Tensor of shape [B, M, d_k].
values: : Tensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | karayanni/torch-scae | SAB | false | 10,430 | [
"Apache-2.0"
] | 0 | e044662d8942d8d1923d13d071f375144cf4a1e8 | https://github.com/karayanni/torch-scae/tree/e044662d8942d8d1923d13d071f375144cf4a1e8 |
MAB | import math
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def qkv_attention(queries, keys, values, presence=None):
"""
Transformer-like self-attention.
Args:
queries: Tensor of shape [B, N, d_k].
keys: Tensor of shape [B, M, d_k].
values: : Tensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | karayanni/torch-scae | MAB | false | 10,431 | [
"Apache-2.0"
] | 0 | e044662d8942d8d1923d13d071f375144cf4a1e8 | https://github.com/karayanni/torch-scae/tree/e044662d8942d8d1923d13d071f375144cf4a1e8 |
DiscriminatorHingeLoss | import torch
import torch.nn as nn
class DiscriminatorHingeLoss(nn.Module):
def __init__(self, reduction='mean'):
super(DiscriminatorHingeLoss, self).__init__()
if reduction not in ['mean', 'sum']:
raise ValueError(
'Valid values for the reduction param are `mean`, `su... | 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... | kpandey008/SAGAN | DiscriminatorHingeLoss | false | 10,432 | [
"MIT"
] | 0 | 8e673d2ccabeb0450faf30dcb347b9ff2d710ae2 | https://github.com/kpandey008/SAGAN/tree/8e673d2ccabeb0450faf30dcb347b9ff2d710ae2 |
TransposeConv2dLayer | import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch.... | kangzhiq/DeepFillv2_Pytorch | TransposeConv2dLayer | false | 10,433 | [
"MIT"
] | 0 | 9c7ed61b25bb995713f89108b712490737abe1b1 | https://github.com/kangzhiq/DeepFillv2_Pytorch/tree/9c7ed61b25bb995713f89108b712490737abe1b1 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 50, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(50, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | lykasbongbongbong/Pytorch | Net | false | 10,434 | [
"MIT"
] | 0 | f01d89fb51ac939f5a110f5ab6190c11917e66fc | https://github.com/lykasbongbongbong/Pytorch/tree/f01d89fb51ac939f5a110f5ab6190c11917e66fc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.