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 |
|---|---|---|---|---|---|---|---|---|---|---|
TerConv2d | import torch
import numpy as np
from itertools import product as product
import torch.nn.functional as F
from torch import nn
import torch.optim
import torch.utils.data
def ternary_threshold(delta: 'float'=0.7, *ws):
"""Ternary threshold find in ws."""
assert isinstance(delta, float)
num_params = sum_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
from torch._inductor.runtime.... | ninfueng/a-PyTorch-Tutorial-to-Object-Detection | TerConv2d | false | 10,637 | [
"MIT"
] | 0 | fc7544720a7e939f5a56f4f7214e4965b7775f77 | https://github.com/ninfueng/a-PyTorch-Tutorial-to-Object-Detection/tree/fc7544720a7e939f5a56f4f7214e4965b7775f77 |
BinConv2d | import torch
from itertools import product as product
import torch.nn.functional as F
from torch import nn
import torch.optim
import torch.utils.data
class BinQuant(torch.autograd.Function):
"""BinaryConnect quantization.
Refer:
https://pytorch.org/tutorials/beginner/examples_autograd/two_layer_net_cu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
from torch import nn
import torch.optim... | ninfueng/a-PyTorch-Tutorial-to-Object-Detection | BinConv2d | false | 10,638 | [
"MIT"
] | 0 | fc7544720a7e939f5a56f4f7214e4965b7775f77 | https://github.com/ninfueng/a-PyTorch-Tutorial-to-Object-Detection/tree/fc7544720a7e939f5a56f4f7214e4965b7775f77 |
TerLinear | import torch
import numpy as np
from itertools import product as product
import torch.nn.functional as F
from torch import nn
import torch.optim
import torch.utils.data
def ternary_threshold(delta: 'float'=0.7, *ws):
"""Ternary threshold find in ws."""
assert isinstance(delta, float)
num_params = sum_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.triton_helpers import math as tl_math
import numpy ... | ninfueng/a-PyTorch-Tutorial-to-Object-Detection | TerLinear | false | 10,639 | [
"MIT"
] | 0 | fc7544720a7e939f5a56f4f7214e4965b7775f77 | https://github.com/ninfueng/a-PyTorch-Tutorial-to-Object-Detection/tree/fc7544720a7e939f5a56f4f7214e4965b7775f77 |
pixelwise_norm_layer | import torch
import torch.nn as nn
class pixelwise_norm_layer(nn.Module):
def __init__(self):
super(pixelwise_norm_layer, self).__init__()
self.eps = 1e-08
def forward(self, x):
return x / (torch.mean(x ** 2, dim=1, keepdim=True) + self.eps) ** 0.5
def get_inputs():
return [tor... | 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_... | mikanCan/PG-GAN | pixelwise_norm_layer | false | 10,640 | [
"MIT"
] | 0 | bc4a1bd2101f836c22a164174381f80b3f5c73c1 | https://github.com/mikanCan/PG-GAN/tree/bc4a1bd2101f836c22a164174381f80b3f5c73c1 |
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_... | nlakshmanan/Transformer | Norm | false | 10,641 | [
"Apache-2.0"
] | 0 | 4562f8e9b282d0a70f26903a7b4410cb6132364b | https://github.com/nlakshmanan/Transformer/tree/4562f8e9b282d0a70f26903a7b4410cb6132364b |
ConcatModel | import torch
import torch.nn.functional
class ConcatModel(torch.nn.Module):
def __init__(self):
super(ConcatModel, self).__init__()
def forward(self, x):
return torch.concat([x, 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.functional
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | elad-c/model_optimization | ConcatModel | false | 10,642 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
CatModel | import torch
import torch.nn.functional
class CatModel(torch.nn.Module):
def __init__(self):
super(CatModel, self).__init__()
def forward(self, x):
return torch.cat([x, 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.functional
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | elad-c/model_optimization | CatModel | false | 10,643 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
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, 256)
self.fc2 = nn.Linear(256, 2)
def forward(self, x):
x = F.relu(self.fc1(x))
x = self.fc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | rainwangphy/minimalRL | Qnet | false | 10,644 | [
"MIT"
] | 0 | 646cc771107f1b15098d7f52f0e7c4444862fb90 | https://github.com/rainwangphy/minimalRL/tree/646cc771107f1b15098d7f52f0e7c4444862fb90 |
SparsemaxBisect | from torch.autograd import Function
import torch
import torch.nn as nn
def sparsemax_bisect(X, dim=-1, n_iter=50, ensure_sum_one=True):
"""sparsemax: normalizing sparse transform (a la softmax), via bisection.
Solves the projection:
min_p ||x - p||_2 s.t. p >= 0, sum(p) == 1.
Parameters
... | 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.autograd import Function
import torch.nn as nn
assert_size_stride = torch._C._... | mtreviso/entmax | SparsemaxBisect | false | 10,645 | [
"MIT"
] | 0 | 5b029d07fe00d7aacc77c8e684a5796d29287575 | https://github.com/mtreviso/entmax/tree/5b029d07fe00d7aacc77c8e684a5796d29287575 |
AddNet | import torch
import torch.nn.functional
class AddNet(torch.nn.Module):
def __init__(self):
super(AddNet, self).__init__()
self.conv1 = torch.nn.Conv2d(3, 4, kernel_size=1, stride=1)
self.conv2 = torch.nn.Conv2d(3, 4, kernel_size=1, stride=1)
def forward(self, x, y):
x = self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_s... | elad-c/model_optimization | AddNet | false | 10,646 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
UNet | import torch
from torch import nn
import torch.nn.functional as F
from torchvision import models
class UNet(nn.Module):
"""
The U-Net Convolutional Neural Network for semantic segmentation
Source material for the algorithm:
https://link.springer.com/chapter/10.1007%2F978-3-319-24574-4_28
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 tor... | mattesko/torch-toolkit | UNet | false | 10,647 | [
"MIT"
] | 0 | 1b4526640232843bdd4022c86cf1856e2e3248b0 | https://github.com/mattesko/torch-toolkit/tree/1b4526640232843bdd4022c86cf1856e2e3248b0 |
minibatch_std_concat_layer | import copy
import torch
import torch.nn as nn
class minibatch_std_concat_layer(nn.Module):
def __init__(self, averaging='all'):
super(minibatch_std_concat_layer, self).__init__()
self.averaging = averaging.lower()
if 'group' in self.averaging:
self.n = int(self.averaging[5:])... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | mikanCan/PG-GAN | minibatch_std_concat_layer | false | 10,648 | [
"MIT"
] | 0 | bc4a1bd2101f836c22a164174381f80b3f5c73c1 | https://github.com/mikanCan/PG-GAN/tree/bc4a1bd2101f836c22a164174381f80b3f5c73c1 |
Actor | import torch
import torch.nn.functional as F
import torch.nn as nn
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=200,
fc2_units=150):
"""Initialize parameters and build model.
Params
======
state_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.... | rafapi/PMTG | Actor | false | 10,649 | [
"Apache-2.0"
] | 0 | 8a89a3dd9620e2fdf747d20781b46daebd41569c | https://github.com/rafapi/PMTG/tree/8a89a3dd9620e2fdf747d20781b46daebd41569c |
Entmax15 | from torch.autograd import Function
import torch
import torch.nn as nn
def _make_ix_like(X, dim):
d = X.size(dim)
rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype)
view = [1] * X.dim()
view[0] = -1
return rho.view(view).transpose(0, dim)
def _roll_last(X, dim):
if dim == -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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd import F... | mtreviso/entmax | Entmax15 | false | 10,650 | [
"MIT"
] | 0 | 5b029d07fe00d7aacc77c8e684a5796d29287575 | https://github.com/mtreviso/entmax/tree/5b029d07fe00d7aacc77c8e684a5796d29287575 |
fadein_layer | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class fadein_layer(nn.Module):
def __init__(self, config):
super(fadein_layer, self).__init__()
self.alpha = 0.0
def update_alpha(self, delta):
self.alpha = self.alpha + delta
self.alpha = max(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... | mikanCan/PG-GAN | fadein_layer | false | 10,651 | [
"MIT"
] | 0 | bc4a1bd2101f836c22a164174381f80b3f5c73c1 | https://github.com/mikanCan/PG-GAN/tree/bc4a1bd2101f836c22a164174381f80b3f5c73c1 |
BertPreTrainingHeads | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
def gelu(x):
"""Gaussian Error Linear Unitという活性化関数です。
LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。
"""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class BertLayerNorm(nn.Module):
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
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | Cyndi-Tokyotech/Fin_Text_Analysis_ML | BertPreTrainingHeads | false | 10,652 | [
"MIT"
] | 0 | 7f9b6c1ea78f8e6f32c003b2de32809722df88d4 | https://github.com/Cyndi-Tokyotech/Fin_Text_Analysis_ML/tree/7f9b6c1ea78f8e6f32c003b2de32809722df88d4 |
ReshapeNet | import torch
import torch.nn.functional
class ReshapeNet(torch.nn.Module):
def __init__(self):
super(ReshapeNet, self).__init__()
self.conv1 = torch.nn.Conv2d(3, 4, kernel_size=1, stride=1)
def forward(self, x):
x = self.conv1(x)
batch, channels, height, width = x.size()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_s... | elad-c/model_optimization | ReshapeNet | false | 10,653 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
MultiHeadAttention | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, heads, d_model, dropout=0.1):
super().__init__()
self.d_model = d_model
self.d_k = d_model // heads
self.h = heads
self.q_linear1 = nn.Par... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | nlakshmanan/Transformer | MultiHeadAttention | false | 10,654 | [
"Apache-2.0"
] | 0 | 4562f8e9b282d0a70f26903a7b4410cb6132364b | https://github.com/nlakshmanan/Transformer/tree/4562f8e9b282d0a70f26903a7b4410cb6132364b |
ReuseLayerNet | import torch
import torch.nn.functional
class ReuseLayerNet(torch.nn.Module):
def __init__(self):
super(ReuseLayerNet, self).__init__()
self.conv1 = torch.nn.Conv2d(3, 3, kernel_size=1, stride=1)
self.conv2 = torch.nn.Conv2d(3, 3, kernel_size=1, stride=1)
self.identity = torch.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.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_s... | elad-c/model_optimization | ReuseLayerNet | false | 10,655 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
BinaryLoss | import functools
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
def binary_ce_loss(pred, label, **kwargs):
loss = F.binary_cross_entropy(pred, label, reduction='none')
loss = torch.mean(loss, dim=(1, 2))
return loss
def reduce_loss(loss, red... | 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 func... | puzzledsky/mmsegmentation-lesion | BinaryLoss | false | 10,656 | [
"Apache-2.0"
] | 0 | 522efceab6735dfec13acf6f45dc6bfdb35cfd60 | https://github.com/puzzledsky/mmsegmentation-lesion/tree/522efceab6735dfec13acf6f45dc6bfdb35cfd60 |
SoftMaxAvgPoolModel | import torch
import torch.cuda
import torch.nn
import torch.utils.data
import torch.fx
import torch.utils.tensorboard._pytorch_graph
import torch.onnx.symbolic_caffe2
class SoftMaxAvgPoolModel(torch.nn.Module):
def __init__(self):
super(SoftMaxAvgPoolModel, self).__init__()
self.sfmax = torch.nn.... | 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.cuda
impo... | quic-araha/aimet | SoftMaxAvgPoolModel | false | 10,657 | [
"BSD-3-Clause"
] | 0 | 1afd5ce23f06bed74fec9812d5d2ea256ac4a650 | https://github.com/quic-araha/aimet/tree/1afd5ce23f06bed74fec9812d5d2ea256ac4a650 |
HardtanhBoundToPOTNet | import torch
from torch.nn.functional import relu
from torch.nn import Conv2d
from torch.nn import Hardtanh
from torch.nn.functional import hardtanh
import torch.nn.functional
class HardtanhBoundToPOTNet(torch.nn.Module):
def __init__(self):
super(HardtanhBoundToPOTNet, self).__init__()
self.conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 Conv2d
f... | elad-c/model_optimization | HardtanhBoundToPOTNet | false | 10,658 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
TorchTensorAttrNet | import torch
import torch.nn.functional
class TorchTensorAttrNet(torch.nn.Module):
def __init__(self):
super(TorchTensorAttrNet, self).__init__()
self.conv1 = torch.nn.Conv2d(3, 4, kernel_size=1, stride=1)
def forward(self, x):
x = self.conv1(x)
x = x * x.size(1)
retu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_s... | elad-c/model_optimization | TorchTensorAttrNet | false | 10,659 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
ReLUBoundToPOTNet | import torch
from torch.nn import ReLU
from torch.nn import ReLU6
from torch.nn.functional import relu
from torch.nn.functional import relu6
from torch.nn import Conv2d
import torch.nn.functional
class ReLUBoundToPOTNet(torch.nn.Module):
def __init__(self):
super(ReLUBoundToPOTNet, 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.nn import ReLU
fro... | elad-c/model_optimization | ReLUBoundToPOTNet | false | 10,660 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
focal_loss | import torch
import torch.nn.functional as F
class focal_loss(torch.nn.Module):
"""
Loss function for classification tasks with
large data imbalance. Focal loss (FL) is define as:
FL(p_t) = -alpha*((1-p_t)^gamma))*log(p_t),
where p_t is a cross-entropy loss for binary classification.
For more... | 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
assert_size... | miguel-fc/atomai | focal_loss | false | 10,661 | [
"MIT"
] | 0 | f51699ef5e1bfc577781977d38f7414b1b51449d | https://github.com/miguel-fc/atomai/tree/f51699ef5e1bfc577781977d38f7414b1b51449d |
SplitConcatNet | import torch
import torch.nn.functional
class SplitConcatNet(torch.nn.Module):
def __init__(self):
super(SplitConcatNet, self).__init__()
self.conv1 = torch.nn.Conv2d(3, 3, kernel_size=1, stride=1)
self.conv2 = torch.nn.Conv2d(1, 3, kernel_size=1, stride=1)
self.conv3 = torch.nn.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
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_s... | elad-c/model_optimization | SplitConcatNet | false | 10,662 | [
"Apache-2.0"
] | 0 | b0ecf41c3f9434008d57d7fe724ff8585e19d4cc | https://github.com/elad-c/model_optimization/tree/b0ecf41c3f9434008d57d7fe724ff8585e19d4cc |
SplitAndConcat | import torch
import torch.nn as nn
import torch.quantization.quantize_fx
import torch.utils.data
class SplitAndConcat(nn.Module):
"""Split the data from split_dim and concatenate in concat_dim.
@param split_dim from which axis the data will be chunk
@param concat_dim to which axis the data will be concat... | 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.quantization.quantize_fx
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size... | petoor/d2go | SplitAndConcat | false | 10,663 | [
"Apache-2.0"
] | 0 | d0a20d048738f447945d7c948a8d3019a110d2e8 | https://github.com/petoor/d2go/tree/d0a20d048738f447945d7c948a8d3019a110d2e8 |
UNet | import torch
import torch.nn as nn
class double_conv(nn.Module):
def __init__(self, input_channels, output_channels):
super(double_conv, self).__init__()
self.conv1 = nn.Conv2d(input_channels, output_channels, kernel_size
=3, padding='same')
self.conv2 = nn.Conv2d(output_chann... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | mhakyash/UNet-MNIST-denoising | UNet | false | 10,664 | [
"MIT"
] | 0 | 0e3c20cbb3f34af575e33209425ae4d7cb0bcd82 | https://github.com/mhakyash/UNet-MNIST-denoising/tree/0e3c20cbb3f34af575e33209425ae4d7cb0bcd82 |
UpsampleBlock | import torch
import torch.nn.functional as F
import torch.nn as nn
class UpsampleBlock(nn.Module):
"""
Defines upsampling block performed using bilinear
or nearest-neigbor interpolation followed by 1-by-1 convolution
(the latter can be used to reduce a number of feature channels)
Args:
nd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | miguel-fc/atomai | UpsampleBlock | false | 10,665 | [
"MIT"
] | 0 | f51699ef5e1bfc577781977d38f7414b1b51449d | https://github.com/miguel-fc/atomai/tree/f51699ef5e1bfc577781977d38f7414b1b51449d |
KeypointRCNNPredictorNoUpscale | import torch
import torch.nn as nn
import torch.quantization.quantize_fx
import torch.utils.data
class KeypointRCNNPredictorNoUpscale(nn.Module):
def __init__(self, in_channels, num_keypoints):
super(KeypointRCNNPredictorNoUpscale, self).__init__()
input_features = in_channels
deconv_kern... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.quantization.quantize_fx
import torch.utils.d... | petoor/d2go | KeypointRCNNPredictorNoUpscale | false | 10,666 | [
"Apache-2.0"
] | 0 | d0a20d048738f447945d7c948a8d3019a110d2e8 | https://github.com/petoor/d2go/tree/d0a20d048738f447945d7c948a8d3019a110d2e8 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target):
N = target.size(0)
smooth = 1
input_flat = input.view(N, -1)
target_flat = target.view(N, -1)
intersection = in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | phenixcxz/DeepGlobe-Road-Extraction-Challenge | DiceLoss | false | 10,667 | [
"MIT"
] | 0 | 4dee0f0866ff6f06b888afd28a60940b75a8eadd | https://github.com/phenixcxz/DeepGlobe-Road-Extraction-Challenge/tree/4dee0f0866ff6f06b888afd28a60940b75a8eadd |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 6)
self.l2 = nn.Linear(6, 4)
self.l3 = nn.Linear(4, 1)
self.l4 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | pkj415/CityLearn-2 | Critic | false | 10,668 | [
"MIT"
] | 0 | 003012ddeb52868d42d85b835a9a5f2c28008927 | https://github.com/pkj415/CityLearn-2/tree/003012ddeb52868d42d85b835a9a5f2c28008927 |
MulticlassDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target):
N = target.size(0)
smooth = 1
input_flat = input.view(N, -1)
target_flat = target.view(N, -1)
intersection = in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | phenixcxz/DeepGlobe-Road-Extraction-Challenge | MulticlassDiceLoss | false | 10,669 | [
"MIT"
] | 0 | 4dee0f0866ff6f06b888afd28a60940b75a8eadd | https://github.com/phenixcxz/DeepGlobe-Road-Extraction-Challenge/tree/4dee0f0866ff6f06b888afd28a60940b75a8eadd |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.attention_head_size = int(config.hidden_size / config.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | priyamtejaswin/minbert-assignment | BertSelfAttention | false | 10,670 | [
"Apache-2.0"
] | 0 | fd41a54441916a6d421640bbee910f64786b303d | https://github.com/priyamtejaswin/minbert-assignment/tree/fd41a54441916a6d421640bbee910f64786b303d |
VariableBoxMLP | import torch
import torch.optim
import torch.jit
import torch.nn as nn
class VariableBoxMLP(nn.Module):
def __init__(self, num_in_features: 'int', num_out_features: 'int',
neurons_per_layer: 'int', hidden_layers: 'int'):
super(VariableBoxMLP, self).__init__()
self.hidden_layers = hidden_l... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.optim
... | plaveczlambert/nonlinearbubbledynamics | VariableBoxMLP | false | 10,671 | [
"MIT"
] | 0 | 190c5170f7ff6068badeee818c01226c55aaec97 | https://github.com/plaveczlambert/nonlinearbubbledynamics/tree/190c5170f7ff6068badeee818c01226c55aaec97 |
TilePad2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class TilePad2d(nn.Module):
def __init__(self, left, right, top, bottom):
super().__init__()
self.left = left
self.right = right
self.top = top
self.bottom = bottom
def forward(self, x):
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... | mkarmann/conway-reversed | TilePad2d | false | 10,672 | [
"MIT"
] | 0 | a3ae10dd5768affb9caf193a246395ee0fb2bc6f | https://github.com/mkarmann/conway-reversed/tree/a3ae10dd5768affb9caf193a246395ee0fb2bc6f |
SimpleMLP | import torch
import torch.optim
import torch.jit
import torch.nn as nn
class SimpleMLP(nn.Module):
def __init__(self, num_in_features: 'int', num_out_features: 'int',
neurons_per_layer: 'int'):
super(SimpleMLP, self).__init__()
self.act = nn.ELU()
self.l_in = nn.Linear(in_features... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.optim
... | plaveczlambert/nonlinearbubbledynamics | SimpleMLP | false | 10,673 | [
"MIT"
] | 0 | 190c5170f7ff6068badeee818c01226c55aaec97 | https://github.com/plaveczlambert/nonlinearbubbledynamics/tree/190c5170f7ff6068badeee818c01226c55aaec97 |
EncoderLayer | import math
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.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.... | nlakshmanan/Transformer | EncoderLayer | false | 10,674 | [
"Apache-2.0"
] | 0 | 4562f8e9b282d0a70f26903a7b4410cb6132364b | https://github.com/nlakshmanan/Transformer/tree/4562f8e9b282d0a70f26903a7b4410cb6132364b |
HighwayCNN | import torch
import torch.nn as nn
class HighwayCNN(nn.Module):
def __init__(self, input_size, gate_bias=-1, activation_function=nn.
functional.relu, gate_activation=nn.functional.softmax):
super(HighwayCNN, self).__init__()
self.activation_function = activation_function
self.gate... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | okcd00/glyce | HighwayCNN | false | 10,675 | [
"Apache-2.0"
] | 0 | 010d88ac5cff4969308d2f8d105831ddcb352a02 | https://github.com/okcd00/glyce/tree/010d88ac5cff4969308d2f8d105831ddcb352a02 |
HighwayMLP | import torch
import torch.nn as nn
class HighwayMLP(nn.Module):
def __init__(self, input_size, gate_bias=-2, activation_function=nn.
functional.relu, gate_activation=nn.functional.softmax):
super(HighwayMLP, self).__init__()
self.activation_function = activation_function
self.gate... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | okcd00/glyce | HighwayMLP | false | 10,676 | [
"Apache-2.0"
] | 0 | 010d88ac5cff4969308d2f8d105831ddcb352a02 | https://github.com/okcd00/glyce/tree/010d88ac5cff4969308d2f8d105831ddcb352a02 |
DecoderLayer | import math
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.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.... | nlakshmanan/Transformer | DecoderLayer | false | 10,677 | [
"Apache-2.0"
] | 0 | 4562f8e9b282d0a70f26903a7b4410cb6132364b | https://github.com/nlakshmanan/Transformer/tree/4562f8e9b282d0a70f26903a7b4410cb6132364b |
TiledConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class TiledConv2d(nn.Module):
def __init__(self, in_features, out_features):
super().__init__()
self.conv = nn.Conv2d(in_features, out_features, kernel_size=3,
bias=False)
def forward(self, x):
return self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | mkarmann/conway-reversed | TiledConv2d | false | 10,678 | [
"MIT"
] | 0 | a3ae10dd5768affb9caf193a246395ee0fb2bc6f | https://github.com/mkarmann/conway-reversed/tree/a3ae10dd5768affb9caf193a246395ee0fb2bc6f |
PositionWiseFFN | import torch
from torch import nn
from torch.nn.functional import relu
class PositionWiseFFN(nn.Module):
def __init__(self, model_dim, dropout=0.0):
super().__init__()
dff = model_dim * 4
self.l = nn.Linear(model_dim, dff)
self.o = nn.Linear(dff, model_dim)
self.dropout = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | richardzhangy26/NLP-Tutorials | PositionWiseFFN | false | 10,679 | [
"MIT"
] | 0 | ddf123853c53cef1142207c3a4fb9aa6ac87febd | https://github.com/richardzhangy26/NLP-Tutorials/tree/ddf123853c53cef1142207c3a4fb9aa6ac87febd |
PoseRegHead | import torch
import torch.nn as nn
import torch.nn.functional as F
def _get_fc_layer(in_cn, out_cn):
x = nn.Linear(in_cn, out_cn)
x.bias.data.zero_()
nn.init.normal_(x.weight, 0.0, 0.001)
return x
class PoseRegHead(nn.Module):
def __init__(self, dim_in, dim_out, num_units=4096):
super(P... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | mrlooi/PoseCNN | PoseRegHead | false | 10,680 | [
"MIT"
] | 0 | c103bd7dc743edbc9c7cc8a4687b035e3d1150f6 | https://github.com/mrlooi/PoseCNN/tree/c103bd7dc743edbc9c7cc8a4687b035e3d1150f6 |
FCNet | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class FCNet(nn.Module):
def __init__(self):
super(FCNet, self).__init__()
self.fc1 = nn.Linear(3 * 28 * 28, 128)
self.fc2 = nn.Linear(128, 5)
def forward(self, x):
x = x.vie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | rilu0361/mytorch | FCNet | false | 10,681 | [
"MIT"
] | 0 | 9f00b830b3ce8fdf942cd19704dedfe6ffd359a5 | https://github.com/rilu0361/mytorch/tree/9f00b830b3ce8fdf942cd19704dedfe6ffd359a5 |
MultiHeadSelfAttention | from torch.nn import Module
import torch
from torch.nn import Dropout
from torch.nn import Linear
from torch.nn.modules import Dropout
def masked_softmax(vector: 'torch.Tensor', mask: 'torch.Tensor', dim: 'int'=-1
) ->torch.Tensor:
"""
``torch.nn.functional.softmax(vector)`` does not work if some elements... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | okcd00/glyce | MultiHeadSelfAttention | false | 10,682 | [
"Apache-2.0"
] | 0 | 010d88ac5cff4969308d2f8d105831ddcb352a02 | https://github.com/okcd00/glyce/tree/010d88ac5cff4969308d2f8d105831ddcb352a02 |
StatsPool | import torch
import torch.nn as nn
class StatsPool(nn.Module):
def __init__(self, floor=1e-10, bessel=False):
super(StatsPool, self).__init__()
self.floor = floor
self.bessel = bessel
def forward(self, x):
means = torch.mean(x, dim=1)
_, t, _ = x.shape
if self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | penguinwang96825/Umigame | StatsPool | false | 10,683 | [
"Apache-2.0"
] | 0 | 98d647ab6f40df08fe31d6b3bc444afe229a914e | https://github.com/penguinwang96825/Umigame/tree/98d647ab6f40df08fe31d6b3bc444afe229a914e |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, *args):
super().__init__()
def forward(self, activation):
if len(activation.size()) == 3:
ori_size = activation.size()
activation = activation.view(-1, activation.size(-1))
else:... | 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_... | mansoorcheema/segan_pytorch | LayerNorm | false | 10,684 | [
"MIT"
] | 0 | 8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65 | https://github.com/mansoorcheema/segan_pytorch/tree/8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65 |
convTranspose23DUnit | import torch
import numpy as np
import torch.nn as nn
import torch.nn.init as init
import torch.nn.init
class convTranspose23DUnit(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, output_padding=0, groups=1, bias=True, dilation=1, nd=2):
super(convTransp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.init as init
import tor... | navid0308/medSynthesisV1 | convTranspose23DUnit | false | 10,685 | [
"MIT"
] | 0 | 6731a67d0eb9bb3e0c1646f01feb24229aa4fe30 | https://github.com/navid0308/medSynthesisV1/tree/6731a67d0eb9bb3e0c1646f01feb24229aa4fe30 |
residualUnit | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
import torch.nn.init
class conv23DUnit(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=True, dilation=1, nd=2):
super(conv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | navid0308/medSynthesisV1 | residualUnit | false | 10,686 | [
"MIT"
] | 0 | 6731a67d0eb9bb3e0c1646f01feb24229aa4fe30 | https://github.com/navid0308/medSynthesisV1/tree/6731a67d0eb9bb3e0c1646f01feb24229aa4fe30 |
CombFilter | import torch
import torch.nn as nn
import torch.nn.functional as F
class CombFilter(nn.Module):
def __init__(self, ninputs, fmaps, L):
super().__init__()
self.L = L
self.filt = nn.Conv1d(ninputs, fmaps, 2, dilation=L, bias=False)
r_init_weight = torch.ones(ninputs * fmaps, 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... | mansoorcheema/segan_pytorch | CombFilter | false | 10,687 | [
"MIT"
] | 0 | 8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65 | https://github.com/mansoorcheema/segan_pytorch/tree/8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65 |
quadexp | import torch
import torch as tr
import torch.nn as nn
class quadexp(nn.Module):
def __init__(self, sigma=2.0):
super(quadexp, self).__init__()
self.sigma = sigma
def forward(self, x: 'tr.Tensor'):
return tr.exp(-x ** 2 / self.sigma ** 2)
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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | pierreglaser/MMD-gradient-flow | quadexp | false | 10,688 | [
"BSD-3-Clause"
] | 0 | 43591137e1d04bed5153887a364fae72621b01ae | https://github.com/pierreglaser/MMD-gradient-flow/tree/43591137e1d04bed5153887a364fae72621b01ae |
power | import torch
import torch as tr
import torch.nn as nn
class power(nn.Module):
def __init__(self):
super(power, self).__init__()
def forward(self, x: 'tr.Tensor'):
return x.pow(2)
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... | pierreglaser/MMD-gradient-flow | power | false | 10,689 | [
"BSD-3-Clause"
] | 0 | 43591137e1d04bed5153887a364fae72621b01ae | https://github.com/pierreglaser/MMD-gradient-flow/tree/43591137e1d04bed5153887a364fae72621b01ae |
MultiNonLinearClassifier | import torch
import torch.nn as nn
class MultiNonLinearClassifier(nn.Module):
def __init__(self, hidden_size, num_label):
super(MultiNonLinearClassifier, self).__init__()
self.num_label = num_label
self.classifier1 = nn.Linear(hidden_size, int(hidden_size / 2))
self.classifier2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | okcd00/glyce | MultiNonLinearClassifier | false | 10,690 | [
"Apache-2.0"
] | 0 | 010d88ac5cff4969308d2f8d105831ddcb352a02 | https://github.com/okcd00/glyce/tree/010d88ac5cff4969308d2f8d105831ddcb352a02 |
Conv2dWithConstraint | import torch
import torch.nn as nn
class Conv2dWithConstraint(nn.Conv2d):
def __init__(self, *args, max_norm=1, **kwargs):
self.max_norm = max_norm
super(Conv2dWithConstraint, self).__init__(*args, **kwargs)
def forward(self, x):
self.weight.data = torch.renorm(self.weight.data, p=2,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | rmpeng/TIE-EEGNet | Conv2dWithConstraint | false | 10,691 | [
"MIT"
] | 0 | 69817fce3edb67f68bf4e85b53596f122dbc78fb | https://github.com/rmpeng/TIE-EEGNet/tree/69817fce3edb67f68bf4e85b53596f122dbc78fb |
laplace | import torch
import torch as tr
import torch.nn as nn
class laplace(nn.Module):
def __init__(self, lambda_=2.0):
super(laplace, self).__init__()
self.lambda_ = lambda_
def forward(self, x: 'tr.Tensor'):
return tr.exp(-self.lambda_ * tr.abs(x))
def get_inputs():
return [torch.ra... | 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... | pierreglaser/MMD-gradient-flow | laplace | false | 10,692 | [
"BSD-3-Clause"
] | 0 | 43591137e1d04bed5153887a364fae72621b01ae | https://github.com/pierreglaser/MMD-gradient-flow/tree/43591137e1d04bed5153887a364fae72621b01ae |
BertLayer | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.attention_head_size = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | priyamtejaswin/minbert-assignment | BertLayer | false | 10,693 | [
"Apache-2.0"
] | 0 | fd41a54441916a6d421640bbee910f64786b303d | https://github.com/priyamtejaswin/minbert-assignment/tree/fd41a54441916a6d421640bbee910f64786b303d |
cosine | import torch
import torch as tr
import torch.nn as nn
class cosine(nn.Module):
def __init__(self):
super(cosine, self).__init__()
def forward(self, x: 'tr.Tensor'):
return tr.cos(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | pierreglaser/MMD-gradient-flow | cosine | false | 10,694 | [
"BSD-3-Clause"
] | 0 | 43591137e1d04bed5153887a364fae72621b01ae | https://github.com/pierreglaser/MMD-gradient-flow/tree/43591137e1d04bed5153887a364fae72621b01ae |
OptimizedMLP | import torch
import torch.optim
import torch.jit
import torch.nn as nn
class OptimizedMLP(nn.Module):
def __init__(self, num_in_features: 'int', num_out_features: 'int'):
super(OptimizedMLP, self).__init__()
self.act = nn.ELU()
self.l_in = nn.Linear(in_features=num_in_features, out_featur... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.optim
... | plaveczlambert/nonlinearbubbledynamics | OptimizedMLP | false | 10,695 | [
"MIT"
] | 0 | 190c5170f7ff6068badeee818c01226c55aaec97 | https://github.com/plaveczlambert/nonlinearbubbledynamics/tree/190c5170f7ff6068badeee818c01226c55aaec97 |
ScoreCap | import torch
from torch import nn
import torch.nn
import torch.optim
class ScoreCap(nn.Module):
def __init__(self, cap: 'float'):
super().__init__()
self.cap = cap
def forward(self, input):
return torch.clip(input, max=self.cap)
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
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.nn
import torch.optim
assert_size_stride = torch._C._dy... | mikaylagawarecki/ReAgent | ScoreCap | false | 10,696 | [
"BSD-3-Clause"
] | 0 | b1a306a9d3641c8adeb03ac272e5774a0009fa88 | https://github.com/mikaylagawarecki/ReAgent/tree/b1a306a9d3641c8adeb03ac272e5774a0009fa88 |
Concat | import torch
from torch import nn
import torch.nn
import torch.optim
class Concat(nn.Module):
def forward(self, state: 'torch.Tensor', action: 'torch.Tensor'):
return torch.cat((state, action), dim=-1)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inpu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda =... | mikaylagawarecki/ReAgent | Concat | false | 10,697 | [
"BSD-3-Clause"
] | 0 | b1a306a9d3641c8adeb03ac272e5774a0009fa88 | https://github.com/mikaylagawarecki/ReAgent/tree/b1a306a9d3641c8adeb03ac272e5774a0009fa88 |
imq | import torch
import torch as tr
import torch.nn as nn
class imq(nn.Module):
def __init__(self, c=1.0):
super(imq, self).__init__()
self.c = c
def forward(self, x: 'tr.Tensor'):
return 1 / (self.c ** 2 + x ** 2)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_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... | pierreglaser/MMD-gradient-flow | imq | false | 10,698 | [
"BSD-3-Clause"
] | 0 | 43591137e1d04bed5153887a364fae72621b01ae | https://github.com/pierreglaser/MMD-gradient-flow/tree/43591137e1d04bed5153887a364fae72621b01ae |
ResARModule | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.spectral_norm import spectral_norm
from torch.nn.utils.weight_norm import weight_norm
def build_norm_layer(norm_type, param=None, num_feats=None):
if norm_type == 'bnorm':
return nn.BatchNorm1d(num_feats)
elif norm_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn.utils.spectral_norm import spectral_norm
fro... | mansoorcheema/segan_pytorch | ResARModule | false | 10,699 | [
"MIT"
] | 0 | 8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65 | https://github.com/mansoorcheema/segan_pytorch/tree/8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65 |
ContractiveAutoencoder | import torch
import torch.utils.data
import torch.nn as nn
class ContractiveAutoencoder(nn.Module):
"""
Simple contractive autoencoder with a single hidden layer.
Constructor parameters:
- num_inputs: Number of input features
- num_hidden_layer_inputs: Number of input features for the sin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | rocklegende/DL2020_R3 | ContractiveAutoencoder | false | 10,700 | [
"MIT"
] | 0 | 467ed759a9f9935d56863c79f71040e922d72829 | https://github.com/rocklegende/DL2020_R3/tree/467ed759a9f9935d56863c79f71040e922d72829 |
Discrete | import torch
import torch.nn as nn
class Discrete(nn.Module):
def __init__(self, num_outputs):
super(Discrete, self).__init__()
def forward(self, x):
probs = nn.functional.softmax(x, dim=0)
dist = torch.distributions.Categorical(probs=probs)
return dist.entropy()
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | rsomani95/client | Discrete | false | 10,701 | [
"MIT"
] | 0 | 772c6de325b30323397cfb98ab7e126910c5912b | https://github.com/rsomani95/client/tree/772c6de325b30323397cfb98ab7e126910c5912b |
TransformerEncoderLayer | import torch
from torch import nn
import torch.nn.functional as F
from typing import Optional
class LearnedRelativePositionalEmbedding(nn.Module):
"""
This module learns relative positional embeddings up to a fixed
maximum size. These are masked for decoder and unmasked for encoder
self attention.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | neuroidss/silent_speech | TransformerEncoderLayer | false | 10,702 | [
"MIT"
] | 0 | 4a6d8e944007071de02261bfd7f8ecedd9a06ccd | https://github.com/neuroidss/silent_speech/tree/4a6d8e944007071de02261bfd7f8ecedd9a06ccd |
LinearLR | import torch
import torch.nn as nn
class LinearLR(nn.Module):
"""[u * v + res] version of torch.nn.Linear"""
def __init__(self, in_features, out_features, rank_ratio=0.25, bias=
True, device=None, dtype=None):
super().__init__()
sliced_rank = int(min(in_features, out_features) * rank_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | razered/alternate | LinearLR | false | 10,703 | [
"MIT"
] | 0 | 18e876aadc76d5f675cf940549b4bcd6e80a0288 | https://github.com/razered/alternate/tree/18e876aadc76d5f675cf940549b4bcd6e80a0288 |
ProposalNet | import torch
from torch import nn
import torch.utils.data
class ProposalNet(nn.Module):
def __init__(self):
super(ProposalNet, self).__init__()
self.down1 = nn.Conv2d(2048, 128, 3, 1, 1)
self.down2 = nn.Conv2d(128, 128, 3, 2, 1)
self.down3 = nn.Conv2d(128, 128, 3, 2, 1)
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 import triton_helpers
from torch import nn
import t... | mobulan/NTS-Net | ProposalNet | false | 10,704 | [
"MIT"
] | 0 | 9246c33b9e9aed2514f53fd0aef48c8ed3eb91d3 | https://github.com/mobulan/NTS-Net/tree/9246c33b9e9aed2514f53fd0aef48c8ed3eb91d3 |
ConvLR | import torch
import torch.nn as nn
class ConvLR(nn.Module):
"""[u * v + res] version of torch.nn.ConvLR"""
def __init__(self, in_planes, out_planes, kernel_size, stride, padding,
rank_ratio=0.25, bias=True, device=None, dtype=None):
super().__init__()
sliced_rank = int(min(in_planes, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | razered/alternate | ConvLR | false | 10,705 | [
"MIT"
] | 0 | 18e876aadc76d5f675cf940549b4bcd6e80a0288 | https://github.com/razered/alternate/tree/18e876aadc76d5f675cf940549b4bcd6e80a0288 |
LocationNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class LocationNetwork(nn.Module):
"""
Uses the internal state `h_t` of the core network to
produce the location coordinates `l_t` for the next
time step.
Concretely, feeds the hidden state `h_t` through a fc
layer followed by ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | reinvantveer/topography-detection | LocationNetwork | false | 10,706 | [
"MIT"
] | 0 | b471dbaa1bc276584374ed3bb5382e2d63046611 | https://github.com/reinvantveer/topography-detection/tree/b471dbaa1bc276584374ed3bb5382e2d63046611 |
CoreNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class CoreNetwork(nn.Module):
"""
An RNN that maintains an internal state that integrates
information extracted from the history of past observations.
It encodes the agent's knowledge of the environment through
a state vector `h_t`... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | reinvantveer/topography-detection | CoreNetwork | false | 10,707 | [
"MIT"
] | 0 | b471dbaa1bc276584374ed3bb5382e2d63046611 | https://github.com/reinvantveer/topography-detection/tree/b471dbaa1bc276584374ed3bb5382e2d63046611 |
Decoder | import torch
from torch import nn
class Decoder(nn.Module):
def __init__(self, latent_channel_dim):
super(Decoder, self).__init__()
self.t_conv1 = nn.ConvTranspose2d(in_channels=latent_channel_dim,
out_channels=16, kernel_size=(2, 2), stride=(2, 2))
self.t_conv2 = nn.ConvTrans... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | quickgrid/CodeLab | Decoder | false | 10,708 | [
"MIT"
] | 0 | 710ebf107b7938f09c055e806c1fed5574d91308 | https://github.com/quickgrid/CodeLab/tree/710ebf107b7938f09c055e806c1fed5574d91308 |
PixelShuffle2d | import functools
import torch
from torch import nn
import torch.nn.functional as F
class PixelShuffle2d(nn.Conv2d):
def __init__(self, in_nc, out_nc, kernel_size: 'int', scale: 'int'=2,
**kwargs):
super().__init__(in_nc, out_nc * scale * scale, kernel_size, **kwargs)
self.up = functools.p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import functools
from torch import nn
import torch.nn.functional as F
assert_siz... | pomelyu/ML_HW | PixelShuffle2d | false | 10,709 | [
"MIT"
] | 0 | b87697f3ee86592a34d80c8dbf167a5767731630 | https://github.com/pomelyu/ML_HW/tree/b87697f3ee86592a34d80c8dbf167a5767731630 |
AttentionBlock | import torch
from torch import nn
class AttentionBlock(nn.Module):
def __init__(self, in_nc, out_nc, nd, bias=False):
super().__init__()
self.in_nc = in_nc
self.Wq = nn.Linear(in_nc, nd, bias=bias)
self.Wk = nn.Linear(in_nc, nd, bias=bias)
self.Wv = nn.Linear(in_nc, out_nc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 im... | pomelyu/ML_HW | AttentionBlock | false | 10,710 | [
"MIT"
] | 0 | b87697f3ee86592a34d80c8dbf167a5767731630 | https://github.com/pomelyu/ML_HW/tree/b87697f3ee86592a34d80c8dbf167a5767731630 |
DeConv2d | import functools
import torch
from torch import nn
from typing import Optional
import torch.nn.functional as F
class DeConv2d(nn.Conv2d):
def __init__(self, in_nc: 'int', out_nc: 'int', kernel_size: 'int',
scale: 'int'=2, mode: 'str'='nearest', align_corners:
'Optional[bool]'=None, **kwargs):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 functools
from torch import nn
from typing import Optional
import torch.n... | pomelyu/ML_HW | DeConv2d | false | 10,711 | [
"MIT"
] | 0 | b87697f3ee86592a34d80c8dbf167a5767731630 | https://github.com/pomelyu/ML_HW/tree/b87697f3ee86592a34d80c8dbf167a5767731630 |
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(1, 16, 5)
self.conv2 = nn.Conv2d(16, 32, 3)
self.conv3 = nn.Conv2d(32, 64, 2)
self.pool = nn.MaxPool2d(2, 2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | olbedo/AAIND-Facial-Keypoints | Net | false | 10,712 | [
"MIT"
] | 0 | 3d11094665d45feb312e375ee57e09ff7f601eb9 | https://github.com/olbedo/AAIND-Facial-Keypoints/tree/3d11094665d45feb312e375ee57e09ff7f601eb9 |
LinearNetwork | import torch
from typing import List
import torch.nn as nn
class LinearNetwork(nn.Module):
def __init__(self, input_size: 'int', output_size: 'int', hidden_layers:
'List[int]', activation: 'nn.Module'=nn.LeakyReLU):
super(LinearNetwork, self).__init__()
self.input_size = input_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 typing import List
import torch.nn as nn
assert_size_stride = torch._C._dyn... | redvinaa/multiagent-path-finding-continuous | LinearNetwork | false | 10,713 | [
"MIT"
] | 0 | 2d4ba3388f9b951c443ba72a33bd7af4f461275f | https://github.com/redvinaa/multiagent-path-finding-continuous/tree/2d4ba3388f9b951c443ba72a33bd7af4f461275f |
avgpool | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class avgpool(nn.Module):
"""
Mean pooling class - downsampling
"""
def __init__(self, up_size=0):
super(avgpool, self).__init__()
def forward(self, x):
out_man = (x[:, :, ::2, ::2] + x[:, :, 1::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
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | nathalia-kim/nu_gan | avgpool | false | 10,714 | [
"MIT"
] | 0 | c1d0891945bd7ac3d95869db91f490f57f203110 | https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110 |
Encoder | import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, latent_channel_dim):
super(Encoder, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=
(3, 3), stride=(1, 1), padding=(1, 1))
self.conv2 = nn.Conv2d(in_channels=16,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | quickgrid/CodeLab | Encoder | false | 10,715 | [
"MIT"
] | 0 | 710ebf107b7938f09c055e806c1fed5574d91308 | https://github.com/quickgrid/CodeLab/tree/710ebf107b7938f09c055e806c1fed5574d91308 |
myFeature | import torch
class myFeature(torch.nn.Module):
"""
Feature: sin(x)
"""
def __init__(self):
super(myFeature, self).__init__()
def forward(self, x):
return torch.sin(x[:, 0] * torch.pi) * torch.sin(x[:, 1] * torch.pi)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | ndem0/PINA | myFeature | false | 10,716 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
AdaptiveCos | import torch
from torch.nn.parameter import Parameter
class AdaptiveCos(torch.nn.Module):
"""
Implementation of soft exponential activation.
Shape:
- Input: (N, *) where * means, any number of additional
dimensions
- Output: (N, *), same shape as the input
Parameters:
... | 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.nn.parameter import Parameter
assert_size_stride = torch._C._d... | ndem0/PINA | AdaptiveCos | false | 10,717 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
AutoEncoder | import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, latent_channel_dim):
super(Encoder, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=
(3, 3), stride=(1, 1), padding=(1, 1))
self.conv2 = nn.Conv2d(in_channels=16,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | quickgrid/CodeLab | AutoEncoder | false | 10,718 | [
"MIT"
] | 0 | 710ebf107b7938f09c055e806c1fed5574d91308 | https://github.com/quickgrid/CodeLab/tree/710ebf107b7938f09c055e806c1fed5574d91308 |
AdaptiveSquare | import torch
from torch.nn.parameter import Parameter
class AdaptiveSquare(torch.nn.Module):
"""
Implementation of soft exponential activation.
Shape:
- Input: (N, *) where * means, any number of additional
dimensions
- Output: (N, *), same shape as the input
Parameters:
... | 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.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | ndem0/PINA | AdaptiveSquare | false | 10,719 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
AdaptiveSin | import torch
from torch.nn.parameter import Parameter
class AdaptiveSin(torch.nn.Module):
"""
Implementation of soft exponential activation.
Shape:
- Input: (N, *) where * means, any number of additional
dimensions
- Output: (N, *), same shape as the input
Parameters:
... | 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.nn.parameter import Parameter
assert_size_stride = torch._C._d... | ndem0/PINA | AdaptiveSin | false | 10,720 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
_netD_Q | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class _netD_Q(nn.Module):
"""
Second part of auxiliary network Q
"""
def __init__(self, nd=10):
super(_netD_Q, self).__init__()
self.linear = nn.Linear(128, nd, bias=True)
self.softmax = nn.Log... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | nathalia-kim/nu_gan | _netD_Q | false | 10,721 | [
"MIT"
] | 0 | c1d0891945bd7ac3d95869db91f490f57f203110 | https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110 |
TanhGaussianPolicy | import torch
from typing import List
from typing import Tuple
import torch.nn as nn
class LinearNetwork(nn.Module):
def __init__(self, input_size: 'int', output_size: 'int', hidden_layers:
'List[int]', activation: 'nn.Module'=nn.LeakyReLU):
super(LinearNetwork, self).__init__()
self.input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from typing import List
from ... | redvinaa/multiagent-path-finding-continuous | TanhGaussianPolicy | false | 10,722 | [
"MIT"
] | 0 | 2d4ba3388f9b951c443ba72a33bd7af4f461275f | https://github.com/redvinaa/multiagent-path-finding-continuous/tree/2d4ba3388f9b951c443ba72a33bd7af4f461275f |
AuxiliaryConvolutions | import torch
from torch import nn
import torch.nn.functional as F
from itertools import product as product
import torch.optim
import torch.utils.data
class AuxiliaryConvolutions(nn.Module):
"""
Additional convolutions to produce higher-level feature maps.
"""
def __init__(self):
super(Auxilia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ite... | mosevg/ssd | AuxiliaryConvolutions | false | 10,723 | [
"MIT"
] | 0 | 8fd9f6cc376c027427531bcf475188ae43c4b2d6 | https://github.com/mosevg/ssd/tree/8fd9f6cc376c027427531bcf475188ae43c4b2d6 |
ResidualBlock | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class avgpool(nn.Module):
"""
Mean pooling class - downsampling
"""
def __init__(self, up_size=0):
super(avgpool, self).__init__()
def forward(self, x):
out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | nathalia-kim/nu_gan | ResidualBlock | false | 10,724 | [
"MIT"
] | 0 | c1d0891945bd7ac3d95869db91f490f57f203110 | https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110 |
ResidualBlock_thefirstone | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class avgpool(nn.Module):
"""
Mean pooling class - downsampling
"""
def __init__(self, up_size=0):
super(avgpool, self).__init__()
def forward(self, x):
out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | nathalia-kim/nu_gan | ResidualBlock_thefirstone | false | 10,725 | [
"MIT"
] | 0 | c1d0891945bd7ac3d95869db91f490f57f203110 | https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110 |
AdaptiveReLU | import torch
from torch.nn.parameter import Parameter
class AdaptiveReLU(torch.nn.Module):
"""
Implementation of soft exponential activation.
Shape:
- Input: (N, *) where * means, any number of additional
dimensions
- Output: (N, *), same shape as the input
Parameters:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.ass... | ndem0/PINA | AdaptiveReLU | false | 10,726 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
AdaptiveTanh | import torch
from torch.nn.parameter import Parameter
class AdaptiveTanh(torch.nn.Module):
"""
Implementation of soft exponential activation.
Shape:
- Input: (N, *) where * means, any number of additional
dimensions
- Output: (N, *), same shape as the input
Parameters:
... | 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.nn.parameter import Parameter
assert_size_stride = torch._C._d... | ndem0/PINA | AdaptiveTanh | false | 10,727 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
OneParam | import torch
from torch import nn
import torch.utils.data
class OneParam(nn.Module):
def __init__(self, xdim, ydim):
"""This module computes the dynamics at a point x. That is it return the Jacobian matrix
where each element is dy_i/dx_j
Output is a matrix of size ydim x xdim
"""
... | 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
import torch.utils.data
assert_size_stride = torch._C._dyn... | safwanhossain/grad_constraints | OneParam | false | 10,728 | [
"MIT"
] | 0 | fb66f5e01dff6a587e5f1e9b5316f19b4be36ca7 | https://github.com/safwanhossain/grad_constraints/tree/fb66f5e01dff6a587e5f1e9b5316f19b4be36ca7 |
FBetaLoss | import torch
import torch.nn as nn
class FBetaLoss(nn.Module):
def __init__(self, beta=1):
super(FBetaLoss, self).__init__()
self.eps = 1e-08
self.beta = beta
self.beta2 = beta ** 2
return
def forward(self, inputs, target):
inputs = torch.sigmoid(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... | quqixun/ECG-MLC | FBetaLoss | false | 10,729 | [
"MIT"
] | 0 | 582d68200b79e3b2ac322c1ed17630727e283605 | https://github.com/quqixun/ECG-MLC/tree/582d68200b79e3b2ac322c1ed17630727e283605 |
AdaptiveSoftplus | import torch
from torch.nn.parameter import Parameter
class AdaptiveSoftplus(torch.nn.Module):
"""
Implementation of soft exponential activation.
Shape:
- Input: (N, *) where * means, any number of additional
dimensions
- Output: (N, *), same shape as the input
Parameters:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.nn.parameter import Parameter
assert_size_stride = ... | ndem0/PINA | AdaptiveSoftplus | false | 10,730 | [
"MIT"
] | 0 | 1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 | https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, gamma=1, weight=None, balance=0.75):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.weight = weight
self.balance = balance
return
def forward(s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | quqixun/ECG-MLC | FocalLoss | false | 10,731 | [
"MIT"
] | 0 | 582d68200b79e3b2ac322c1ed17630727e283605 | https://github.com/quqixun/ECG-MLC/tree/582d68200b79e3b2ac322c1ed17630727e283605 |
GeometricLoss | import torch
import numpy as np
import torch.nn as nn
class GeometricLoss(nn.Module):
def __init__(self, num_parameters=2, init=[0.0, -3.0]):
self.num_parameters = num_parameters
super(GeometricLoss, self).__init__()
assert len(init) == num_parameters
self.weight = nn.Parameter(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 math as tl_math
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._d... | sanfengliao/DeepNavi | GeometricLoss | false | 10,732 | [
"Apache-2.0"
] | 0 | dc405ac0010075c2eea63083528db7cb765ad161 | https://github.com/sanfengliao/DeepNavi/tree/dc405ac0010075c2eea63083528db7cb765ad161 |
BackgroundRelationModel | import torch
import numpy as np
from torch import nn
from torch.nn.parameter import Parameter
class BackgroundRelationModel(nn.Module):
def __init__(self, n_bg, n_ml):
"""
n_bg: number of background tags
n_ml: number of ml tags
"""
super().__init__()
self.config = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
from torch.nn.parameter import Parameter... | scott0123/psychometrics | BackgroundRelationModel | false | 10,733 | [
"MIT"
] | 0 | 1caa451c46b4c2a3b5e17da3dc89b8cfbded1d11 | https://github.com/scott0123/psychometrics/tree/1caa451c46b4c2a3b5e17da3dc89b8cfbded1d11 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, dropout=False, input_size=4, output_size=2):
super().__init__()
hidden_layer_size = 32
self.fc1 = nn.Linear(input_size, hidden_layer_size)
self.use_dropout = 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_... | sansastra/clustering_ml | Net | false | 10,734 | [
"Apache-2.0"
] | 0 | 12f65f86432e51c15dbd1af5208fdfe4e454470a | https://github.com/sansastra/clustering_ml/tree/12f65f86432e51c15dbd1af5208fdfe4e454470a |
Attention | import torch
import numpy as np
class Attention(torch.nn.Module):
def __init__(self, d_model, heads):
super().__init__()
self.d_model = d_model
self.heads = heads
self.query = torch.nn.Linear(in_features=d_model, out_features=
d_model, bias=False)
self.key = to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | santhnm2/TASO | Attention | false | 10,735 | [
"Apache-2.0"
] | 0 | f8025dda00922e4313ba6efbca6573421d95cbba | https://github.com/santhnm2/TASO/tree/f8025dda00922e4313ba6efbca6573421d95cbba |
ILN | import torch
import torch.onnx
from torch import nn
import torch
from torch.nn.parameter import Parameter
class ILN(nn.Module):
def __init__(self, num_features, eps=1e-05):
super(ILN, self).__init__()
self.eps = eps
self.rho = Parameter(torch.Tensor(1, num_features, 1, 1))
self.ga... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.onnx
from torch import nn
import torch
from torch.nn.parameter imp... | rtolps/Cats2dogs_ONNX | ILN | false | 10,736 | [
"MIT"
] | 0 | 9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc | https://github.com/rtolps/Cats2dogs_ONNX/tree/9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.