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 |
|---|---|---|---|---|---|---|---|---|---|---|
ScaledLeakyReLU | import math
import torch
import torch.nn as nn
from torch.nn import functional as F
class ScaledLeakyReLU(nn.Module):
"""Scaled LeakyReLU.
Args:
negative_slope (float): Negative slope. Default: 0.2.
"""
def __init__(self, negative_slope=0.2):
super(ScaledLeakyReLU, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ArdWang/GFPGAN | ScaledLeakyReLU | false | 11,243 | [
"BSD-3-Clause"
] | 0 | f984ec32754190fad0b9b7a60d372aac84e57173 | https://github.com/ArdWang/GFPGAN/tree/f984ec32754190fad0b9b7a60d372aac84e57173 |
Prototypes | import torch
import torch.nn as nn
from torch.nn import functional as F
class Prototypes(nn.Module):
def __init__(self, fdim, num_classes, temp=0.05):
super().__init__()
self.prototypes = nn.Linear(fdim, num_classes, bias=False)
self.temp = temp
def forward(self, x):
x = F.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.... | Baymine/Dassl | Prototypes | false | 11,244 | [
"MIT"
] | 0 | 0836fb1f08393e2204326618e783d796741f657e | https://github.com/Baymine/Dassl/tree/0836fb1f08393e2204326618e783d796741f657e |
SmoothL1Loss | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss ten... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import functools
impor... | AtticusJohnson/mmdetection | SmoothL1Loss | false | 11,245 | [
"Apache-2.0"
] | 0 | d8d89bafcce13d3b32b1fb3366be3bb9830546c2 | https://github.com/AtticusJohnson/mmdetection/tree/d8d89bafcce13d3b32b1fb3366be3bb9830546c2 |
EqualConv2d | import math
import torch
import torch.nn as nn
from torch.nn import functional as F
class EqualConv2d(nn.Module):
"""Equalized Linear as StyleGAN2.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
kernel_size (int): Size of the co... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | ArdWang/GFPGAN | EqualConv2d | false | 11,246 | [
"BSD-3-Clause"
] | 0 | f984ec32754190fad0b9b7a60d372aac84e57173 | https://github.com/ArdWang/GFPGAN/tree/f984ec32754190fad0b9b7a60d372aac84e57173 |
EdgeFeatures | import torch
import torch.nn as nn
class EdgeFeatures(nn.Module):
"""Convnet features for edges.
e_ij = U*e_ij + V*(x_i + x_j)
"""
def __init__(self, hidden_dim):
super(EdgeFeatures, self).__init__()
self.U = nn.Linear(hidden_dim, hidden_dim, True)
self.V = nn.Linear(hidden_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | BrandonKates/graph-convnet-tsp | EdgeFeatures | false | 11,247 | [
"MIT"
] | 0 | f6e17e84311c23fd5cab041b7a27b4e0636c44f8 | https://github.com/BrandonKates/graph-convnet-tsp/tree/f6e17e84311c23fd5cab041b7a27b4e0636c44f8 |
EqualLinear | import math
import torch
import torch.nn as nn
from torch.nn import functional as F
class EqualLinear(nn.Module):
"""Equalized Linear as StyleGAN2.
Args:
in_channels (int): Size of each sample.
out_channels (int): Size of each output sample.
bias (bool): If set to ``False``, the layer... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | ArdWang/GFPGAN | EqualLinear | false | 11,248 | [
"BSD-3-Clause"
] | 0 | f984ec32754190fad0b9b7a60d372aac84e57173 | https://github.com/ArdWang/GFPGAN/tree/f984ec32754190fad0b9b7a60d372aac84e57173 |
L2Norm | import torch
import torch.nn as nn
from itertools import product as product
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
self.eps = 1e-10
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from itertools import product as product
import torch.nn.... | AnupKumarGupta/syncnet_python | L2Norm | false | 11,249 | [
"MIT"
] | 0 | 932b4621cf6aa090baac7c7de22d0649bde9fbbd | https://github.com/AnupKumarGupta/syncnet_python/tree/932b4621cf6aa090baac7c7de22d0649bde9fbbd |
NormStyleCode | import torch
import torch.nn as nn
class NormStyleCode(nn.Module):
def forward(self, x):
"""Normalize the style codes.
Args:
x (Tensor): Style codes with shape (b, c).
Returns:
Tensor: Normalized tensor.
"""
return x * torch.rsqrt(torch.mean(x ** ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ArdWang/GFPGAN | NormStyleCode | false | 11,250 | [
"BSD-3-Clause"
] | 0 | f984ec32754190fad0b9b7a60d372aac84e57173 | https://github.com/ArdWang/GFPGAN/tree/f984ec32754190fad0b9b7a60d372aac84e57173 |
Sine | import torch
import torch.nn as nn
class Sine(nn.Module):
def __init__(self, w0: 'float'=30.0):
super(Sine, self).__init__()
self.w0 = w0
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
return torch.sin(self.w0 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | CGruich/ocp | Sine | false | 11,251 | [
"MIT",
"BSD-3-Clause"
] | 0 | dd97972b39d4a05e37f745e393a5245657ef5f9e | https://github.com/CGruich/ocp/tree/dd97972b39d4a05e37f745e393a5245657ef5f9e |
Combiner | import torch
import numpy as np
import torch.nn as nn
def FC(shape=None, init=None):
if init is None:
K = shape[-2]
init = [torch.rand(shape) * 2 - 1]
shape_bias = shape.copy()
shape_bias[-2] = 1
init.append(torch.rand(shape_bias) * 2 - 1)
else:
K = init[0].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
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | BaharAzari/EquiGenDyna | Combiner | false | 11,252 | [
"MIT"
] | 0 | 1f71d9f7bf278880c61ceacec705bbb23852227c | https://github.com/BaharAzari/EquiGenDyna/tree/1f71d9f7bf278880c61ceacec705bbb23852227c |
GaussianSmearing | import torch
import torch.nn as nn
class GaussianSmearing(nn.Module):
def __init__(self, in_features, start=0, end=1, num_freqs=50):
super(GaussianSmearing, self).__init__()
self.num_freqs = num_freqs
offset = torch.linspace(start, end, num_freqs)
self.coeff = -0.5 / (offset[1] - ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | CGruich/ocp | GaussianSmearing | false | 11,253 | [
"MIT",
"BSD-3-Clause"
] | 0 | dd97972b39d4a05e37f745e393a5245657ef5f9e | https://github.com/CGruich/ocp/tree/dd97972b39d4a05e37f745e393a5245657ef5f9e |
AttnConnector | import torch
import torch.nn.functional as F
import torch.nn as nn
class AttnConnector(nn.Module):
def __init__(self, rnn_cell, query_size, key_size, content_size,
output_size, attn_size):
super(AttnConnector, self).__init__()
self.query_embed = nn.Linear(query_size, attn_size)
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
import torch.nn as ... | BinLiu777/NeuralDialog-LAED | AttnConnector | false | 11,256 | [
"Apache-2.0"
] | 0 | 3f52a75e5bcb314e567cafe94925cca32ccfbba1 | https://github.com/BinLiu777/NeuralDialog-LAED/tree/3f52a75e5bcb314e567cafe94925cca32ccfbba1 |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, 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.... | BruceChanJianLe/drlnd-tennis-project3 | Actor | false | 11,257 | [
"MIT"
] | 0 | cb2b880c55eedb6eef3775ed19e90aeec60174d8 | https://github.com/BruceChanJianLe/drlnd-tennis-project3/tree/cb2b880c55eedb6eef3775ed19e90aeec60174d8 |
ATLoss | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
class ATLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits: 'Tensor', labels: 'Tensor') ->float:
"""
Args:
logits: predicted probabilities (shape: bat... | 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 Tens... | BunnyNoBugs/DeepPavlov | ATLoss | false | 11,258 | [
"Apache-2.0"
] | 0 | b2213db633a669d27d6f745dd780530574ccf8b5 | https://github.com/BunnyNoBugs/DeepPavlov/tree/b2213db633a669d27d6f745dd780530574ccf8b5 |
BatchNormNode | import torch
import torch.nn as nn
class BatchNormNode(nn.Module):
"""Batch normalization for node features.
"""
def __init__(self, hidden_dim):
super(BatchNormNode, self).__init__()
self.batch_norm = nn.BatchNorm1d(hidden_dim, track_running_stats=False)
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | BrandonKates/graph-convnet-tsp | BatchNormNode | false | 11,259 | [
"MIT"
] | 0 | f6e17e84311c23fd5cab041b7a27b4e0636c44f8 | https://github.com/BrandonKates/graph-convnet-tsp/tree/f6e17e84311c23fd5cab041b7a27b4e0636c44f8 |
BatchNormEdge | import torch
import torch.nn as nn
class BatchNormEdge(nn.Module):
"""Batch normalization for edge features.
"""
def __init__(self, hidden_dim):
super(BatchNormEdge, self).__init__()
self.batch_norm = nn.BatchNorm2d(hidden_dim, track_running_stats=False)
def forward(self, e):
... | 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_... | BrandonKates/graph-convnet-tsp | BatchNormEdge | false | 11,260 | [
"MIT"
] | 0 | f6e17e84311c23fd5cab041b7a27b4e0636c44f8 | https://github.com/BrandonKates/graph-convnet-tsp/tree/f6e17e84311c23fd5cab041b7a27b4e0636c44f8 |
GlobalAttentionGeneral | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.onnx
def conv1x1(in_planes, out_planes, bias=False):
"""1x1 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1,
padding=0, bias=bias)
class GlobalAttentionGeneral(nn.Module):
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Amritds/AttnGAN | GlobalAttentionGeneral | false | 11,261 | [
"MIT"
] | 0 | 806ae70142a699bfe384c4964be2f7fce2b83d29 | https://github.com/Amritds/AttnGAN/tree/806ae70142a699bfe384c4964be2f7fce2b83d29 |
Hswish | import torch
import torch.nn as nn
import torch.utils.data
class Hswish(nn.Module):
def __init__(self, inplace=True):
super(Hswish, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
def forward(self, x):
return self.relu(x + 3) / 6
def get_inputs():
return [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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | COEN-390/YOLOv5-Lite | Hswish | false | 11,262 | [
"MIT"
] | 0 | 06a53f5d001c5d37729f55f47cbd46cc8eb63f84 | https://github.com/COEN-390/YOLOv5-Lite/tree/06a53f5d001c5d37729f55f47cbd46cc8eb63f84 |
ADD | import torch
import torch.nn as nn
import torch.utils.data
class ADD(nn.Module):
def __init__(self, alpha=0.5):
super(ADD, self).__init__()
self.a = alpha
def forward(self, x):
return torch.add(x, self.a)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | COEN-390/YOLOv5-Lite | ADD | false | 11,263 | [
"MIT"
] | 0 | 06a53f5d001c5d37729f55f47cbd46cc8eb63f84 | https://github.com/COEN-390/YOLOv5-Lite/tree/06a53f5d001c5d37729f55f47cbd46cc8eb63f84 |
NodeFeatures | import torch
import torch.nn as nn
class NodeFeatures(nn.Module):
"""Convnet features for nodes.
Using `sum` aggregation:
x_i = U*x_i + sum_j [ gate_ij * (V*x_j) ]
Using `mean` aggregation:
x_i = U*x_i + ( sum_j [ gate_ij * (V*x_j) ] / sum_j [ gate_ij] )
"""
def __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... | BrandonKates/graph-convnet-tsp | NodeFeatures | false | 11,264 | [
"MIT"
] | 0 | f6e17e84311c23fd5cab041b7a27b4e0636c44f8 | https://github.com/BrandonKates/graph-convnet-tsp/tree/f6e17e84311c23fd5cab041b7a27b4e0636c44f8 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self, n_channels, scale=1.0):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.scale = scale
self.eps = 1e-10
self.weight = nn.Parameter(torch.Tensor(self.n_channels))
self.wei... | 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_... | CCC-123/ECCVC | L2Norm | false | 11,265 | [
"MIT"
] | 0 | 322009a3423dba831cb3ae4182e7129be3441e70 | https://github.com/CCC-123/ECCVC/tree/322009a3423dba831cb3ae4182e7129be3441e70 |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | BruceChanJianLe/drlnd-tennis-project3 | Critic | false | 11,266 | [
"MIT"
] | 0 | cb2b880c55eedb6eef3775ed19e90aeec60174d8 | https://github.com/BruceChanJianLe/drlnd-tennis-project3/tree/cb2b880c55eedb6eef3775ed19e90aeec60174d8 |
SuperpointDescriptor | import torch
import torch.nn as nn
class SuperpointDescriptor(nn.Module):
""" Descriptor decoder based on the SuperPoint arcihtecture. """
def __init__(self, input_feat_dim=128):
super(SuperpointDescriptor, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.convPa = torch.n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | B1ueber2y/SOLD2 | SuperpointDescriptor | false | 11,267 | [
"MIT"
] | 0 | f85ca5387ea7464314614c3fb4d07af5678a9de3 | https://github.com/B1ueber2y/SOLD2/tree/f85ca5387ea7464314614c3fb4d07af5678a9de3 |
LinearBlock | import torch
import torch.nn as nn
import torch.nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
""" Class representing sampleable neural network model """
def num_params(self):
""" Get the number of model parameters. """
return sum(p.numel() for p in self.parameters())
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CBIIT/NCI-DOE-Colab-Pilot1-Combo | LinearBlock | false | 11,268 | [
"MIT"
] | 0 | 8d60900c29618083e0944b5b8ef43a2e98881b32 | https://github.com/CBIIT/NCI-DOE-Colab-Pilot1-Combo/tree/8d60900c29618083e0944b5b8ef43a2e98881b32 |
Encoder | import torch
import torch.nn as nn
import torch.nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
""" Class representing sampleable neural network model """
def num_params(self):
""" Get the number of model parameters. """
return sum(p.numel() for p in self.parameters())
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CBIIT/NCI-DOE-Colab-Pilot1-Combo | Encoder | false | 11,269 | [
"MIT"
] | 0 | 8d60900c29618083e0944b5b8ef43a2e98881b32 | https://github.com/CBIIT/NCI-DOE-Colab-Pilot1-Combo/tree/8d60900c29618083e0944b5b8ef43a2e98881b32 |
LinearDrop | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn
import torch.nn.init
import torch.optim
class Model(nn.Module):
""" Class representing sampleable neural network model """
def num_params(self):
""" Get the number of model parameters. """
return sum(p.numel() ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CBIIT/NCI-DOE-Colab-Pilot1-Combo | LinearDrop | false | 11,270 | [
"MIT"
] | 0 | 8d60900c29618083e0944b5b8ef43a2e98881b32 | https://github.com/CBIIT/NCI-DOE-Colab-Pilot1-Combo/tree/8d60900c29618083e0944b5b8ef43a2e98881b32 |
SuperpointDecoder | import torch
import torch.nn as nn
class SuperpointDecoder(nn.Module):
""" Junction decoder based on the SuperPoint architecture. """
def __init__(self, input_feat_dim=128, backbone_name='lcnn'):
super(SuperpointDecoder, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
if back... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | B1ueber2y/SOLD2 | SuperpointDecoder | false | 11,271 | [
"MIT"
] | 0 | f85ca5387ea7464314614c3fb4d07af5678a9de3 | https://github.com/B1ueber2y/SOLD2/tree/f85ca5387ea7464314614c3fb4d07af5678a9de3 |
skip_connection | import torch
import torch.nn as nn
class skip_connection(nn.Module):
def __init__(self, inchannel, outchannel, keep_dim=True):
super(skip_connection, self).__init__()
if inchannel != outchannel:
self.conv1d = nn.Conv1d(inchannel, outchannel, 1)
def forward(self, before, after):
... | 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... | CMI-Laboratory/CAE | skip_connection | false | 11,272 | [
"Apache-2.0"
] | 0 | 11c94f2152a51c9d4e86f8956ea75c575094256b | https://github.com/CMI-Laboratory/CAE/tree/11c94f2152a51c9d4e86f8956ea75c575094256b |
LC_SEModule | import torch
import torch.nn as nn
import torch.utils.data
class LC_SEModule(nn.Module):
def __init__(self, channel, reduction=4):
super().__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv1 = nn.Conv2d(in_channels=channel, out_channels=channel //
reduction, kernel_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
import ... | COEN-390/YOLOv5-Lite | LC_SEModule | false | 11,273 | [
"MIT"
] | 0 | 06a53f5d001c5d37729f55f47cbd46cc8eb63f84 | https://github.com/COEN-390/YOLOv5-Lite/tree/06a53f5d001c5d37729f55f47cbd46cc8eb63f84 |
Upsample | import torch
import torch.nn as nn
import torch.nn.functional as F
class Upsample(nn.Module):
def __init__(self, scale_factor=1, mode='nearest'):
super(Upsample, self).__init__()
self.scale_factor = scale_factor
self.mode = mode
def forward(self, x):
return F.interpolate(x, s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CV-YYDS/YOLOv3 | Upsample | false | 11,274 | [
"MIT"
] | 0 | a433064721dfc932509aaed6cb44a785b24bc768 | https://github.com/CV-YYDS/YOLOv3/tree/a433064721dfc932509aaed6cb44a785b24bc768 |
Route | import torch
import torch.nn as nn
class Route(nn.Module):
def __init__(self):
super(Route, self).__init__()
def forward(self, x1, x2):
"""
x1 means previous output; x2 means current output
"""
out = torch.cat((x2, x1), dim=1)
return out
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CV-YYDS/YOLOv3 | Route | false | 11,275 | [
"MIT"
] | 0 | a433064721dfc932509aaed6cb44a785b24bc768 | https://github.com/CV-YYDS/YOLOv3/tree/a433064721dfc932509aaed6cb44a785b24bc768 |
SEBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class SEBlock(nn.Module):
def __init__(self, input_channels, internal_neurons):
super(SEBlock, self).__init__()
self.down = nn.Conv2d(in_channels=input_channels, out_channels=
internal_neurons, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | COEN-390/YOLOv5-Lite | SEBlock | false | 11,276 | [
"MIT"
] | 0 | 06a53f5d001c5d37729f55f47cbd46cc8eb63f84 | https://github.com/COEN-390/YOLOv5-Lite/tree/06a53f5d001c5d37729f55f47cbd46cc8eb63f84 |
Standardize | from torch.nn import Module
import torch
from torch.nn import init
from torch.nn.parameter import Parameter
class Standardize(Module):
"""
Applies (element-wise) standardization with trainable translation parameter μ and scale parameter σ, i.e. computes
(x - μ) / σ where '/' is applied element-wise.
... | 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.nn import Module
from torch.nn import init
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.... | COMP6248-Reproducability-Challenge/MoveBrick_Reproducibility_DeepSAD | Standardize | false | 11,277 | [
"MIT"
] | 0 | 8985dc9cd8741010362c6ca51e72648b7bd3908f | https://github.com/COMP6248-Reproducability-Challenge/MoveBrick_Reproducibility_DeepSAD/tree/8985dc9cd8741010362c6ca51e72648b7bd3908f |
GeneralRelu | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import *
class GeneralRelu(nn.Module):
def __init__(self, leak=None, sub=None, maxv=None):
super().__init__()
self.leak, self.sub, self.maxv = leak, sub, maxv
def forward(self, x):
x = F.leaky_relu(x, self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.a... | Cedric-Perauer/DL_from_Foundations | GeneralRelu | false | 11,278 | [
"Apache-2.0"
] | 0 | c53722216a088cc9f67a2e1bf955d043023e6a85 | https://github.com/Cedric-Perauer/DL_from_Foundations/tree/c53722216a088cc9f67a2e1bf955d043023e6a85 |
MyActivation | import torch
class MyActivation(torch.nn.Module):
def __init__(self):
super(MyActivation, self).__init__()
self.relu = torch.nn.ReLU6(inplace=False)
def forward(self, x):
return x * self.relu(x + 3) / 6
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | CaichaoGitHub/model_optimization_demo | MyActivation | false | 11,279 | [
"Apache-2.0"
] | 0 | b3bca3ad4a1b972fe069049f9efd7365a22733c6 | https://github.com/CaichaoGitHub/model_optimization_demo/tree/b3bca3ad4a1b972fe069049f9efd7365a22733c6 |
AdaptiveConcatPool2d | import torch
import torch.nn as nn
from typing import *
class AdaptiveConcatPool2d(nn.Module):
def __init__(self, sz=1):
super().__init__()
self.output_size = sz
self.ap = nn.AdaptiveAvgPool2d(sz)
self.mp = nn.AdaptiveMaxPool2d(sz)
def forward(self, 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.a... | Cedric-Perauer/DL_from_Foundations | AdaptiveConcatPool2d | false | 11,280 | [
"Apache-2.0"
] | 0 | c53722216a088cc9f67a2e1bf955d043023e6a85 | https://github.com/Cedric-Perauer/DL_from_Foundations/tree/c53722216a088cc9f67a2e1bf955d043023e6a85 |
testHSwish | import torch
class MyActivation(torch.nn.Module):
def __init__(self):
super(MyActivation, self).__init__()
self.relu = torch.nn.ReLU6(inplace=False)
def forward(self, x):
return x * self.relu(x + 3) / 6
class testHSwish(torch.nn.Module):
def __init__(self):
super(testH... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | CaichaoGitHub/model_optimization_demo | testHSwish | false | 11,281 | [
"Apache-2.0"
] | 0 | b3bca3ad4a1b972fe069049f9efd7365a22733c6 | https://github.com/CaichaoGitHub/model_optimization_demo/tree/b3bca3ad4a1b972fe069049f9efd7365a22733c6 |
SuperpointBackbone | import torch
import torch.nn as nn
class SuperpointBackbone(nn.Module):
""" SuperPoint backbone. """
def __init__(self):
super(SuperpointBackbone, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(kernel_size=2, stride=2)
c1, c2, c3, c4 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | B1ueber2y/SOLD2 | SuperpointBackbone | false | 11,282 | [
"MIT"
] | 0 | f85ca5387ea7464314614c3fb4d07af5678a9de3 | https://github.com/B1ueber2y/SOLD2/tree/f85ca5387ea7464314614c3fb4d07af5678a9de3 |
TransformerLayer | import torch
import torch.nn as nn
import torch.utils.data
class TransformerLayer(nn.Module):
def __init__(self, c, num_heads):
super().__init__()
self.q = nn.Linear(c, c, bias=False)
self.k = nn.Linear(c, c, bias=False)
self.v = nn.Linear(c, c, bias=False)
self.ma = nn.Mu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | COEN-390/YOLOv5-Lite | TransformerLayer | false | 11,283 | [
"MIT"
] | 0 | 06a53f5d001c5d37729f55f47cbd46cc8eb63f84 | https://github.com/COEN-390/YOLOv5-Lite/tree/06a53f5d001c5d37729f55f47cbd46cc8eb63f84 |
ContrastiveLoss | import torch
import torch.cuda
import torch.nn.functional as F
class ContrastiveLoss(torch.nn.Module):
"""
Triplet loss function based on Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=0.2):
super(Contra... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.cuda
assert_siz... | CS5590-0001-Projject/CS5590-0001-Project | ContrastiveLoss | false | 11,284 | [
"MIT"
] | 0 | 18a9f0df7b2ef0f5e9ec7a4bd4e77f761abfd8f3 | https://github.com/CS5590-0001-Projject/CS5590-0001-Project/tree/18a9f0df7b2ef0f5e9ec7a4bd4e77f761abfd8f3 |
TokenEmbedding | import torch
import torch.nn as nn
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
kernel_size=3, pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Ares-Long/Time | TokenEmbedding | false | 11,285 | [
"Apache-2.0"
] | 0 | 7827463613f45baea82de189a890afb7394e73e4 | https://github.com/Ares-Long/Time/tree/7827463613f45baea82de189a890afb7394e73e4 |
TwoLayerCNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class TwoLayerCNN(nn.Module):
def __init__(self, C, M, embedding, channel, mtc_input):
super(TwoLayerCNN, self).__init__()
self.C = C
self.M = M
self.embedding = embedding
self.mtc_input = C if mtc_input el... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Changxi-Liu/EditDistance | TwoLayerCNN | false | 11,288 | [
"MIT"
] | 0 | 925f43c3cf0bd6fdd8f5f0e919ac49916a020459 | https://github.com/Changxi-Liu/EditDistance/tree/925f43c3cf0bd6fdd8f5f0e919ac49916a020459 |
Dense | import torch
import torch.nn as nn
import torch.utils.data
class Dense(nn.Module):
def __init__(self, num_channels, num_filters, filter_size, dropout_prob):
super().__init__()
self.dense_conv = nn.Conv2d(in_channels=num_channels, out_channels=
num_filters, kernel_size=filter_size, str... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | COEN-390/YOLOv5-Lite | Dense | false | 11,289 | [
"MIT"
] | 0 | 06a53f5d001c5d37729f55f47cbd46cc8eb63f84 | https://github.com/COEN-390/YOLOv5-Lite/tree/06a53f5d001c5d37729f55f47cbd46cc8eb63f84 |
LUConv | import torch
import torch.nn as nn
def ELUCons(elu, nchan):
if elu:
return nn.ELU(inplace=True)
else:
return nn.PReLU(nchan)
class LUConv(nn.Module):
def __init__(self, inChans, outChans, elu):
super(LUConv, self).__init__()
self.relu1 = ELUCons(elu, outChans)
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
import torch.nn as ... | CheerL/lancunar | LUConv | false | 11,290 | [
"BSD-3-Clause"
] | 0 | fb00a331b5381af555fd2a7f0d03324a5355fe8c | https://github.com/CheerL/lancunar/tree/fb00a331b5381af555fd2a7f0d03324a5355fe8c |
ResidualGatedGCNLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
class BatchNormNode(nn.Module):
"""Batch normalization for node features.
"""
def __init__(self, hidden_dim):
super(BatchNormNode, self).__init__()
self.batch_norm = nn.BatchNorm1d(hidden_dim, track_running_stats=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.... | BrandonKates/graph-convnet-tsp | ResidualGatedGCNLayer | false | 11,292 | [
"MIT"
] | 0 | f6e17e84311c23fd5cab041b7a27b4e0636c44f8 | https://github.com/BrandonKates/graph-convnet-tsp/tree/f6e17e84311c23fd5cab041b7a27b4e0636c44f8 |
Mlp | import torch
import torch.nn as nn
class Mlp(nn.Module):
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
hidden_features = hidden_features or in_features
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
import torch.nn as ... | ChangeTheWorld20191008/SwinIR | Mlp | false | 11,293 | [
"Apache-2.0"
] | 0 | a0cf7330b10e7c7294f11f59e1b89eff973b9093 | https://github.com/ChangeTheWorld20191008/SwinIR/tree/a0cf7330b10e7c7294f11f59e1b89eff973b9093 |
TemporalEmbedding | import math
import torch
import torch.nn as nn
class FixedEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(FixedEmbedding, self).__init__()
w = torch.zeros(c_in, d_model).float()
w.require_grad = False
position = torch.arange(0, c_in).float().unsqueeze(1)
div... | 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 math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | Ares-Long/Time | TemporalEmbedding | false | 11,294 | [
"Apache-2.0"
] | 0 | 7827463613f45baea82de189a890afb7394e73e4 | https://github.com/Ares-Long/Time/tree/7827463613f45baea82de189a890afb7394e73e4 |
cell | import math
import torch
import torch.nn as nn
class cell(nn.Module):
def __init__(self, input_sz: 'int', hidden_sz: 'int', output_sz: 'int'):
super().__init__()
self.weights1 = nn.Parameter(torch.randn(input_sz, hidden_sz) /
math.sqrt(input_sz), requires_grad=True)
self.bias1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Cemu0/Network-of-Neural-Network | cell | false | 11,295 | [
"MIT"
] | 0 | 6a4a097a960fbbec6ea0c5946804666b27c2da0f | https://github.com/Cemu0/Network-of-Neural-Network/tree/6a4a097a960fbbec6ea0c5946804666b27c2da0f |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, n_h):
super(Discriminator, self).__init__()
self.f_k = nn.Bilinear(n_h, n_h, 1)
for m in self.modules():
self.weights_init(m)
def weights_init(self, m):
if isinstance(m, nn.Bilin... | 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... | ChenChengKuan/DGI | Discriminator | false | 11,296 | [
"MIT"
] | 0 | 432bf78418b8dd52648c9cac45e8841bee4c5032 | https://github.com/ChenChengKuan/DGI/tree/432bf78418b8dd52648c9cac45e8841bee4c5032 |
Linear | import torch
class Linear(torch.nn.Module):
def __init__(self, in_size, out_size):
super().__init__()
self.weight = torch.nn.Parameter(2 * (torch.rand(in_size, out_size) -
0.5))
self.bias = torch.nn.Parameter(2 * (torch.rand(out_size) - 0.5))
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | Cesarscc/MiniTorch_Clase | Linear | false | 11,297 | [
"MIT"
] | 0 | 1f159bc86f35dce170068b37dd47940ea4a4ba04 | https://github.com/Cesarscc/MiniTorch_Clase/tree/1f159bc86f35dce170068b37dd47940ea4a4ba04 |
BertGELU | import math
import torch
from torch import nn
class BertGELU(nn.Module):
"""Bert uses GELU as the activation function for the position-wise network.
"""
def forward(self, x):
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get... | 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... | Codle/texar-pytorch | BertGELU | false | 11,298 | [
"Apache-2.0"
] | 0 | d63556e7a8f48076c396467314a771d56552d595 | https://github.com/Codle/texar-pytorch/tree/d63556e7a8f48076c396467314a771d56552d595 |
DotProductSimilarity | import math
import torch
import torch.nn as nn
class SimilarityFunction(nn.Module):
"""
A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity
function on the vectors in the last dimension. For example, the tensors might both have shape
`(batch_size, sentence_... | 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... | Aunsiels/qagnn | DotProductSimilarity | false | 11,299 | [
"MIT"
] | 0 | d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 | https://github.com/Aunsiels/qagnn/tree/d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 |
EncoderImagePrecomp | import torch
import numpy as np
import torch.nn as nn
import torch.nn.init
def l2norm(matrix, dim, eps=1e-08):
norm = torch.pow(matrix, 2).sum(dim=dim, keepdim=True).sqrt() + eps
matrix = matrix / norm
return matrix
class EncoderImagePrecomp(nn.Module):
def __init__(self, img_size, embed_size, use_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | Closer1/CARRN | EncoderImagePrecomp | false | 11,300 | [
"MIT"
] | 0 | b64588f1f4f6b6f51939ff125e06268d4c294679 | https://github.com/Closer1/CARRN/tree/b64588f1f4f6b6f51939ff125e06268d4c294679 |
SEModule | import torch
import torch.nn as nn
class SEModule(nn.Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1,
padding=0)
self.relu = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ChrisLee63/reid-strong-baseline | SEModule | false | 11,301 | [
"MIT"
] | 0 | da755d3812da3c2e6e69920066badaad42f6fa6b | https://github.com/ChrisLee63/reid-strong-baseline/tree/da755d3812da3c2e6e69920066badaad42f6fa6b |
AvgReducePool1d | import torch
from torch import nn
class AvgReducePool1d(nn.Module):
"""A subclass of :torch_nn:`Module`.
Avg Pool layer for 1D inputs. The same as :torch_nn:`AvgPool1d` except that
the pooling dimension is entirely reduced (i.e., `pool_size=input_length`).
"""
def forward(self, input: 'torch.Tens... | 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... | Codle/texar-pytorch | AvgReducePool1d | false | 11,302 | [
"Apache-2.0"
] | 0 | d63556e7a8f48076c396467314a771d56552d595 | https://github.com/Codle/texar-pytorch/tree/d63556e7a8f48076c396467314a771d56552d595 |
MatrixAttention | import math
import torch
import torch.nn as nn
class SimilarityFunction(nn.Module):
"""
A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity
function on the vectors in the last dimension. For example, the tensors might both have shape
`(batch_size, sentence_... | 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 math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | Aunsiels/qagnn | MatrixAttention | false | 11,303 | [
"MIT"
] | 0 | d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 | https://github.com/Aunsiels/qagnn/tree/d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 |
NeuralNet | import torch
import torch.nn as nn
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNet, self).__init__()
self.l1 = nn.Linear(input_size, hidden_size)
self.l2 = nn.Linear(hidden_size, hidden_size)
self.l3 = nn.Linear(hidden_size, 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
import torch.nn as nn
assert_... | Chris01e/Minh-V- | NeuralNet | false | 11,304 | [
"MIT"
] | 0 | 87e080f8583c0658f683e5a82cfa9ba2d116901e | https://github.com/Chris01e/Minh-V-/tree/87e080f8583c0658f683e5a82cfa9ba2d116901e |
BalancedL1Loss | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def balanced_l1_loss(pred, target, beta=1.0, alpha=0.5, gamma=1.5,
reduction='none'):
assert beta > 0
assert pred.size() == target.size() and target.numel() > 0
diff = torch.abs(pred - target)
b = np.e ** (gamma ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy as np
imp... | Complicateddd/Complicateddd-ROITransformer | BalancedL1Loss | false | 11,305 | [
"Apache-2.0"
] | 0 | 2adfbf98892d569c460d100c6e2169c5fa3a9b82 | https://github.com/Complicateddd/Complicateddd-ROITransformer/tree/2adfbf98892d569c460d100c6e2169c5fa3a9b82 |
EPE | import torch
import torch.nn as nn
class EPE(nn.Module):
def __init__(self):
super(EPE, self).__init__()
def forward(self, flow, gt, loss_mask):
loss_map = (flow - gt.detach()) ** 2
loss_map = (loss_map.sum(1, True) + 1e-06) ** 0.5
return loss_map * loss_mask
def get_inputs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Conrekatsu/arXiv2020-RIFE | EPE | false | 11,306 | [
"MIT"
] | 0 | 15cb7f2389ccd93e8b8946546d4665c9b41541a3 | https://github.com/Conrekatsu/arXiv2020-RIFE/tree/15cb7f2389ccd93e8b8946546d4665c9b41541a3 |
GELU | import math
import torch
import torch.nn as nn
def gelu(x):
""" Implementation of the gelu activation function currently in Google Bert repo (identical to OpenAI GPT).
Also see https://arxiv.org/abs/1606.08415
"""
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.... | Aunsiels/qagnn | GELU | false | 11,307 | [
"MIT"
] | 0 | d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 | https://github.com/Aunsiels/qagnn/tree/d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 |
Scale | import torch
import torch.nn as nn
class Scale(nn.Module):
def __init__(self, scale=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
def forward(self, x):
return x * self.scale
def get_inputs():
return [torch.rand([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... | Complicateddd/Complicateddd-ROITransformer | Scale | false | 11,308 | [
"Apache-2.0"
] | 0 | 2adfbf98892d569c460d100c6e2169c5fa3a9b82 | https://github.com/Complicateddd/Complicateddd-ROITransformer/tree/2adfbf98892d569c460d100c6e2169c5fa3a9b82 |
ConvModule | import torch
import warnings
import torch.nn as nn
def build_norm_layer(cfg, num_features, postfix=''):
""" Build normalization layer
Args:
cfg (dict): cfg should contain:
type (str): identify norm layer type.
layer args: args needed to instantiate a norm layer.
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import warnings
import torch.... | Complicateddd/Complicateddd-ROITransformer | ConvModule | false | 11,309 | [
"Apache-2.0"
] | 0 | 2adfbf98892d569c460d100c6e2169c5fa3a9b82 | https://github.com/Complicateddd/Complicateddd-ROITransformer/tree/2adfbf98892d569c460d100c6e2169c5fa3a9b82 |
ConvSqu | import torch
import torch.nn.functional as F
import torch.utils.data
import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Mish(nn.Module):
@staticmethod
def forward(x):
return x * F.softpl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Beaver48/kaggle-chest-xray-abnormalities | ConvSqu | false | 11,310 | [
"MIT"
] | 0 | d41f32d1c59cb5c925795df3291e929b3ea6d5fd | https://github.com/Beaver48/kaggle-chest-xray-abnormalities/tree/d41f32d1c59cb5c925795df3291e929b3ea6d5fd |
SmoothL1Loss | import torch
import torch.nn.functional as F
import torch.nn as nn
def smooth_l1_loss(pred, target, beta=1.0, reduction='mean'):
assert beta > 0
assert pred.size() == target.size() and target.numel() > 0
diff = torch.abs(pred - target)
loss = torch.where(diff < beta, 0.5 * diff * diff / beta, diff - 0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn.functi... | Complicateddd/Complicateddd-ROITransformer | SmoothL1Loss | false | 11,311 | [
"Apache-2.0"
] | 0 | 2adfbf98892d569c460d100c6e2169c5fa3a9b82 | https://github.com/Complicateddd/Complicateddd-ROITransformer/tree/2adfbf98892d569c460d100c6e2169c5fa3a9b82 |
MatrixVectorScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class MatrixVectorScaledDotProductAttention(nn.Module):
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
self.softmax = nn.Softmax(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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Aunsiels/qagnn | MatrixVectorScaledDotProductAttention | false | 11,312 | [
"MIT"
] | 0 | d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 | https://github.com/Aunsiels/qagnn/tree/d89a3dd650ac4b8b8aae34e0cce7cfc698892d80 |
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... | ChronosMasterOfAllTime/practical-pytorch | RNN | false | 11,313 | [
"MIT"
] | 0 | ed9567cec05ac348063c11963b6d05065fec3578 | https://github.com/ChronosMasterOfAllTime/practical-pytorch/tree/ed9567cec05ac348063c11963b6d05065fec3578 |
ConvSig | import torch
import torch.utils.data
import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class ConvSig(nn.Module):
def __init__(self, c1, c2, k=1, s=1, p=None, g=1, act=True):
super(ConvSig, 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
import torch.nn as nn
assert_size_stride = ... | Beaver48/kaggle-chest-xray-abnormalities | ConvSig | false | 11,314 | [
"MIT"
] | 0 | d41f32d1c59cb5c925795df3291e929b3ea6d5fd | https://github.com/Beaver48/kaggle-chest-xray-abnormalities/tree/d41f32d1c59cb5c925795df3291e929b3ea6d5fd |
MP | import torch
import torch.utils.data
import torch
import torch.nn as nn
class MP(nn.Module):
def __init__(self, k=2):
super(MP, self).__init__()
self.m = nn.MaxPool2d(kernel_size=k, stride=k)
def forward(self, x):
return self.m(x)
def get_inputs():
return [torch.rand([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
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C.... | Beaver48/kaggle-chest-xray-abnormalities | MP | false | 11,315 | [
"MIT"
] | 0 | d41f32d1c59cb5c925795df3291e929b3ea6d5fd | https://github.com/Beaver48/kaggle-chest-xray-abnormalities/tree/d41f32d1c59cb5c925795df3291e929b3ea6d5fd |
Conv2d | import torch
import torch.nn as nn
from torch.nn import functional as F
class Conv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True):
super(Conv2d, self).__init__(in_channels, out_channels, kernel_size,
strid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ChuanqiTan/DeepLabv3.pytorch | Conv2d | false | 11,316 | [
"BSD-3-Clause"
] | 0 | 260db5812ae3c85f0aacd5ec9bc0e3d8c5d2d067 | https://github.com/ChuanqiTan/DeepLabv3.pytorch/tree/260db5812ae3c85f0aacd5ec9bc0e3d8c5d2d067 |
CNN_Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN_Model(nn.Module):
def __init__(self):
super(CNN_Model, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 64, 3, padding=1)
self.conv3 = nn.Conv2d(64, 64, 3, padding=1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CaFeCoKe/Leaf_Disease_Classification | CNN_Model | false | 11,317 | [
"MIT"
] | 0 | 113a69cc896f91c878eb391b3650fb4bfe1975c3 | https://github.com/CaFeCoKe/Leaf_Disease_Classification/tree/113a69cc896f91c878eb391b3650fb4bfe1975c3 |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_dim, hidden_dim, output_dim):
super(Decoder, self).__init__()
self.FC_hidden = nn.Linear(latent_dim, hidden_dim)
self.FC_output = nn.Linear(hidden_dim, output_dim)
def forward(self, x):
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
import torch.nn as nn
assert_... | CsekM8/dtu_mlops | Decoder | false | 11,318 | [
"Apache-2.0"
] | 0 | 5c96a9afac0298fab57b7d47e4c08497f4a5d8d9 | https://github.com/CsekM8/dtu_mlops/tree/5c96a9afac0298fab57b7d47e4c08497f4a5d8d9 |
Classify | import torch
import torch.utils.data
import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Flatten(nn.Module):
@staticmethod
def forward(x):
return x.view(x.size(0), -1)
class Classify(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
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = ... | Beaver48/kaggle-chest-xray-abnormalities | Classify | false | 11,319 | [
"MIT"
] | 0 | d41f32d1c59cb5c925795df3291e929b3ea6d5fd | https://github.com/Beaver48/kaggle-chest-xray-abnormalities/tree/d41f32d1c59cb5c925795df3291e929b3ea6d5fd |
HighwayNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class HighwayNetwork(nn.Module):
def __init__(self, size):
super().__init__()
self.W1 = nn.Linear(size, size)
self.W2 = nn.Linear(size, size)
self.W1.bias.data.fill_(0.0)
def forward(self, x):
x1 = sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Dacrol/WaveRNN-server | HighwayNetwork | false | 11,320 | [
"MIT"
] | 0 | 5189829cec71938ff7ec2e3eb59e73af1382430a | https://github.com/Dacrol/WaveRNN-server/tree/5189829cec71938ff7ec2e3eb59e73af1382430a |
EqualLinear | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5):
if input.device.type == 'cpu':
if bias is not None:
rest_dim = [1] * (input.ndim - bias.ndim - 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.autograd import Function
import math
from torch import nn
from torch.... | CurtisASmith/stylegan2-pytorch | EqualLinear | false | 11,321 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 139ded3394718b9b8a727949dd46ad77ec2ec746 | https://github.com/CurtisASmith/stylegan2-pytorch/tree/139ded3394718b9b8a727949dd46ad77ec2ec746 |
NoiseInjection | import torch
from torch import nn
class NoiseInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = image.new... | 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... | CurtisASmith/stylegan2-pytorch | NoiseInjection | false | 11,322 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | 139ded3394718b9b8a727949dd46ad77ec2ec746 | https://github.com/CurtisASmith/stylegan2-pytorch/tree/139ded3394718b9b8a727949dd46ad77ec2ec746 |
Norm | import torch
import torch.nn as nn
class Norm(nn.Module):
def __init__(self, d_model, eps=1e-06):
super().__init__()
self.size = d_model
self.alpha = nn.Parameter(torch.ones(self.size))
self.bias = nn.Parameter(torch.zeros(self.size))
self.eps = eps
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_... | Daniangio/pheno_phases | Norm | false | 11,323 | [
"MIT"
] | 0 | c7229f4ec56fea42988768b02e8deb8615f683fa | https://github.com/Daniangio/pheno_phases/tree/c7229f4ec56fea42988768b02e8deb8615f683fa |
FeedForward | import torch
import torch.nn.functional as F
import torch.nn as nn
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=2048, dropout=0.1):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_mo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Daniangio/pheno_phases | FeedForward | false | 11,324 | [
"MIT"
] | 0 | c7229f4ec56fea42988768b02e8deb8615f683fa | https://github.com/Daniangio/pheno_phases/tree/c7229f4ec56fea42988768b02e8deb8615f683fa |
PreNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class PreNet(nn.Module):
def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5):
super().__init__()
self.fc1 = nn.Linear(in_dims, fc1_dims)
self.fc2 = nn.Linear(fc1_dims, fc2_dims)
self.p = 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
import torch.nn as nn
assert_... | Dacrol/WaveRNN-server | PreNet | false | 11,326 | [
"MIT"
] | 0 | 5189829cec71938ff7ec2e3eb59e73af1382430a | https://github.com/Dacrol/WaveRNN-server/tree/5189829cec71938ff7ec2e3eb59e73af1382430a |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, attn_dims):
super().__init__()
self.W = nn.Linear(attn_dims, attn_dims, bias=False)
self.v = nn.Linear(attn_dims, 1, bias=False)
def forward(self, encoder_seq_proj, query... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Dacrol/WaveRNN-server | Attention | false | 11,328 | [
"MIT"
] | 0 | 5189829cec71938ff7ec2e3eb59e73af1382430a | https://github.com/Dacrol/WaveRNN-server/tree/5189829cec71938ff7ec2e3eb59e73af1382430a |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, latent_dim):
super(Encoder, self).__init__()
self.FC_input = nn.Linear(input_dim, hidden_dim)
self.FC_mean = nn.Linear(hidden_dim, latent_dim)
self.FC_var = nn.Linear(hidden_dim,... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | CsekM8/dtu_mlops | Encoder | false | 11,329 | [
"Apache-2.0"
] | 0 | 5c96a9afac0298fab57b7d47e4c08497f4a5d8d9 | https://github.com/CsekM8/dtu_mlops/tree/5c96a9afac0298fab57b7d47e4c08497f4a5d8d9 |
Policy | import torch
from copy import deepcopy
import torch.nn as nn
class Policy(nn.Module):
def __init__(self, max_nodes, search_space):
super(Policy, self).__init__()
self.max_nodes = max_nodes
self.search_space = deepcopy(search_space)
self.edge2index = {}
for i in range(1, ma... | 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 copy import deepc... | Debrove/NAS-Projects | Policy | false | 11,330 | [
"MIT"
] | 0 | 53b4fd427f72ee121a1efb8667ceb9e36117caae | https://github.com/Debrove/NAS-Projects/tree/53b4fd427f72ee121a1efb8667ceb9e36117caae |
DNN | import torch
import torch.nn as nn
from torch.nn import functional as F
class DNN(nn.Module):
def __init__(self, n_state, n_action):
super(DNN, self).__init__()
self.input_layer = nn.Linear(n_state, 64)
self.input_layer.weight.data.normal_(0, 0.1)
self.middle_layer = nn.Linear(64,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ColinFred/Reinforce_Learning_Pytorch | DNN | false | 11,331 | [
"MIT"
] | 0 | 48593dbb12f49915e8f94182ef9b0a3b68aee1d3 | https://github.com/ColinFred/Reinforce_Learning_Pytorch/tree/48593dbb12f49915e8f94182ef9b0a3b68aee1d3 |
InputTransition | import torch
import torch.nn as nn
def ELUCons(elu, nchan):
if elu:
return nn.ELU(inplace=True)
else:
return nn.PReLU(nchan)
class InputTransition(nn.Module):
def __init__(self, outChans, elu):
super(InputTransition, self).__init__()
self.conv1 = nn.Conv3d(1, 32, kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CheerL/lancunar | InputTransition | false | 11,332 | [
"BSD-3-Clause"
] | 0 | fb00a331b5381af555fd2a7f0d03324a5355fe8c | https://github.com/CheerL/lancunar/tree/fb00a331b5381af555fd2a7f0d03324a5355fe8c |
PositionEmbedder | import torch
import torch.nn
class PositionEmbedder(torch.nn.Module):
"""
[batch_size, seq_length, embedding_size]
"""
def __init__(self, max_sequence_length: 'int', embedding_dim: 'int'):
super(PositionEmbedder, self).__init__()
self.embedding = torch.nn.Embedding(max_sequence_length... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_... | DanBerrebbi/shiba | PositionEmbedder | false | 11,333 | [
"Apache-2.0"
] | 0 | 3f2793f3e1797be79dd6d491b7ecd2d7de765555 | https://github.com/DanBerrebbi/shiba/tree/3f2793f3e1797be79dd6d491b7ecd2d7de765555 |
NCModel | import torch
from torch import nn
from torch.nn import Parameter
def th(vector):
return torch.tanh(vector) / 2 + 0.5
def thp(vector):
return torch.tanh(vector) * 2.2
class Model(nn.Module):
"""
Base class for models with added support for GradCam activation map
and a SentiNet defense. The Grad... | 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
from torch.nn import Parameter
assert_size_stride = torch.... | DavidHidde/backdoors101 | NCModel | false | 11,334 | [
"MIT"
] | 0 | 76ad5b391d3526fa26c3985e611d576c05724714 | https://github.com/DavidHidde/backdoors101/tree/76ad5b391d3526fa26c3985e611d576c05724714 |
Attention | import math
import torch
from torch import nn
class Attention(nn.Module):
"""A generic attention module for a decoder in seq2seq"""
def __init__(self, dim, use_tanh=False, C=10):
super(Attention, self).__init__()
self.use_tanh = use_tanh
self.project_query = nn.Linear(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
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | DaehanKim/attention-learn-to-route | Attention | false | 11,335 | [
"MIT"
] | 0 | 9ce4fa9a3a136768f92adf3d1e7d62620442f1b7 | https://github.com/DaehanKim/attention-learn-to-route/tree/9ce4fa9a3a136768f92adf3d1e7d62620442f1b7 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-05, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
self.affine = affine
self.eps = eps
if self.affine:
self.gamma = nn.Param... | 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_... | DeVriesMatt/PyTorch-GAN | LayerNorm | false | 11,336 | [
"MIT"
] | 0 | dc6488b1f7af06a954ae3ff5a33816e1a892046f | https://github.com/DeVriesMatt/PyTorch-GAN/tree/dc6488b1f7af06a954ae3ff5a33816e1a892046f |
MSEloss_mod | import torch
import torch.nn as nn
class MSEloss_mod(nn.Module):
def __init__(self):
super(MSEloss_mod, self).__init__()
def forward(self, y_pred, y_gt):
muX = y_pred[:, :, 0]
muY = y_pred[:, :, 1]
x = y_gt[:, :, 0].permute(1, 0)
y = y_gt[:, :, 1].permute(1, 0)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | DemainWang/TP2Net | MSEloss_mod | false | 11,337 | [
"MIT"
] | 0 | ebdd509ac674c107de59062382a9f9d59f86b492 | https://github.com/DemainWang/TP2Net/tree/ebdd509ac674c107de59062382a9f9d59f86b492 |
global_avg_pool2d | import torch
import torch.nn as nn
class global_avg_pool2d(nn.Module):
def forward(self, x):
_, _, h, w = x.shape
return nn.AvgPool2d(kernel_size=(h, w))(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | DevBruce/torch-implementation | global_avg_pool2d | false | 11,338 | [
"MIT"
] | 0 | 73bb481e67c8dee7dfe8081c1049b1f4b62ce159 | https://github.com/DevBruce/torch-implementation/tree/73bb481e67c8dee7dfe8081c1049b1f4b62ce159 |
tofp16 | import torch
import torch.nn as nn
from typing import *
class tofp16(nn.Module):
"""
Utility module that implements::
def forward(self, input):
return input.half()
"""
def __init__(self):
super(tofp16, self).__init__()
def forward(self, input):
return input.h... | 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 typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | DineshChauhan/fastai_docs | tofp16 | false | 11,339 | [
"Apache-2.0"
] | 0 | cf4d88073fb6f3ef7331b5360618b8dd95eb9345 | https://github.com/DineshChauhan/fastai_docs/tree/cf4d88073fb6f3ef7331b5360618b8dd95eb9345 |
HighwayLayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
def my_xavier_init(m, gain=1):
"""Xavier initialization: weights initialization that tries to make variance of outputs
of a layer equal to variance of its inputs.
"""
for p in m.parameters():
if p.di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Dhiraj100892/droidlet | HighwayLayer | false | 11,340 | [
"MIT"
] | 0 | e4ea578672531524552b6ff021165fc9371b0ec8 | https://github.com/Dhiraj100892/droidlet/tree/e4ea578672531524552b6ff021165fc9371b0ec8 |
Flatten | import torch
from torch import nn
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
"""
Arguments:
x: a float tensor with shape [batch_size, c, h, w].
Returns:
a float tensor with shape [batch_size, c*h... | 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... | DeepVoodooFX/pixel2style2pixel | Flatten | false | 11,341 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | 0 | 0254c32400d55f7e400ead15b02ad6a992ba1e21 | https://github.com/DeepVoodooFX/pixel2style2pixel/tree/0254c32400d55f7e400ead15b02ad6a992ba1e21 |
CPUForgetMult | import torch
from typing import *
class CPUForgetMult(torch.nn.Module):
def __init__(self):
super(CPUForgetMult, self).__init__()
def forward(self, f, x, hidden_init=None):
result = []
forgets = f.split(1, dim=0)
prev_h = hidden_init
for i, h in enumerate((f * x).spli... | 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... | DineshChauhan/fastai_docs | CPUForgetMult | false | 11,342 | [
"Apache-2.0"
] | 0 | cf4d88073fb6f3ef7331b5360618b8dd95eb9345 | https://github.com/DineshChauhan/fastai_docs/tree/cf4d88073fb6f3ef7331b5360618b8dd95eb9345 |
SEModule | from torch.nn import Module
import torch
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import Sigmoid
from torch.nn import AdaptiveAvgPool2d
class SEModule(Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
self.avg_pool = AdaptiveAvgPool2d(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.nn import Module
f... | DeepVoodooFX/pixel2style2pixel | SEModule | false | 11,343 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | 0 | 0254c32400d55f7e400ead15b02ad6a992ba1e21 | https://github.com/DeepVoodooFX/pixel2style2pixel/tree/0254c32400d55f7e400ead15b02ad6a992ba1e21 |
AsymmetricLossMultiLabel | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
from torch import optim as optim
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(AsymmetricLossMultiLabel, ... | 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... | DifferentSC/pytorch-image-models | AsymmetricLossMultiLabel | false | 11,344 | [
"Apache-2.0"
] | 0 | ccfb5751abc70d80add4f197464190c4a2637c6c | https://github.com/DifferentSC/pytorch-image-models/tree/ccfb5751abc70d80add4f197464190c4a2637c6c |
RegModel | import torch
import torch.nn as nn
from typing import *
class RegModel(nn.Module):
def __init__(self):
super().__init__()
self.a, self.b = nn.Parameter(torch.randn(1)), nn.Parameter(torch.
randn(1))
def forward(self, x):
return x * self.a + self.b
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | DineshChauhan/fastai_docs | RegModel | false | 11,345 | [
"Apache-2.0"
] | 0 | cf4d88073fb6f3ef7331b5360618b8dd95eb9345 | https://github.com/DineshChauhan/fastai_docs/tree/cf4d88073fb6f3ef7331b5360618b8dd95eb9345 |
Encoder | import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, latent_dim):
super(Encoder, self).__init__()
self.FC_input = nn.Linear(input_dim, hidden_dim)
self.FC_mean = nn.Linear(hidden_dim, latent_dim)
self.FC_var = nn.Linear(hidden_dim, ... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | DeterjoSimon/dtu_mlops | Encoder | false | 11,346 | [
"Apache-2.0"
] | 0 | 6484be509c002690b995f399001704c6b0bb42e4 | https://github.com/DeterjoSimon/dtu_mlops/tree/6484be509c002690b995f399001704c6b0bb42e4 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
"""Attention mechanism written by Gustavo Aguilar https://github.com/gaguilar"""
def __init__(self, hidden_size):
super(Attention, self).__init__()
self.da = hidden_size
self.dh = hidden_size
self.W = nn.Linear(sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | DavidInWuhanChina/SemEval-2020-Task10 | Attention | false | 11,347 | [
"MIT"
] | 0 | aadc8030e0c5b49861daacdf7a581e034cbbb026 | https://github.com/DavidInWuhanChina/SemEval-2020-Task10/tree/aadc8030e0c5b49861daacdf7a581e034cbbb026 |
Benefit3 | import torch
import torch.nn as nn
class Benefit3(nn.Module):
def __init__(self):
super(Benefit3, self).__init__()
self.delta = torch.nn.Parameter(torch.FloatTensor([0.03]),
requires_grad=True)
def forward(self, I, A, B):
self.Y = I * self.delta + A * self.delta ** 2 + B ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | DingLyu/Investigating-and-Modeling-the-Dynamics-of-Long-Ties | Benefit3 | false | 11,348 | [
"MIT"
] | 0 | aa37c3d5c85a8d1696db3dda7dcb22782b737d17 | https://github.com/DingLyu/Investigating-and-Modeling-the-Dynamics-of-Long-Ties/tree/aa37c3d5c85a8d1696db3dda7dcb22782b737d17 |
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64,
fc2_units=64):
"""Initialize parameters and build model.
Params
======
state_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | DiegelD/Deep-Reinforcement-Learning-ND | QNetwork | false | 11,349 | [
"MIT"
] | 0 | 15a91da352414718bb83fdc538d73ac576472cb8 | https://github.com/DiegelD/Deep-Reinforcement-Learning-ND/tree/15a91da352414718bb83fdc538d73ac576472cb8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.