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 |
|---|---|---|---|---|---|---|---|---|---|---|
GIoU_loss | import torch
def Interction_Union(outputs, targets):
width_o = outputs[:, 2]
width_t = targets[:, 2]
height_o = outputs[:, 3]
height_t = targets[:, 3]
x_max = torch.max(torch.stack((outputs[:, 0] + outputs[:, 2] / 2,
targets[:, 0] + targets[:, 2] / 2), 1), 1)[0]
x_min = torch.min(torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | debrouchovea/ReproduceGoturn | GIoU_loss | false | 3,411 | [
"MIT"
] | 0 | d60f13c781ca612cacc17536530bbee989bdfa45 | https://github.com/debrouchovea/ReproduceGoturn/tree/d60f13c781ca612cacc17536530bbee989bdfa45 |
IoU_loss | import torch
def Interction_Union(outputs, targets):
width_o = outputs[:, 2]
width_t = targets[:, 2]
height_o = outputs[:, 3]
height_t = targets[:, 3]
x_max = torch.max(torch.stack((outputs[:, 0] + outputs[:, 2] / 2,
targets[:, 0] + targets[:, 2] / 2), 1), 1)[0]
x_min = torch.min(torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | debrouchovea/ReproduceGoturn | IoU_loss | false | 3,412 | [
"MIT"
] | 0 | d60f13c781ca612cacc17536530bbee989bdfa45 | https://github.com/debrouchovea/ReproduceGoturn/tree/d60f13c781ca612cacc17536530bbee989bdfa45 |
GRUCell | import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
class GRUCell(nn.Module):
def __init__(self, input_size, hidden_size, bias=True):
super(GRUCell, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.bias = bias
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | deutschmn/PM2.5-GNN | GRUCell | false | 3,413 | [
"MIT"
] | 0 | 82e3fe2f25465451cbbdd6350c91a0242ecaa1c1 | https://github.com/deutschmn/PM2.5-GNN/tree/82e3fe2f25465451cbbdd6350c91a0242ecaa1c1 |
CIoU_loss | import torch
import numpy as np
def Interction_Union(outputs, targets):
width_o = outputs[:, 2]
width_t = targets[:, 2]
height_o = outputs[:, 3]
height_t = targets[:, 3]
x_max = torch.max(torch.stack((outputs[:, 0] + outputs[:, 2] / 2,
targets[:, 0] + targets[:, 2] / 2), 1), 1)[0]
x_m... | 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
assert_size_stride = torch._... | debrouchovea/ReproduceGoturn | CIoU_loss | false | 3,414 | [
"MIT"
] | 0 | d60f13c781ca612cacc17536530bbee989bdfa45 | https://github.com/debrouchovea/ReproduceGoturn/tree/d60f13c781ca612cacc17536530bbee989bdfa45 |
MidNet4 | import torch
import torch.nn as nn
class MidNet4(nn.Module):
def forward(self, x_in):
"""Network with dilation rate 4
:param x_in: input convolutional features
:returns: processed convolutional features
:rtype: Tensor
"""
x = self.lrelu(self.conv1(x_in))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | deshwalmahesh/CURL---cpu-gpu | MidNet4 | false | 3,415 | [
"BSD-3-Clause"
] | 0 | f4e87275b6cce556b9e04a188cf7ae13d810d82a | https://github.com/deshwalmahesh/CURL---cpu-gpu/tree/f4e87275b6cce556b9e04a188cf7ae13d810d82a |
ParallelLinear | import torch
import numpy as np
import torch.nn as nn
class ParallelLinear(nn.Module):
def __init__(self, n_parallel, in_features, out_features, act=None,
random_bias=False):
super().__init__()
self.act = act
self.weight = nn.Parameter(torch.Tensor(n_parallel, 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
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | dholzmueller/nn_inconsistency | ParallelLinear | false | 3,416 | [
"Apache-2.0"
] | 0 | 67954d71cdbbc61fda7da1f624c19985b0e51708 | https://github.com/dholzmueller/nn_inconsistency/tree/67954d71cdbbc61fda7da1f624c19985b0e51708 |
CPUForgetMult | import torch
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).split(1, dim=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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret... | dido1998/cruxeval | CPUForgetMult | false | 3,417 | [
"BSD-3-Clause"
] | 0 | 229f7562c3f5e0da6432728e1c42402f51473a84 | https://github.com/dido1998/cruxeval/tree/229f7562c3f5e0da6432728e1c42402f51473a84 |
SurnameClassifier | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn.functional import softmax
from torch.nn.functional import relu
from torch.nn.functional import dropout
class SurnameClassifier(Module):
def __init__(self, input_dim: 'int', hidden_dim: 'int', output_dim: 'int'
) ->None:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
f... | dbradf/nlp-pytorch | SurnameClassifier | false | 3,418 | [
"Apache-2.0"
] | 0 | 957e3c5a1edf1f2ae9a8e281729395bed886bc87 | https://github.com/dbradf/nlp-pytorch/tree/957e3c5a1edf1f2ae9a8e281729395bed886bc87 |
LeafClassifier | import torch
import torch.utils.data
from torch import nn
class LeafClassifier(nn.Module):
def __init__(self, feature_size, hidden_size):
super(LeafClassifier, self).__init__()
self.mlp1 = nn.Linear(feature_size, hidden_size)
self.mlp2 = nn.Linear(hidden_size, 1)
def forward(self, in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | dips4717/ui-hier-net | LeafClassifier | false | 3,419 | [
"MIT"
] | 0 | 7c93168b6150ea00e15638504cf561eda98de5c6 | https://github.com/dips4717/ui-hier-net/tree/7c93168b6150ea00e15638504cf561eda98de5c6 |
ConvolutionModule | import torch
from torch import Tensor
from torch import nn
class Swish(torch.nn.Module):
"""Construct an Swish object."""
def forward(self, x: 'Tensor') ->Tensor:
"""Return Swich activation function."""
return x * torch.sigmoid(x)
class ConvolutionModule(nn.Module):
"""ConvolutionModule... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 T... | desh2608/icefall | ConvolutionModule | false | 3,420 | [
"Apache-2.0"
] | 0 | 1603744469d167d848e074f2ea98c587153205fa | https://github.com/desh2608/icefall/tree/1603744469d167d848e074f2ea98c587153205fa |
LocalNet | import torch
import torch.nn as nn
class LocalNet(nn.Module):
def forward(self, x_in):
"""Defines a double convolution
:param x_in: input convolutional features
:returns: convolutional features
:rtype: Tensor
"""
x = self.lrelu(self.conv1(self.refpad(x_in)))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | deshwalmahesh/CURL---cpu-gpu | LocalNet | false | 3,421 | [
"BSD-3-Clause"
] | 0 | f4e87275b6cce556b9e04a188cf7ae13d810d82a | https://github.com/deshwalmahesh/CURL---cpu-gpu/tree/f4e87275b6cce556b9e04a188cf7ae13d810d82a |
DIoU_loss | import torch
def Interction_Union(outputs, targets):
width_o = outputs[:, 2]
width_t = targets[:, 2]
height_o = outputs[:, 3]
height_t = targets[:, 3]
x_max = torch.max(torch.stack((outputs[:, 0] + outputs[:, 2] / 2,
targets[:, 0] + targets[:, 2] / 2), 1), 1)[0]
x_min = torch.min(torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | debrouchovea/ReproduceGoturn | DIoU_loss | false | 3,422 | [
"MIT"
] | 0 | d60f13c781ca612cacc17536530bbee989bdfa45 | https://github.com/debrouchovea/ReproduceGoturn/tree/d60f13c781ca612cacc17536530bbee989bdfa45 |
ContrastiveLoss | import torch
import torch.nn as nn
class ContrastiveLoss(nn.Module):
def __init__(self, margin=0.2):
super(ContrastiveLoss, self).__init__()
self.margin = margin
def forward(self, imgs, caps):
scores = torch.mm(imgs, caps.t())
diag = scores.diag()
cost_s = torch.clamp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | debayan/dsve-loc | ContrastiveLoss | false | 3,423 | [
"BSD-3-Clause-Clear"
] | 0 | 21b1e1837668b6daa0881514d0756e9bec039fcb | https://github.com/debayan/dsve-loc/tree/21b1e1837668b6daa0881514d0756e9bec039fcb |
SimpleFloorModule | import torch
import torch.jit
import torch.onnx
import torch.nn
class SimpleFloorModule(torch.nn.Module):
def forward(self, a, b):
c = a + b
return torch.floor(c)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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 libdevice
import torch.jit
import torch.onnx
import torch.nn
assert_size_stride = torch._... | andreas-hommel/glow | SimpleFloorModule | false | 3,424 | [
"Apache-2.0"
] | 0 | 2bbbf8188a2a941e85677c83f2146bbd076a262e | https://github.com/andreas-hommel/glow/tree/2bbbf8188a2a941e85677c83f2146bbd076a262e |
biaffine_mapping | import torch
import torch.nn as nn
import torch.utils.data.dataloader
import torch.nn
class biaffine_mapping(nn.Module):
def __init__(self, input_size_x, input_size_y, output_size, bias_x,
bias_y, initializer=None):
super(biaffine_mapping, self).__init__()
self.bias_x = bias_x
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
import torch.nn as nn
import torch.utils.data.dataloader
import torch.nn
assert_... | ciaochiaociao/CLNER | biaffine_mapping | false | 3,425 | [
"MIT"
] | 0 | a31fb1c3bfdaa5d62147dc892489d29a85e6b385 | https://github.com/ciaochiaociao/CLNER/tree/a31fb1c3bfdaa5d62147dc892489d29a85e6b385 |
MultiHeadAttention | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class MultiHeadAttention(nn.Module):
def __init__(self, channels, out_channels, n_heads, p_dropout=0.0,
window_size=None, heads_share=True, block_length=None,
proximal_bias=False, proximal_i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dimitrijejankov/vits | MultiHeadAttention | false | 3,426 | [
"MIT"
] | 0 | d2f6385c7946c2355433804796b541ffae0a3d9f | https://github.com/dimitrijejankov/vits/tree/d2f6385c7946c2355433804796b541ffae0a3d9f |
ResBlock | import torch
from torch import nn
class ResBlock(nn.Module):
def __init__(self, in_chans, out_chans, drop_prob, same='False'):
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.drop_prob = drop_prob
self.conv = nn.Conv2d(in_chans, out_chans, kerne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | divelab/mri | ResBlock | false | 3,427 | [
"MIT"
] | 0 | e181b446acfc6f9ac3f42657f710dd583e77d1aa | https://github.com/divelab/mri/tree/e181b446acfc6f9ac3f42657f710dd583e77d1aa |
MiniBatchDiscrimination | import torch
import torch.nn as nn
from torch.nn import init
class MiniBatchDiscrimination(nn.Module):
"""
source: https://gist.github.com/t-ae/732f78671643de97bbe2c46519972491
paper: Salimans et al. 2016. Improved Methods for Training GANs
"""
def __init__(self, in_features, out_features, 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.triton_helpers import math as tl_math
import torch.... | danielnflam/GAN-Tests | MiniBatchDiscrimination | false | 3,428 | [
"BSD-3-Clause"
] | 0 | f112e27b802d717f64a8f2cfa79b9898667da14c | https://github.com/danielnflam/GAN-Tests/tree/f112e27b802d717f64a8f2cfa79b9898667da14c |
BetaMish | import torch
import torch.nn as nn
class BetaMish(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
beta = 1.5
return x * torch.tanh(torch.log(torch.pow(1 + torch.exp(x), beta)))
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.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | dcrmg/Efficient-Segmentation-Networks | BetaMish | false | 3,429 | [
"MIT"
] | 0 | e2f2d90d69e4e9af464678b0f02bc754c28f643d | https://github.com/dcrmg/Efficient-Segmentation-Networks/tree/e2f2d90d69e4e9af464678b0f02bc754c28f643d |
BasicMotionEncoder | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
import torch.nn as nn
class BasicMotionEncoder(nn.Module):
def __init__(self, args):
super(BasicMotionEncoder, self).__init__()
self.args = args
cor_planes = args.corr_levels * (2 * args.corr_radius... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | BrianPugh/RAFT-Stereo | BasicMotionEncoder | false | 3,430 | [
"MIT"
] | 0 | 494dd79545411eee56e32540bfd6f45a16c74a19 | https://github.com/BrianPugh/RAFT-Stereo/tree/494dd79545411eee56e32540bfd6f45a16c74a19 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
"""Encodes the static & dynamic states using 1d Convolution."""
def __init__(self, input_size, hidden_size):
super(Encoder, self).__init__()
self.conv = nn.Conv1d(input_size, hidden_size, kernel_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
import torch.nn as nn
assert_... | dimichai/City-Metro-Network-Expansion-with-RL | Critic | false | 3,431 | [
"MIT"
] | 0 | 54cfec74d89b4e4fc912d480a3025e4c75e3b196 | https://github.com/dimichai/City-Metro-Network-Expansion-with-RL/tree/54cfec74d89b4e4fc912d480a3025e4c75e3b196 |
ActNorm2D | import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class ActNorm2D(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm2D, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = P... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parame... | david-klindt/invertible-resnet | ActNorm2D | false | 3,432 | [
"MIT"
] | 0 | ac6756a7ba5d0dbcb6b4cec43f8b86079318fd89 | https://github.com/david-klindt/invertible-resnet/tree/ac6756a7ba5d0dbcb6b4cec43f8b86079318fd89 |
CombineContext | import torch
from torch import nn
class CombineContext(nn.Module):
def __init__(self, num_features, num_context_features):
super(CombineContext, self).__init__()
self.linear = nn.Linear(num_features + num_context_features,
num_features)
def forward(self, token, prev_context_vecto... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | dmcinerney/Summarization | CombineContext | false | 3,433 | [
"Apache-2.0"
] | 0 | 4d30900757308f7981a6544b4d6890f15133f269 | https://github.com/dmcinerney/Summarization/tree/4d30900757308f7981a6544b4d6890f15133f269 |
FC_ELU | import torch
from torch import nn
class FC_ELU(nn.Module):
def __init__(self, in_dim, hidden_units):
super(FC_ELU, self).__init__()
self.fc = nn.Linear(in_dim, hidden_units)
self.elu = nn.ELU()
def forward(self, x):
out = self.fc(x)
out = self.elu(out)
return ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | donaldo3/Neural-voice-cloning | FC_ELU | false | 3,434 | [
"MIT"
] | 0 | a67cb8d34f5674e2c613d131f18182ad56d8f32f | https://github.com/donaldo3/Neural-voice-cloning/tree/a67cb8d34f5674e2c613d131f18182ad56d8f32f |
Backbone | import torch
class Backbone(torch.nn.Module):
def __init__(self, input_size=4, hidden_size=10, latent_size=2):
super().__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.latent_size = latent_size
self.dense1 = torch.nn.Linear(self.input_size, self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | dmoebius-dm/prototorch_models | Backbone | false | 3,435 | [
"MIT"
] | 0 | 71602bf38a09148eab13d98c9f89589b345ac570 | https://github.com/dmoebius-dm/prototorch_models/tree/71602bf38a09148eab13d98c9f89589b345ac570 |
RankScaledGaussianPrior | import torch
def rank_scaled_gaussian(distances, lambd):
order = torch.argsort(distances, dim=1)
ranks = torch.argsort(order, dim=1)
return torch.exp(-torch.exp(-ranks / lambd) * distances)
class RankScaledGaussianPrior(torch.nn.Module):
def __init__(self, lambd):
super().__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | dmoebius-dm/prototorch_models | RankScaledGaussianPrior | false | 3,436 | [
"MIT"
] | 0 | 71602bf38a09148eab13d98c9f89589b345ac570 | https://github.com/dmoebius-dm/prototorch_models/tree/71602bf38a09148eab13d98c9f89589b345ac570 |
SimpleMultiheadAttention | import torch
from torch import nn
class SimpleMultiheadAttention(nn.Module):
def __init__(self, d_x, d_attn, num_heads):
super(SimpleMultiheadAttention, self).__init__()
self.single_head_attn = nn.Linear(d_x, d_attn)
self.multi_head_attn = nn.Linear(d_attn, num_heads)
def forward(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
from torch._inductor.runtime.... | donaldo3/Neural-voice-cloning | SimpleMultiheadAttention | false | 3,437 | [
"MIT"
] | 0 | a67cb8d34f5674e2c613d131f18182ad56d8f32f | https://github.com/donaldo3/Neural-voice-cloning/tree/a67cb8d34f5674e2c613d131f18182ad56d8f32f |
UpSampleAndHalveChannels | import torch
from torch import Tensor
import torch.nn as nn
class UpSampleAndHalveChannels(nn.Module):
"""
Doubles the spatial dimensions (H,W) but halves the number of channels.
Inverse of the DownSample function in blocks.py
From Diakogiannis et al.
doi: 10.1016/j.isprsjprs.2020.01.013
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | danielnflam/GAN-Tests | UpSampleAndHalveChannels | false | 3,438 | [
"BSD-3-Clause"
] | 0 | f112e27b802d717f64a8f2cfa79b9898667da14c | https://github.com/danielnflam/GAN-Tests/tree/f112e27b802d717f64a8f2cfa79b9898667da14c |
Fire | import math
import torch
import torch.nn as nn
class Fire(nn.Module):
def __init__(self, inplanes, squeeze_planes, expand_planes):
super(Fire, self).__init__()
self.conv1 = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1,
stride=1)
self.relu1 = nn.ELU(inplace=True)
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.triton_helpers import libdevice
import math
import ... | dcrmg/Efficient-Segmentation-Networks | Fire | false | 3,439 | [
"MIT"
] | 0 | e2f2d90d69e4e9af464678b0f02bc754c28f643d | https://github.com/dcrmg/Efficient-Segmentation-Networks/tree/e2f2d90d69e4e9af464678b0f02bc754c28f643d |
GenNoise | import torch
import torch.nn as nn
class GenNoise(nn.Module):
def __init__(self, dim2):
super(GenNoise, self).__init__()
self.dim2 = dim2
def forward(self, input):
a = list(input.size())
a[1] = self.dim2
b = torch.zeros(a).type_as(input.data)
b.normal_()
... | 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... | dustlrdk/noise2self | GenNoise | false | 3,440 | [
"MIT"
] | 0 | 46e8c4650f7ec4f664448417fecd39b4cae477f7 | https://github.com/dustlrdk/noise2self/tree/46e8c4650f7ec4f664448417fecd39b4cae477f7 |
ParallelDilatedConv | import torch
import torch.nn as nn
class ParallelDilatedConv(nn.Module):
def __init__(self, inplanes, planes):
super(ParallelDilatedConv, self).__init__()
self.dilated_conv_1 = nn.Conv2d(inplanes, planes, kernel_size=3,
stride=1, padding=1, dilation=1)
self.dilated_conv_2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | dcrmg/Efficient-Segmentation-Networks | ParallelDilatedConv | false | 3,441 | [
"MIT"
] | 0 | e2f2d90d69e4e9af464678b0f02bc754c28f643d | https://github.com/dcrmg/Efficient-Segmentation-Networks/tree/e2f2d90d69e4e9af464678b0f02bc754c28f643d |
Tanh | import torch
import torch.nn as nn
class Tanh(nn.Module):
"""
https://arxiv.org/abs/1710.05941
The hype was so huge that I could not help but try it
"""
def __init__(self):
super(Tanh, self).__init__()
def forward(self, x):
return torch.tanh(x)
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_... | dustlrdk/noise2self | Tanh | false | 3,442 | [
"MIT"
] | 0 | 46e8c4650f7ec4f664448417fecd39b4cae477f7 | https://github.com/dustlrdk/noise2self/tree/46e8c4650f7ec4f664448417fecd39b4cae477f7 |
StdConv2d | import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-10)
return F.conv2d(x, w, 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.triton_helpers import libdevice
import torch.nn as ... | dustasa/senior_software_HW | StdConv2d | false | 3,443 | [
"Apache-2.0"
] | 0 | 767d1d7bbd5e7d7414c17fa14b92b942e53d84ed | https://github.com/dustasa/senior_software_HW/tree/767d1d7bbd5e7d7414c17fa14b92b942e53d84ed |
StateCritic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
"""Encodes the static & dynamic states using 1d Convolution."""
def __init__(self, input_size, hidden_size):
super(Encoder, self).__init__()
self.conv = nn.Conv1d(input_size, hidden_size, kernel_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
import torch.nn as nn
assert_... | dimichai/City-Metro-Network-Expansion-with-RL | StateCritic | false | 3,444 | [
"MIT"
] | 0 | 54cfec74d89b4e4fc912d480a3025e4c75e3b196 | https://github.com/dimichai/City-Metro-Network-Expansion-with-RL/tree/54cfec74d89b4e4fc912d480a3025e4c75e3b196 |
SIREN_layer | import torch
import numpy as np
import torch.nn as nn
def act(act_fun='LeakyReLU'):
"""
Either string defining an activation function or module (e.g. nn.ReLU)
"""
if isinstance(act_fun, str):
if act_fun == 'LeakyReLU':
return nn.LeakyReLU(0.2, inplace=True)
elif act_fun... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dustlrdk/noise2self | SIREN_layer | false | 3,445 | [
"MIT"
] | 0 | 46e8c4650f7ec4f664448417fecd39b4cae477f7 | https://github.com/dustlrdk/noise2self/tree/46e8c4650f7ec4f664448417fecd39b4cae477f7 |
Net | import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(16, 8, kernel_size=3, padding=1)
self.fc1 = nn.Linear(8... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | dustasa/senior_software_HW | Net | false | 3,446 | [
"Apache-2.0"
] | 0 | 767d1d7bbd5e7d7414c17fa14b92b942e53d84ed | https://github.com/dustasa/senior_software_HW/tree/767d1d7bbd5e7d7414c17fa14b92b942e53d84ed |
GE2ELoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def calc_loss(sim_matrix):
same_idx = list(range(sim_matrix.size(0)))
pos = sim_matrix[same_idx, :, same_idx]
neg = (torch.exp(sim_matrix).sum(dim=2) + 1e-06).log_()
per_embedding_loss = -1 * (pos - neg)
loss = per_embedding_loss.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... | dodo0822/PyTorch_Speaker_Verification | GE2ELoss | false | 3,447 | [
"BSD-3-Clause"
] | 0 | 5310f441894e77895de27380d31149629e309d0f | https://github.com/dodo0822/PyTorch_Speaker_Verification/tree/5310f441894e77895de27380d31149629e309d0f |
ReGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | edchengmoore/pytorch_tabular | ReGLU | false | 3,448 | [
"MIT"
] | 0 | 25f87089fbed95b46f2a1a8a96fba1f581aa8af1 | https://github.com/edchengmoore/pytorch_tabular/tree/25f87089fbed95b46f2a1a8a96fba1f581aa8af1 |
SwiGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | edchengmoore/pytorch_tabular | SwiGLU | false | 3,449 | [
"MIT"
] | 0 | 25f87089fbed95b46f2a1a8a96fba1f581aa8af1 | https://github.com/edchengmoore/pytorch_tabular/tree/25f87089fbed95b46f2a1a8a96fba1f581aa8af1 |
NetDepth | import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
class NetDepth(nn.Module):
def __init__(self, n_chans1=32):
super().__init__()
self.n_chans1 = n_chans1
self.conv1 = nn.Conv2d(3, n_chans1, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(n_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | dustasa/senior_software_HW | NetDepth | false | 3,450 | [
"Apache-2.0"
] | 0 | 767d1d7bbd5e7d7414c17fa14b92b942e53d84ed | https://github.com/dustasa/senior_software_HW/tree/767d1d7bbd5e7d7414c17fa14b92b942e53d84ed |
NetWidth | import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
class NetWidth(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(32, 16, kernel_size=3, padding=1)
self.fc1 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | dustasa/senior_software_HW | NetWidth | false | 3,451 | [
"Apache-2.0"
] | 0 | 767d1d7bbd5e7d7414c17fa14b92b942e53d84ed | https://github.com/dustasa/senior_software_HW/tree/767d1d7bbd5e7d7414c17fa14b92b942e53d84ed |
NetRes | import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
class NetRes(nn.Module):
def __init__(self, n_chans1=32):
super().__init__()
self.n_chans1 = n_chans1
self.conv1 = nn.Conv2d(3, n_chans1, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(n_chans1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dustasa/senior_software_HW | NetRes | false | 3,452 | [
"Apache-2.0"
] | 0 | 767d1d7bbd5e7d7414c17fa14b92b942e53d84ed | https://github.com/dustasa/senior_software_HW/tree/767d1d7bbd5e7d7414c17fa14b92b942e53d84ed |
L2 | import torch
import torch.nn as nn
class L2(nn.Module):
def __init__(self):
super(L2, self).__init__()
def forward(self, output, target):
lossvalue = torch.norm(output - target, p=2, dim=1).mean()
return lossvalue
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | eight0153/flownet2-pytorch | L2 | false | 3,453 | [
"Apache-2.0"
] | 0 | cc2964233cd18c8db05d1751281c6ab9d3165da6 | https://github.com/eight0153/flownet2-pytorch/tree/cc2964233cd18c8db05d1751281c6ab9d3165da6 |
SIREN_CONV | import torch
import numpy as np
import torch.nn as nn
def act(act_fun='LeakyReLU'):
"""
Either string defining an activation function or module (e.g. nn.ReLU)
"""
if isinstance(act_fun, str):
if act_fun == 'LeakyReLU':
return nn.LeakyReLU(0.2, inplace=True)
elif act_fun... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dustlrdk/noise2self | SIREN_CONV | false | 3,454 | [
"MIT"
] | 0 | 46e8c4650f7ec4f664448417fecd39b4cae477f7 | https://github.com/dustlrdk/noise2self/tree/46e8c4650f7ec4f664448417fecd39b4cae477f7 |
GEGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | edchengmoore/pytorch_tabular | GEGLU | false | 3,455 | [
"MIT"
] | 0 | 25f87089fbed95b46f2a1a8a96fba1f581aa8af1 | https://github.com/edchengmoore/pytorch_tabular/tree/25f87089fbed95b46f2a1a8a96fba1f581aa8af1 |
ExtremeLinear | import math
import torch
from torch import nn
from torch import autograd
from torch.nn import init
class ExtremeLinearFunction(autograd.Function):
@staticmethod
def forward(ctx, input, forward_weight, feedback_weight):
ctx.save_for_backward(input, forward_weight, feedback_weight)
output = inp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch import autograd
from torch.nn import... | crazyleg/lateral_research | ExtremeLinear | false | 3,456 | [
"MIT"
] | 0 | e186d218cd4b3ac3770e9fa375bc57133e4dafe5 | https://github.com/crazyleg/lateral_research/tree/e186d218cd4b3ac3770e9fa375bc57133e4dafe5 |
ClsHead | import torch
import torch.nn as nn
import torch.nn.functional as F
class ClsHead(nn.Module):
"""
Class orientation
Args:
params(dict): super parameters for build Class network
"""
def __init__(self, in_channels, class_dim, **kwargs):
super(ClsHead, self).__init__()
self.tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | eminem171333491/PaddleOCR2Pytorch | ClsHead | false | 3,457 | [
"Apache-2.0"
] | 0 | ec466bb3a689eccb9290e9f80812a45301d3b030 | https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030 |
CTCHead | import torch
import torch.nn as nn
import torch.nn.functional as F
class CTCHead(nn.Module):
def __init__(self, in_channels, out_channels=6625, fc_decay=0.0004,
mid_channels=None, **kwargs):
super(CTCHead, self).__init__()
if mid_channels is None:
self.fc = nn.Linear(in_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | eminem171333491/PaddleOCR2Pytorch | CTCHead | false | 3,458 | [
"Apache-2.0"
] | 0 | ec466bb3a689eccb9290e9f80812a45301d3b030 | https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030 |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
"""
Multi-Head Attention
"""
def __init__(self, d_key, d_value, d_model, n_head=1, dropout_rate=0.0):
super(MultiHeadAttention, self).__init__()
self.n_head = n_head
self.d_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | eminem171333491/PaddleOCR2Pytorch | MultiHeadAttention | false | 3,459 | [
"Apache-2.0"
] | 0 | ec466bb3a689eccb9290e9f80812a45301d3b030 | https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030 |
AddNorm | import torch
import torch.nn as nn
class AddNorm(nn.Module):
"""
Applies LayerNorm, Dropout and adds to input. Standard AddNorm operations in Transformers
"""
def __init__(self, input_dim: 'int', dropout: 'float'):
super(AddNorm, self).__init__()
self.dropout = nn.Dropout(dropout)
... | 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_... | edchengmoore/pytorch_tabular | AddNorm | false | 3,460 | [
"MIT"
] | 0 | 25f87089fbed95b46f2a1a8a96fba1f581aa8af1 | https://github.com/edchengmoore/pytorch_tabular/tree/25f87089fbed95b46f2a1a8a96fba1f581aa8af1 |
ResidualBlock | import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
self.prelu = nn.PReLU()
self.conv2 = nn.Conv2d(channels, channels, kernel_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | elaina03/Single-Image-Dehazing | ResidualBlock | false | 3,463 | [
"MIT"
] | 0 | a6a29cb5591204f8066729df4053db0ea2b54aff | https://github.com/elaina03/Single-Image-Dehazing/tree/a6a29cb5591204f8066729df4053db0ea2b54aff |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, sample_size, condition_size, hidden_size):
super().__init__()
self.fc1 = nn.Linear(sample_size + condition_size, hidden_size)
self.fc2 = nn.Dropout(p=0.5)
self.fc3 = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ekrell/learn-planning-space | Encoder | false | 3,464 | [
"MIT"
] | 0 | 730e448bffa4996b2b1ef3a5b00500dc172962ec | https://github.com/ekrell/learn-planning-space/tree/730e448bffa4996b2b1ef3a5b00500dc172962ec |
LatentZ | import torch
import torch.nn as nn
class LatentZ(nn.Module):
def __init__(self, hidden_size, latent_size):
super().__init__()
self.mu = nn.Linear(hidden_size, latent_size)
self.logvar = nn.Linear(hidden_size, latent_size)
def forward(self, p_x):
mu = self.mu(p_x)
logv... | 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.triton_helpers import math... | ekrell/learn-planning-space | LatentZ | false | 3,467 | [
"MIT"
] | 0 | 730e448bffa4996b2b1ef3a5b00500dc172962ec | https://github.com/ekrell/learn-planning-space/tree/730e448bffa4996b2b1ef3a5b00500dc172962ec |
UpConv2D | import torch
import torch.nn as nn
class UpConv2D(nn.Module):
def __init__(self, in_channels=3, out_channels=3, kernel_size=5, ratio=2):
super(UpConv2D, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels * ratio ** 2,
kernel_size, padding=kernel_size // 2)
self.u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | emirkonuk/defocus | UpConv2D | false | 3,468 | [
"Apache-2.0"
] | 0 | da2977d2698eb20e9ab2a3bcd1fa4d05e1dd9b50 | https://github.com/emirkonuk/defocus/tree/da2977d2698eb20e9ab2a3bcd1fa4d05e1dd9b50 |
PrototypicalNetwork | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.optim
import torch.nn.parallel
def L2SquareDist(A, B, average=True):
assert A.dim() == 3
assert B.dim() == 3
assert A.size(0) == B.size(0) and A.size(2) == B.size(2)
nB = A.size(0)
Na = A.size(1)
Nb =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.optim
import torch.nn.parallel
assert_size_st... | Basasuya/FewShotWithoutForgetting | PrototypicalNetwork | false | 3,469 | [
"MIT"
] | 0 | eecc70e416ed82999124ddfca1b145f6dbcd74a6 | https://github.com/Basasuya/FewShotWithoutForgetting/tree/eecc70e416ed82999124ddfca1b145f6dbcd74a6 |
EncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class Lambda(nn.Module):
"""An easy way to create a pytorch layer for a simple `func`."""
def __init__(self, func):
"""create a layer that simply calls `func` with `x`"""
super().__init__()
self.func = func
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | eminem171333491/PaddleOCR2Pytorch | EncoderLayer | false | 3,470 | [
"Apache-2.0"
] | 0 | ec466bb3a689eccb9290e9f80812a45301d3b030 | https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Lambda(nn.Module):
"""An easy way to create a pytorch layer for a simple `func`."""
def __init__(self, func):
"""create a layer that simply calls `func` with `x`"""
super().__init__()
self.func = func
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | eminem171333491/PaddleOCR2Pytorch | Encoder | false | 3,471 | [
"Apache-2.0"
] | 0 | ec466bb3a689eccb9290e9f80812a45301d3b030 | https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030 |
ConcatenatedAttention | import torch
import torch.optim
import torch.utils.data
from torch import nn
class ConcatenatedAttention(nn.Module):
"""
ConcatenatedAttention module which uses concatenation of encoder and decoder
attention vectors instead of summing them up
"""
def __init__(self, encoder_dim, decoder_dim, atten... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | enesmsahin/ShowAttendTell | ConcatenatedAttention | false | 3,472 | [
"MIT"
] | 0 | ae94b9a61c3b7e6f2302b9fd4477b6a3e14a33fe | https://github.com/enesmsahin/ShowAttendTell/tree/ae94b9a61c3b7e6f2302b9fd4477b6a3e14a33fe |
CVAE | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, sample_size, condition_size, hidden_size):
super().__init__()
self.fc1 = nn.Linear(sample_size + condition_size, hidden_size)
self.fc2 = nn.Dropout(p=0.5)
self.fc3 = nn.... | 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... | ekrell/learn-planning-space | CVAE | false | 3,473 | [
"MIT"
] | 0 | 730e448bffa4996b2b1ef3a5b00500dc172962ec | https://github.com/ekrell/learn-planning-space/tree/730e448bffa4996b2b1ef3a5b00500dc172962ec |
TFSamepaddingLayer | import torch
import torch.utils.data
import torch.multiprocessing
import torch.nn as nn
import torch.nn.functional as F
class TFSamepaddingLayer(nn.Module):
"""To align with tf `same` padding.
Putting this before any conv layer that need padding
Assuming kernel has Height == Width for simplicity
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.multiprocessing
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
e... | essential2189/Cell-Based-Model | TFSamepaddingLayer | false | 3,474 | [
"MIT"
] | 0 | f01c3fcb45e69baa4dc8216b8b5a092f56cfa38e | https://github.com/essential2189/Cell-Based-Model/tree/f01c3fcb45e69baa4dc8216b8b5a092f56cfa38e |
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... | es6rc/icevision | SmoothL1Loss | false | 3,475 | [
"Apache-2.0"
] | 0 | bb78dd2e1721c2edb82fb9c1a826fe301541d2a1 | https://github.com/es6rc/icevision/tree/bb78dd2e1721c2edb82fb9c1a826fe301541d2a1 |
CrossEntropyLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def mask_cross_entropy(pred, target, label):
num_rois = pred.size()[0]
inds = torch.arange(0, num_rois, dtype=torch.long, device=pred.device)
pred_slice = pred[inds, label].squeeze(1)
return F.binary_cross_entropy_with_logits(pred_slic... | 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... | es6rc/icevision | CrossEntropyLoss | false | 3,476 | [
"Apache-2.0"
] | 0 | bb78dd2e1721c2edb82fb9c1a826fe301541d2a1 | https://github.com/es6rc/icevision/tree/bb78dd2e1721c2edb82fb9c1a826fe301541d2a1 |
Squash | import torch
import torch.nn as nn
import torch.jit
class Squash(nn.Module):
def forward(self, x):
y = x ** 3
return torch.clamp(y, min=0) / (1 + y.abs())
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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ethanabrooks/teacher-RL | Squash | false | 3,477 | [
"MIT"
] | 0 | 41b44fa4de1e8ce7e0c3eac726919c28ede63538 | https://github.com/ethanabrooks/teacher-RL/tree/41b44fa4de1e8ce7e0c3eac726919c28ede63538 |
GeM | import torch
import torch.nn.functional as F
import torch.nn as nn
class GeM(nn.Module):
def __init__(self, p=3, eps=1e-06):
super(GeM, self).__init__()
self.p = p
self.eps = eps
def forward(self, x):
return self.gem(x, p=self.p, eps=self.eps)
def gem(self, x, p=3, eps=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
import torch.nn.functional a... | esha-singh/DL_project | GeM | false | 3,478 | [
"MIT"
] | 0 | 11ac2874845bc3982435cc37f4e0b8896b95660e | https://github.com/esha-singh/DL_project/tree/11ac2874845bc3982435cc37f4e0b8896b95660e |
Log | import torch
import torch.nn as nn
import torch.jit
class Log(nn.Module):
def forward(self, x):
return torch.log(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
import torch.jit
assert_size_stride = torch._C._dyn... | ethanabrooks/teacher-RL | Log | false | 3,479 | [
"MIT"
] | 0 | 41b44fa4de1e8ce7e0c3eac726919c28ede63538 | https://github.com/ethanabrooks/teacher-RL/tree/41b44fa4de1e8ce7e0c3eac726919c28ede63538 |
QREmbeddingBag | import torch
import numpy as np
from torch import nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
class QREmbeddingBag(nn.Module):
"""Computes sums or means over two 'bags' of embeddings, one
using the quotient of the indices and the other using the remainder
of the indices, wi... | 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 numpy as np
from torch import nn
from torch.nn.parameter import Paramete... | divyanshugit/EnvisEdge | QREmbeddingBag | false | 3,480 | [
"Apache-2.0"
] | 0 | 26b21fd0eb665fa23a8b8a825c9bf460994d6714 | https://github.com/divyanshugit/EnvisEdge/tree/26b21fd0eb665fa23a8b8a825c9bf460994d6714 |
GatedActivation | import torch
from torch import nn
class GatedActivation(nn.Module):
"""Activation function which computes actiation_fn(f) * sigmoid(g).
The f and g correspond to the top 1/2 and bottom 1/2 of the input channels.
"""
def __init__(self, activation_fn=torch.tanh):
"""Initializes a new GatedActiva... | 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... | eyalbetzalel/pytorch-generative-1 | GatedActivation | false | 3,481 | [
"MIT"
] | 0 | 7c3adfdb57345220e14fdf3e827c041fa4db121c | https://github.com/eyalbetzalel/pytorch-generative-1/tree/7c3adfdb57345220e14fdf3e827c041fa4db121c |
Hsigmoid | import torch
import torch.nn as nn
import torch.nn.functional as F
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
return F.relu6(1.2 * x + 3.0, inplace=self.inplace) / 6.0
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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | eminem171333491/PaddleOCR2Pytorch | Hsigmoid | false | 3,482 | [
"Apache-2.0"
] | 0 | ec466bb3a689eccb9290e9f80812a45301d3b030 | https://github.com/eminem171333491/PaddleOCR2Pytorch/tree/ec466bb3a689eccb9290e9f80812a45301d3b030 |
Conv | import torch
import torch.utils.data
from torch import nn
class Conv(nn.Module):
def __init__(self, inp_dim, out_dim, kernel_size=3, stride=1, bn=False,
relu=True):
super(Conv, self).__init__()
self.inp_dim = inp_dim
self.conv = nn.Conv2d(inp_dim, out_dim, kernel_size, stride,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | dmetehan/associative-embedding | Conv | false | 3,483 | [
"BSD-3-Clause"
] | 0 | a2c2e86e622cd97feec621fcfd34c3f97934e388 | https://github.com/dmetehan/associative-embedding/tree/a2c2e86e622cd97feec621fcfd34c3f97934e388 |
MLP | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, state_dim, action_dim, hidden_dim=400):
super(MLP, self).__init__()
self.fc1 = nn.Linear(state_dim, hidden_dim)
self.fc2 = nn.Linear(hidden_dim, hidden_dim)
self.fc3 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | f2010126/DL_Labs | MLP | false | 3,484 | [
"BSD-3-Clause"
] | 0 | ee81d8aa6027846fc32c98feb9079211c59aa0e9 | https://github.com/f2010126/DL_Labs/tree/ee81d8aa6027846fc32c98feb9079211c59aa0e9 |
BertPooler | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertPooler(nn.Module):
def __init__(self, config):
super(BertPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Adoni/pytorch-pretrained-BERT | BertPooler | false | 3,485 | [
"Apache-2.0"
] | 0 | 845c33f00e933626dcfc96e0923ecf034295ef75 | https://github.com/Adoni/pytorch-pretrained-BERT/tree/845c33f00e933626dcfc96e0923ecf034295ef75 |
Lookahead | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
class Lookahead(nn.Module):
def __init__(self, n_features, context):
super(Lookahead, self).__init__()
assert context > 0
self.context = context
self.n_features = n_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
import torch.utils.data.distributed
import torch.nn as nn
assert_size_stride = t... | faboyds/deepspeech.pytorch | Lookahead | false | 3,486 | [
"MIT"
] | 0 | d20f3510a3c556a07f5d662a91a63acffc26633b | https://github.com/faboyds/deepspeech.pytorch/tree/d20f3510a3c556a07f5d662a91a63acffc26633b |
make_binary | import torch
from torch import Tensor
class make_binary(torch.nn.Module):
def __init__(self, inplace=False):
super().__init__()
self.inplace = inplace
def forward(self, tensor: 'Tensor') ->Tensor:
return tensor % 2
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | fcaretti/mitosis_MNIST | make_binary | false | 3,487 | [
"MIT"
] | 0 | 3dce002ff41a09ddd65eb220dc6e5f5c0013a0ea | https://github.com/fcaretti/mitosis_MNIST/tree/3dce002ff41a09ddd65eb220dc6e5f5c0013a0ea |
Convolutional | import torch
import torch.nn.functional as F
import torch.nn as nn
class Convolutional(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.conv1 = nn.Conv2d(1, 16, 5)
self.conv2 = nn.Conv2d(16, 32, 5)
self.fc1 = nn.Linear(512, 128)
self.fc2 = nn.Linear(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | f4str/digit-recognizer | Convolutional | false | 3,488 | [
"MIT"
] | 0 | 67c175c683b22a3bf9d8a28dce812a82e08039d5 | https://github.com/f4str/digit-recognizer/tree/67c175c683b22a3bf9d8a28dce812a82e08039d5 |
FPNHead | import torch
import torch.nn as nn
class FPNHead(nn.Module):
def __init__(self, num_in, num_mid, num_out):
super().__init__()
self.block0 = nn.Conv2d(num_in, num_mid, kernel_size=3, padding=1,
bias=False)
self.block1 = nn.Conv2d(num_mid, num_out, kernel_size=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
import torch.nn as nn
assert_... | emirkonuk/defocus | FPNHead | false | 3,489 | [
"Apache-2.0"
] | 0 | da2977d2698eb20e9ab2a3bcd1fa4d05e1dd9b50 | https://github.com/emirkonuk/defocus/tree/da2977d2698eb20e9ab2a3bcd1fa4d05e1dd9b50 |
FeedForward | import torch
import torch.nn.functional as F
import torch.nn as nn
class FeedForward(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.linear1 = nn.Linear(784, 512)
self.linear2 = nn.Linear(512, 128)
self.linear3 = nn.Linear(128, num_classes)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | f4str/digit-recognizer | FeedForward | false | 3,490 | [
"MIT"
] | 0 | 67c175c683b22a3bf9d8a28dce812a82e08039d5 | https://github.com/f4str/digit-recognizer/tree/67c175c683b22a3bf9d8a28dce812a82e08039d5 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
"""Implements FFN equation."""
def __init__(self, d_model, d_ff, dropout=0.1):
super(PositionwiseFeedForward, self).__init__()
self.w_1 = nn.Linear(d_model, d_ff)
self.norm = 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_... | fellenB/dcp | PositionwiseFeedForward | false | 3,492 | [
"MIT"
] | 0 | 3ca7724799d38ff8a56acb4b8b9011bb41932cb0 | https://github.com/fellenB/dcp/tree/3ca7724799d38ff8a56acb4b8b9011bb41932cb0 |
MnistClassifier | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class MnistClassifier(nn.Module):
def __init__(self, config):
super(MnistClassifier, self).__init__()
self.config = config
self.h = self.config['image_h']
self.w = self.config['image_w']
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... | DanielKalicki/homomorphic_mnist | MnistClassifier | false | 3,493 | [
"BSD-3-Clause"
] | 0 | 954e9df2123527bfd266757f3b96897e405e5356 | https://github.com/DanielKalicki/homomorphic_mnist/tree/954e9df2123527bfd266757f3b96897e405e5356 |
MSBlock | import torch
import torch.nn as nn
class MSBlock(nn.Module):
def __init__(self, c_in, rate=4):
super(MSBlock, self).__init__()
self.rate = rate
self.conv = nn.Conv2d(c_in, 32, 3, stride=1, padding=1)
self.relu = nn.ReLU(inplace=True)
dilation = self.rate * 1 if self.rate >... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | farkoo/novel-seam-carving-method | MSBlock | false | 3,494 | [
"MIT"
] | 0 | aa3e9a4e3d5e13872eed412444e5be519542f7e5 | https://github.com/farkoo/novel-seam-carving-method/tree/aa3e9a4e3d5e13872eed412444e5be519542f7e5 |
ChannelwiseAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelwiseAttention(nn.Module):
def __init__(self, in_channels):
super(ChannelwiseAttention, self).__init__()
self.in_channels = in_channels
self.linear_1 = nn.Linear(self.in_channels, self.in_channels // 4)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | farkoo/novel-seam-carving-method | ChannelwiseAttention | false | 3,495 | [
"MIT"
] | 0 | aa3e9a4e3d5e13872eed412444e5be519542f7e5 | https://github.com/farkoo/novel-seam-carving-method/tree/aa3e9a4e3d5e13872eed412444e5be519542f7e5 |
DumbFeat | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.optim
import torch.nn.parallel
class DumbFeat(nn.Module):
def __init__(self, opt):
super(DumbFeat, self).__init__()
dropout = opt['dropout'] if 'dropout' in opt else 0.0
self.dropout = torch.nn.D... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.optim
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_stri... | Basasuya/FewShotWithoutForgetting | DumbFeat | false | 3,496 | [
"MIT"
] | 0 | eecc70e416ed82999124ddfca1b145f6dbcd74a6 | https://github.com/Basasuya/FewShotWithoutForgetting/tree/eecc70e416ed82999124ddfca1b145f6dbcd74a6 |
SubPixelConvolutionalBlock | import torch
from torch import nn
class SubPixelConvolutionalBlock(nn.Module):
"""
A subpixel convolutional block, comprising convolutional, pixel-shuffle, and PReLU activation layers.
"""
def __init__(self, kernel_size=3, n_channels=64, scaling_factor=2):
"""
:param kernel_size: 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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | f74066357/SR | SubPixelConvolutionalBlock | false | 3,497 | [
"MIT"
] | 0 | 374ac141dfbfb4f851379d1c3c7c7f6bf1a21c67 | https://github.com/f74066357/SR/tree/374ac141dfbfb4f851379d1c3c7c7f6bf1a21c67 |
Gaussianize | import torch
import torch.nn as nn
class Gaussianize(nn.Module):
""" Gaussianization per RealNVP sec 3.6 / fig 4b -- at each step half the variables are directly modeled as Gaussians.
Model as Gaussians:
x2 = z2 * exp(logs) + mu, so x2 ~ N(mu, exp(logs)^2) where mu, logs = f(x1)
then to recover th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ffraaz/flow_based_priors | Gaussianize | false | 3,498 | [
"MIT"
] | 0 | 4f61ecc233a01375c9a069a8baf676152a3e20fa | https://github.com/ffraaz/flow_based_priors/tree/4f61ecc233a01375c9a069a8baf676152a3e20fa |
SimpleAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleAttention(nn.Module):
def __init__(self, input_dim):
super(SimpleAttention, self).__init__()
self.input_dim = input_dim
self.scalar = nn.Linear(self.input_dim, 1, bias=False)
def forward(self, M, x=None):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | filkar/CASTLE | SimpleAttention | false | 3,499 | [
"MIT"
] | 0 | 128b316d24503875bcc298301c17b003e6d4599d | https://github.com/filkar/CASTLE/tree/128b316d24503875bcc298301c17b003e6d4599d |
Net2 | import torch
import numpy as np
from torch import as_tensor
from torch import no_grad
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class AsModelNet(nn.Module):
@staticmethod
def chunk_it(xx):
d = []
for x in xx:
d.append(x)
if len(d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | firemark/eye-detector | Net2 | false | 3,500 | [
"MIT"
] | 0 | 1efc4ccd0f0fc5d52e16b130d336eefd14324a02 | https://github.com/firemark/eye-detector/tree/1efc4ccd0f0fc5d52e16b130d336eefd14324a02 |
Split | import torch
import torch.nn as nn
class Gaussianize(nn.Module):
""" Gaussianization per RealNVP sec 3.6 / fig 4b -- at each step half the variables are directly modeled as Gaussians.
Model as Gaussians:
x2 = z2 * exp(logs) + mu, so x2 ~ N(mu, exp(logs)^2) where mu, logs = f(x1)
then to recover th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ffraaz/flow_based_priors | Split | false | 3,501 | [
"MIT"
] | 0 | 4f61ecc233a01375c9a069a8baf676152a3e20fa | https://github.com/ffraaz/flow_based_priors/tree/4f61ecc233a01375c9a069a8baf676152a3e20fa |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1,
score_function='dot_product', dropout=0):
""" Attention Mechanism
:param embed_dim:
:param hidden_dim:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | filkar/CASTLE | Attention | false | 3,502 | [
"MIT"
] | 0 | 128b316d24503875bcc298301c17b003e6d4599d | https://github.com/filkar/CASTLE/tree/128b316d24503875bcc298301c17b003e6d4599d |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Adoni/pytorch-pretrained-BERT | BertSelfAttention | false | 3,503 | [
"Apache-2.0"
] | 0 | 845c33f00e933626dcfc96e0923ecf034295ef75 | https://github.com/Adoni/pytorch-pretrained-BERT/tree/845c33f00e933626dcfc96e0923ecf034295ef75 |
ActionAttention | import torch
import numpy as np
import torch as th
import torch.nn as nn
class ActionAttention(nn.Module):
def __init__(self, model_dim, n_actions):
super(ActionAttention, self).__init__()
self.model_dim = model_dim
self.n_actions = n_actions
self.fcq = nn.Linear(model_dim, model_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | footoredo/pymarl | ActionAttention | false | 3,504 | [
"Apache-2.0"
] | 0 | 9c62dda7a7ed984e020f2cafab93601342305af2 | https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2 |
ActionAttentionV3 | import torch
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
class ActionAttentionV3(nn.Module):
def __init__(self, model_dim, n_actions):
super(ActionAttentionV3, self).__init__()
self.model_dim = model_dim
self.n_actions = n_actions
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 ... | footoredo/pymarl | ActionAttentionV3 | false | 3,505 | [
"Apache-2.0"
] | 0 | 9c62dda7a7ed984e020f2cafab93601342305af2 | https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2 |
Pointer | import torch
import torch.nn as nn
import torch.nn.functional as F
def mask_logits(target, mask):
mask = mask.type(torch.float32)
return target * mask + (1 - mask) * -1e+30
class Initialized_Conv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, gro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | dcy2018/QANA | Pointer | false | 3,506 | [
"MIT"
] | 0 | 69d1e4ff408a56317479e22ecc854c91fc0f420f | https://github.com/dcy2018/QANA/tree/69d1e4ff408a56317479e22ecc854c91fc0f420f |
AddSubNet | import torch
from torch import nn
import torch.utils.data
class AddSubNet(nn.Module):
"""
Simple AddSub network in PyTorch. This network outputs the sum and
subtraction of the inputs.
"""
def __init__(self):
super(AddSubNet, self).__init__()
def forward(self, input0, input1):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | funny000/python_project | AddSubNet | false | 3,507 | [
"MIT"
] | 0 | 190289765d0bdd908ce289c78969b3702a2c4292 | https://github.com/funny000/python_project/tree/190289765d0bdd908ce289c78969b3702a2c4292 |
ORPooling | import torch
import torch.nn as nn
class ORPooling(nn.Module):
def __init__(self, orientations):
super(ORPooling, self).__init__()
self.orientations = orientations
def forward(self, x):
B, C, H, W = x.shape
assert C % self.orientations == 0
x = x.view(B, -1, self.orie... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | filick/torchcv | ORPooling | false | 3,508 | [
"MIT"
] | 0 | 6e3f6780f00037e086c0ee48bf2b93a177a3b4bc | https://github.com/filick/torchcv/tree/6e3f6780f00037e086c0ee48bf2b93a177a3b4bc |
AdditiveAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdditiveAttention(nn.Module):
def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim,
internal_dim=None):
super(AdditiveAttention, self).__init__()
if internal_dim is None:
internal_dim = i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | fireofearth/Trajectron-plus-plus | AdditiveAttention | false | 3,509 | [
"MIT"
] | 0 | b39df025b62a8ce466266936198baee9bfa14e89 | https://github.com/fireofearth/Trajectron-plus-plus/tree/b39df025b62a8ce466266936198baee9bfa14e89 |
TemporallyBatchedAdditiveAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdditiveAttention(nn.Module):
def __init__(self, encoder_hidden_state_dim, decoder_hidden_state_dim,
internal_dim=None):
super(AdditiveAttention, self).__init__()
if internal_dim is None:
internal_dim = i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | fireofearth/Trajectron-plus-plus | TemporallyBatchedAdditiveAttention | false | 3,510 | [
"MIT"
] | 0 | b39df025b62a8ce466266936198baee9bfa14e89 | https://github.com/fireofearth/Trajectron-plus-plus/tree/b39df025b62a8ce466266936198baee9bfa14e89 |
CoxPHLossSorted | import torch
from torch import Tensor
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\in R_i} h_j})^d$,
where... | 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... | gabrielasuchopar/pycox | CoxPHLossSorted | false | 3,511 | [
"BSD-2-Clause"
] | 0 | e4ea5f0ee26c6d3e3a468f164de2b7c426376e99 | https://github.com/gabrielasuchopar/pycox/tree/e4ea5f0ee26c6d3e3a468f164de2b7c426376e99 |
ActionAttentionV2 | import torch
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
class ActionAttentionV2(nn.Module):
def __init__(self, model_dim, n_actions):
super(ActionAttentionV2, self).__init__()
self.model_dim = model_dim
self.n_actions = n_actions
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._inductor.runtime.... | footoredo/pymarl | ActionAttentionV2 | false | 3,512 | [
"Apache-2.0"
] | 0 | 9c62dda7a7ed984e020f2cafab93601342305af2 | https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2 |
CoxPHLoss | import torch
from torch import Tensor
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\in R_i} h_j})^d$,
where... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_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 ... | gabrielasuchopar/pycox | CoxPHLoss | false | 3,513 | [
"BSD-2-Clause"
] | 0 | e4ea5f0ee26c6d3e3a468f164de2b7c426376e99 | https://github.com/gabrielasuchopar/pycox/tree/e4ea5f0ee26c6d3e3a468f164de2b7c426376e99 |
ContrastiveLoss | import torch
from typing import *
import torch.nn as nn
import torch.nn.functional as F
class ContrastiveLoss(nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=2.0):
super(ContrastiveLoss, 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
from typing import *
import ... | gaungalif/siamese.pytorch | ContrastiveLoss | false | 3,514 | [
"MIT"
] | 0 | 2c06ef574147ea0b8b980943330eaeabe9892533 | https://github.com/gaungalif/siamese.pytorch/tree/2c06ef574147ea0b8b980943330eaeabe9892533 |
Dave_norminit | import torch
import torch.nn as nn
import torch.utils.data
class Dave_norminit(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 24, (5, 5), stride=(2, 2))
self.relu1 = nn.ReLU()
self.conv2 = nn.Conv2d(24, 36, (5, 5), stride=(2, 2))
self.relu2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | fabriceyhc/diversity_attacks | Dave_norminit | false | 3,515 | [
"MIT"
] | 0 | 69e948a5cdf6c6f9e895be5e2096a887bad99151 | https://github.com/fabriceyhc/diversity_attacks/tree/69e948a5cdf6c6f9e895be5e2096a887bad99151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.