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 |
|---|---|---|---|---|---|---|---|---|---|---|
GDN | from torch.autograd import Function
import torch
import torch.nn.functional as F
import torch.nn as nn
class LowerBound(Function):
@staticmethod
def forward(ctx, inputs, bound):
ctx.save_for_backward(inputs, inputs.new_ones(1) * bound)
return inputs.clamp(min=bound)
@staticmethod
def... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | agr17/pytorch-msssim | GDN | false | 1,388 | [
"MIT"
] | 0 | 69aec4113ccceafa5568d1191e98c1db525c0c0f | https://github.com/agr17/pytorch-msssim/tree/69aec4113ccceafa5568d1191e98c1db525c0c0f |
ResidualDenseBlock | import torch
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
from torchvision.models import vgg as vgg
from torch import autograd as autograd
@torch.no_grad()
def default_init_weights(module_list, sc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
from torch.utils import data as data
import torch.nn as ... | achrefjarray/ESRGANplus-master | ResidualDenseBlock | false | 1,389 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
EncoderImagePrecomp | import torch
import numpy as np
import torch.nn as nn
import torch.nn.init
from collections import OrderedDict
def l2norm(X):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt()
X = torch.div(X, norm)
return X
class EncoderImagePrecomp(nn.Module):
def __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.triton_helpers import libdevice
import numpy as np
... | akurniawan/jina-hub | EncoderImagePrecomp | false | 1,390 | [
"Apache-2.0"
] | 0 | d89bc5e8f527f1212c3228a15775e222983c0087 | https://github.com/akurniawan/jina-hub/tree/d89bc5e8f527f1212c3228a15775e222983c0087 |
_ShiftedSoftPlus | import math
import torch
import torch.jit
import torch.nn.functional
import torch.nn
class _ShiftedSoftPlus(torch.nn.Module):
"""
Shifted softplus as defined in SchNet, NeurIPS 2017.
:param beta: value for the a more general softplus, default = 1
:param threshold: values above are linear function, de... | 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 math
import torch.jit
import torch.nn.functional
import... | albertzhu01/nequip | _ShiftedSoftPlus | false | 1,391 | [
"MIT"
] | 0 | 63ba41185e7852ebb6f68983ec30d1f569e43271 | https://github.com/albertzhu01/nequip/tree/63ba41185e7852ebb6f68983ec30d1f569e43271 |
SinActv | import torch
import torch.nn as nn
class SinActv(nn.Module):
"""The sin activation function.
"""
def __init__(self):
"""Initializer method.
"""
super().__init__()
def forward(self, input_):
return torch.sin(input_)
def get_inputs():
return [torch.rand([4, 4, 4, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | aksj98/neurodiffeq | SinActv | false | 1,392 | [
"MIT"
] | 0 | f0ee8ee1e78f2aeee97a4e1fc887ebe0b50749c8 | https://github.com/aksj98/neurodiffeq/tree/f0ee8ee1e78f2aeee97a4e1fc887ebe0b50749c8 |
AlphaModule | import torch
from torch import nn
from torch.nn.parameter import Parameter
import torch.optim
class AlphaModule(nn.Module):
def __init__(self, shape):
super(AlphaModule, self).__init__()
if not isinstance(shape, tuple):
shape = shape,
self.alpha = Parameter(torch.rand(tuple([1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.nn.parameter import Parameter
import torch.optim
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | albertozurli/mammoth | AlphaModule | false | 1,393 | [
"MIT"
] | 0 | 849234afe084b4f707de5300e953a2a8c104ea36 | https://github.com/albertozurli/mammoth/tree/849234afe084b4f707de5300e953a2a8c104ea36 |
MultiHeadAttn | import torch
import torch.cuda
from torch import nn
import torch.nn.functional as F
import torch.distributed
import torch.optim
class MultiHeadAttn(nn.Module):
def __init__(self, n_head, d_model, d_head, dropout, dropatt=0.1,
pre_lnorm=False):
super(MultiHeadAttn, self).__init__()
self.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
from torch._inductor.runtime.... | admariner/NeMo | MultiHeadAttn | false | 1,394 | [
"Apache-2.0"
] | 0 | e542d7f9063a40afa4119a3b94de4c2c636a37bb | https://github.com/admariner/NeMo/tree/e542d7f9063a40afa4119a3b94de4c2c636a37bb |
NormalizationLayer | import torch
import torch.nn.init
class NormalizationLayer(torch.nn.Module):
"""Class for normalization layer."""
def __init__(self, normalize_scale=1.0, learn_scale=True):
super(NormalizationLayer, self).__init__()
self.norm_s = float(normalize_scale)
if learn_scale:
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.init
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | akurniawan/jina-hub | NormalizationLayer | false | 1,395 | [
"Apache-2.0"
] | 0 | d89bc5e8f527f1212c3228a15775e222983c0087 | https://github.com/akurniawan/jina-hub/tree/d89bc5e8f527f1212c3228a15775e222983c0087 |
BesselBasis | import math
import torch
import torch.jit
import torch.nn.functional
from torch import nn
import torch.nn
class BesselBasis(nn.Module):
r_max: 'float'
prefactor: 'float'
def __init__(self, r_max, num_basis=8, trainable=True):
"""Radial Bessel Basis, as proposed in DimeNet: https://arxiv.org/abs/2... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
import torch.jit
import torch.nn.functional
from torch import... | albertzhu01/nequip | BesselBasis | false | 1,396 | [
"MIT"
] | 0 | 63ba41185e7852ebb6f68983ec30d1f569e43271 | https://github.com/albertzhu01/nequip/tree/63ba41185e7852ebb6f68983ec30d1f569e43271 |
DiceLoss | import torch
from torch.nn.modules.loss import _Loss
class DiceLoss(_Loss):
def __init__(self):
super(DiceLoss, self).__init__()
self.axis = 2, 3, 4
self.smooth = 1e-07
def forward(self, input, target):
return 1.0 - self.dice_score(input, target)
def dice_score(self, inp... | 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.modules.loss import _Loss
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | aledelmo/KDCompression | DiceLoss | false | 1,397 | [
"Apache-2.0"
] | 0 | 030e7331f72ac8977964b6adb65d268c23d59130 | https://github.com/aledelmo/KDCompression/tree/030e7331f72ac8977964b6adb65d268c23d59130 |
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... | aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection | AuxiliaryConvolutions | false | 1,398 | [
"MIT"
] | 0 | a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 | https://github.com/aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection/tree/a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 |
Recon_Block | import torch
import torch.nn as nn
class Recon_Block(nn.Module):
def __init__(self, num_chans=64):
super(Recon_Block, self).__init__()
bias = True
self.conv1 = nn.Conv2d(num_chans, num_chans, kernel_size=3, stride=
1, padding=1, bias=bias)
self.relu2 = nn.PReLU()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | albangossard/Course-inverse-problems-and-unrolled-networks | Recon_Block | false | 1,399 | [
"MIT"
] | 0 | 0d4161c905149817e3abff9e70c101f36fac4270 | https://github.com/albangossard/Course-inverse-problems-and-unrolled-networks/tree/0d4161c905149817e3abff9e70c101f36fac4270 |
Classification3DUnet | import torch
import torch.nn as nn
class Classification3DUnet(nn.Module):
def __init__(self, base_filters):
super().__init__()
self.conv = nn.Conv3d(in_channels=base_filters, out_channels=1,
kernel_size=1, stride=1, padding=0)
self.act = nn.Sigmoid()
def forward(self, x):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | aledelmo/KDCompression | Classification3DUnet | false | 1,400 | [
"Apache-2.0"
] | 0 | 030e7331f72ac8977964b6adb65d268c23d59130 | https://github.com/aledelmo/KDCompression/tree/030e7331f72ac8977964b6adb65d268c23d59130 |
Actor | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from math import *
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | albimc/deep-reinforcement-learning | Actor | false | 1,401 | [
"MIT"
] | 0 | e11a6c9d4c8991cf229e686b645ae22ec4cff4f5 | https://github.com/albimc/deep-reinforcement-learning/tree/e11a6c9d4c8991cf229e686b645ae22ec4cff4f5 |
Policy | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import *
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=16, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.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 import triton_helpers
from torch._inductor.runtime.... | albimc/deep-reinforcement-learning | Policy | false | 1,402 | [
"MIT"
] | 0 | e11a6c9d4c8991cf229e686b645ae22ec4cff4f5 | https://github.com/albimc/deep-reinforcement-learning/tree/e11a6c9d4c8991cf229e686b645ae22ec4cff4f5 |
MINCNet | import torch
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
class MINCNet(nn.Module):
def __init__(self):
super(MINCNet, self).__init__()
self.ReL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | achrefjarray/ESRGANplus-master | MINCNet | false | 1,403 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
FocalLoss | import torch
from torch import nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, alpha=0.25, gamma=2, with_logits=True, reduction:
'str'='mean'):
"""
https://github.com/mathiaszinnen/focal_loss_torch/blob/main/focal_loss/focal_loss.py
https://arxiv.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | alexander-soare/PyTorch-Custom | FocalLoss | false | 1,404 | [
"Apache-2.0"
] | 0 | f4f9865f960806f7e05d55ea259e861ee2d7c6dc | https://github.com/alexander-soare/PyTorch-Custom/tree/f4f9865f960806f7e05d55ea259e861ee2d7c6dc |
Foo | import torch
import torch.nn.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
class Foo(torch.nn.Module):
def __init__(self, size):
super(Foo, self).__init__()
self.n = torch.nn.Parameter(torch.ones(size))
self.m = 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
import torch.nn.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
assert_si... | alexshuang/apex | Foo | false | 1,405 | [
"BSD-3-Clause"
] | 0 | 107f1ff569c40769de2ed8d366126282e63b63ce | https://github.com/alexshuang/apex/tree/107f1ff569c40769de2ed8d366126282e63b63ce |
Conv1DSame | import math
import torch
import torch.nn as nn
class Conv1DSame(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, groups=1,
bias=True, stride=1):
super(Conv1DSame, self).__init__()
p = (kernel_size - 1) / 2
self.padding = nn.ConstantPad1d((math.floor(p), math.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | alexchartrand/IoT | Conv1DSame | false | 1,406 | [
"MIT"
] | 0 | 2cc0d40b7f8305b9f82fc83ad4ed55c83efa1bfd | https://github.com/alexchartrand/IoT/tree/2cc0d40b7f8305b9f82fc83ad4ed55c83efa1bfd |
GE2ELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
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... | akuz91/SpeakerVerificationEmbedding | GE2ELoss | false | 1,407 | [
"BSD-3-Clause"
] | 0 | 461d10c2bc34e70f3eb2798bcae803d2ca00f16b | https://github.com/akuz91/SpeakerVerificationEmbedding/tree/461d10c2bc34e70f3eb2798bcae803d2ca00f16b |
BCELabelSmoothingLoss | import torch
from torch import nn
import torch.nn.functional as F
class BCELabelSmoothingLoss(nn.Module):
"""
Binary Cross Entropy Loss with label smoothing, takes logits
"""
def __init__(self, smoothing):
"""
`smoothing` is the smoothing factor. How much less confident than 100%
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | alexander-soare/PyTorch-Custom | BCELabelSmoothingLoss | false | 1,408 | [
"Apache-2.0"
] | 0 | f4f9865f960806f7e05d55ea259e861ee2d7c6dc | https://github.com/alexander-soare/PyTorch-Custom/tree/f4f9865f960806f7e05d55ea259e861ee2d7c6dc |
TSAFusion | import torch
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
class TSAFusion(nn.Module):
"""Temporal Spatial Attention (TSA) fusion module.
Temporal: Calculate... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | achrefjarray/ESRGANplus-master | TSAFusion | false | 1,409 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
Critic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from math import *
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
from math import *
assert_size_stride =... | albimc/deep-reinforcement-learning | Critic | false | 1,410 | [
"MIT"
] | 0 | e11a6c9d4c8991cf229e686b645ae22ec4cff4f5 | https://github.com/albimc/deep-reinforcement-learning/tree/e11a6c9d4c8991cf229e686b645ae22ec4cff4f5 |
DownSampleConv | import torch
import torch.nn as nn
class DownSampleConv(nn.Module):
def __init__(self, in_feature, out_feature, kernel):
super(DownSampleConv, self).__init__()
self.conv = nn.Conv1d(in_feature, out_feature, kernel_size=kernel,
stride=2, padding=kernel // 2, groups=in_feature)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | alexchartrand/IoT | DownSampleConv | false | 1,411 | [
"MIT"
] | 0 | 2cc0d40b7f8305b9f82fc83ad4ed55c83efa1bfd | https://github.com/alexchartrand/IoT/tree/2cc0d40b7f8305b9f82fc83ad4ed55c83efa1bfd |
Conv | import torch
import torch.nn as nn
import torch.utils.data
class Conv(nn.Module):
"""
Convenience class that does padding and convolution for inputs in the format
[batch_size, sequence length, hidden size]
"""
def __init__(self, input_size, output_size, kernel_size, pad_type):
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | alifkurniawan/tesis | Conv | false | 1,412 | [
"MIT"
] | 0 | 6330dba32f5dc12785e956875c94d83344d788a8 | https://github.com/alifkurniawan/tesis/tree/6330dba32f5dc12785e956875c94d83344d788a8 |
TorchModule | import torch
import torch.nn
class TorchLinearModule(torch.nn.Module):
def __init__(self, in_size, out_size):
super(TorchLinearModule, self).__init__()
self._linear = torch.nn.Linear(in_size, out_size)
def forward(self, x):
return self._linear(x)
class TorchModule(torch.nn.Module):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn
ass... | alierenak/ivy | TorchModule | false | 1,413 | [
"Apache-2.0"
] | 0 | 6e91bae159101abbac904a0dd37d0f59daaa75e3 | https://github.com/alierenak/ivy/tree/6e91bae159101abbac904a0dd37d0f59daaa75e3 |
PSNRLoss | import torch
import torch.nn as nn
from torch.nn.functional import mse_loss
def psnr_loss(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float'
) ->torch.Tensor:
"""Function that computes PSNR
See :class:`~kornia.losses.PSNRLoss` for details.
"""
if not torch.is_tensor(input) or not 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from t... | alopezgit/kornia | PSNRLoss | false | 1,414 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 7bf47ae472012d2d6cf24463a76e8089daa65d0b | https://github.com/alopezgit/kornia/tree/7bf47ae472012d2d6cf24463a76e8089daa65d0b |
LayerNormalization | import torch
import torch.nn as nn
class LayerNormalization(nn.Module):
def __init__(self, d_hid, eps=1e-06):
super(LayerNormalization, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_hid))
self.beta = nn.Parameter(torch.zeros(d_hid))
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_... | alisure-fork/CONTA | LayerNormalization | false | 1,415 | [
"MIT"
] | 0 | dde3e5083f45598d859dde889de3ae85c7a416e9 | https://github.com/alisure-fork/CONTA/tree/dde3e5083f45598d859dde889de3ae85c7a416e9 |
BoxFilter | import torch
from torchvision.transforms import functional as F
from torch import nn
from torch.nn import functional as F
class BoxFilter(nn.Module):
def __init__(self, r):
super(BoxFilter, self).__init__()
self.r = r
def forward(self, x):
kernel_size = 2 * self.r + 1
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | allen0125/RobustVideoMatting | BoxFilter | false | 1,416 | [
"Apache-2.0"
] | 0 | c0f17ca45a9de7586c570753064187200dec487a | https://github.com/allen0125/RobustVideoMatting/tree/c0f17ca45a9de7586c570753064187200dec487a |
ScModel | import torch
import torch as t
import torch.nn as nn
from torch.nn.parameter import Parameter
class ScModel(nn.Module):
""" Model for singel cell data """
def __init__(self, n_genes: 'int', n_celltypes: 'int', device: 't.device'
) ->None:
super().__init__()
self.K = n_celltypes
... | 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... | almaan/STereoSCope | ScModel | false | 1,417 | [
"MIT"
] | 0 | 8f6a2021b6cb73aecda14f6bbbd25e26bfc9301a | https://github.com/almaan/STereoSCope/tree/8f6a2021b6cb73aecda14f6bbbd25e26bfc9301a |
PoswiseFeedForwardNet | import torch
import torch.nn as nn
class LayerNormalization(nn.Module):
def __init__(self, d_hid, eps=1e-06):
super(LayerNormalization, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_hid))
self.beta = nn.Parameter(torch.zeros(d_hid))
self.eps = eps
def forward(self, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | alisure-fork/CONTA | PoswiseFeedForwardNet | false | 1,418 | [
"MIT"
] | 0 | dde3e5083f45598d859dde889de3ae85c7a416e9 | https://github.com/alisure-fork/CONTA/tree/dde3e5083f45598d859dde889de3ae85c7a416e9 |
Pool | import torch
import torch.nn as nn
class crop(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
N, C, H, W = x.shape
x = x[0:N, 0:C, 0:H - 1, 0:W]
return x
class shift(nn.Module):
def __init__(self):
super().__init__()
self.shift_... | 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... | amonod/udvd | Pool | false | 1,419 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
FastGuidedFilter | import torch
from torchvision.transforms import functional as F
from torch import nn
from torch.nn import functional as F
class BoxFilter(nn.Module):
def __init__(self, r):
super(BoxFilter, self).__init__()
self.r = r
def forward(self, x):
kernel_size = 2 * self.r + 1
kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torchvision.transforms i... | allen0125/RobustVideoMatting | FastGuidedFilter | false | 1,420 | [
"Apache-2.0"
] | 0 | c0f17ca45a9de7586c570753064187200dec487a | https://github.com/allen0125/RobustVideoMatting/tree/c0f17ca45a9de7586c570753064187200dec487a |
MaxMarginCriterion | import torch
import torch.nn as nn
class MaxMarginCriterion(nn.Module):
def __init__(self, visual_rank_weight, lang_rank_weight, margin):
super(MaxMarginCriterion, self).__init__()
self.visual_rank = visual_rank_weight > 0
self.lang_rank = lang_rank_weight > 0
self.visual_rank_wei... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | andfoy/MAttNet | MaxMarginCriterion | false | 1,421 | [
"MIT"
] | 0 | defa58649951ab8f6a7dcca25475e91f5e53ffcf | https://github.com/andfoy/MAttNet/tree/defa58649951ab8f6a7dcca25475e91f5e53ffcf |
SoftTree | import torch
import numpy as np
class SoftTree(torch.nn.Module):
"""Soft decision tree."""
def __init__(self, in_features, out_features, depth, projection=
'constant', dropout=0.0):
super(SoftTree, self).__init__()
self.proj = projection
self.depth = depth
self.in_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | alper111/symbol-emergence | SoftTree | false | 1,422 | [
"MIT"
] | 0 | a4abd5d26b6fb36fe1ab3d6304a257df29be8e2c | https://github.com/alper111/symbol-emergence/tree/a4abd5d26b6fb36fe1ab3d6304a257df29be8e2c |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size * 2, config.hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | MCplayerFromPRC/CodeT5 | RobertaClassificationHead | false | 1,423 | [
"BSD-3-Clause"
] | 0 | 726ed4a4221be125b6083439667573ef5fef6984 | https://github.com/MCplayerFromPRC/CodeT5/tree/726ed4a4221be125b6083439667573ef5fef6984 |
FractionProposalModel | import torch
from torch import nn
from torch.nn import functional as F
class FractionProposalModel(nn.Module):
def __init__(self, in_dim, out_dim):
super(FractionProposalModel, self).__init__()
self.in_dim = in_dim
self.out_dim = out_dim
self.layer = nn.Linear(self.in_dim, self.ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | alirezakazemipour/Distributional-RL | FractionProposalModel | false | 1,424 | [
"MIT"
] | 0 | a3de3a1707bdd57a420f85c6d64a3fb84fb075af | https://github.com/alirezakazemipour/Distributional-RL/tree/a3de3a1707bdd57a420f85c6d64a3fb84fb075af |
unrotate | import torch
import torch.nn as nn
class unrotate(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
x0, x90, x180, x270 = torch.chunk(x, 4, dim=0)
x90 = x90.transpose(2, 3).flip(2)
x180 = x180.flip(2).flip(3)
x270 = x270.transpose(2, 3).flip(3)
... | 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... | amonod/udvd | unrotate | false | 1,425 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
SEModule | import torch
import torch.nn as nn
class SEModule(nn.Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1,
padding=0)
self.relu = nn.ReLU(inplace=True)
self.fc2 = nn.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
import torch.nn as nn
assert_... | amajidsinar/seer | SEModule | false | 1,426 | [
"Apache-2.0"
] | 0 | 35f25b3fbf22968f0b09c266b8fd66a44fcc4d9c | https://github.com/amajidsinar/seer/tree/35f25b3fbf22968f0b09c266b8fd66a44fcc4d9c |
MNIST_CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class MNIST_CNN(nn.Module):
"""
Hand-tuned architecture for MNIST.
Weirdness I've noticed so far with this architecture:
- adding a linear layer after the mean-pool in features hurts
RotatedMNIST-100 gen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | alceubissoto/DomainBed | MNIST_CNN | false | 1,427 | [
"MIT"
] | 0 | 80d54050f52fb5349e2a47c0674046e6d0674f3d | https://github.com/alceubissoto/DomainBed/tree/80d54050f52fb5349e2a47c0674046e6d0674f3d |
shift | import torch
import torch.nn as nn
class crop(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
N, C, H, W = x.shape
x = x[0:N, 0:C, 0:H - 1, 0:W]
return x
class shift(nn.Module):
def __init__(self):
super().__init__()
self.shift_... | 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... | amonod/udvd | shift | false | 1,428 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
rotate | import torch
import torch.nn as nn
class rotate(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
x90 = x.transpose(2, 3).flip(3)
x180 = x.flip(2).flip(3)
x270 = x.transpose(2, 3).flip(2)
x = torch.cat((x, x90, x180, x270), dim=0)
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... | amonod/udvd | rotate | false | 1,429 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
CmapPafHead | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn
import torch.optim
assert_size_stride = ... | andreiday/trt_pose_motion_tracking_robot_arm | CmapPafHead | false | 1,430 | [
"MIT"
] | 0 | 4ada47f6f12e18ce14ee53a22540e02923745dd8 | https://github.com/andreiday/trt_pose_motion_tracking_robot_arm/tree/4ada47f6f12e18ce14ee53a22540e02923745dd8 |
MAP_Linear_Layer | import torch
import numpy as np
import torch.nn as nn
class MAP_Linear_Layer(nn.Module):
def __init__(self, n_input, n_output):
super(MAP_Linear_Layer, self).__init__()
self.weight = nn.Parameter(torch.Tensor(n_input, n_output).normal_(
0, 1 / np.sqrt(4 * n_output)))
self.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
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | andrewfoongyk/cs230-code-examples | MAP_Linear_Layer | false | 1,431 | [
"MIT"
] | 0 | 8e12aa3414bdada6ec6002bedf919a6816ba237c | https://github.com/andrewfoongyk/cs230-code-examples/tree/8e12aa3414bdada6ec6002bedf919a6816ba237c |
LossD | import torch
import torch.nn as nn
from torch.nn import functional as F
class LossD(nn.Module):
def __init__(self, gpu=None):
super(LossD, self).__init__()
self.gpu = gpu
if gpu is not None:
self
def forward(self, r_x, r_x_hat):
if self.gpu is not None:
... | 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... | andy6804tw/talking-hands-API | LossD | false | 1,432 | [
"MIT"
] | 0 | 4895c980565082b0fdcabbc704ee871855e6d5f5 | https://github.com/andy6804tw/talking-hands-API/tree/4895c980565082b0fdcabbc704ee871855e6d5f5 |
CompActor | import torch
class CompActor(torch.nn.Module):
def __init__(self, state_dim: 'int', hidden_dim: 'int', action_dim: 'int'):
super(CompActor, self).__init__()
self.fc1 = torch.nn.Linear(state_dim, hidden_dim)
self.fc2 = torch.nn.Linear(hidden_dim, hidden_dim)
self.fc3 = torch.nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | andreabradpitto/turtlex | CompActor | false | 1,433 | [
"Apache-2.0"
] | 0 | 37a2315450f896d10dcb9ebc8968207e476dcf82 | https://github.com/andreabradpitto/turtlex/tree/37a2315450f896d10dcb9ebc8968207e476dcf82 |
Conv | import torch
import torch.nn as nn
class crop(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
N, C, H, W = x.shape
x = x[0:N, 0:C, 0:H - 1, 0:W]
return x
class Conv(nn.Module):
def __init__(self, in_channels, out_channels, bias=False, blind=Tru... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | amonod/udvd | Conv | false | 1,434 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
MLP | import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
from collections import OrderedDict
class MLP(nn.Module):
def __init__(self, input_size, output_size):
super(MLP, self).__init__()
self.input_size = input_size
self.output_size = output_size
self.mlp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | andreasbinder/Stochastic-Graph-assisted-Genre-Classification | MLP | false | 1,435 | [
"MIT"
] | 0 | 78752716030466f02424dcf1cbe5a66d756a13c4 | https://github.com/andreasbinder/Stochastic-Graph-assisted-Genre-Classification/tree/78752716030466f02424dcf1cbe5a66d756a13c4 |
N3 | import torch
import torch.nn as nn
import torch.utils
from typing import Tuple
from abc import ABC
from abc import abstractmethod
import torch.utils.data
class Regularizer(nn.Module, ABC):
@abstractmethod
def forward(self, factors: 'Tuple[torch.Tensor]'):
pass
class N3(Regularizer):
def __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.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils
from typing import Tuple
from ab... | angusl95/darts-kbc | N3 | false | 1,436 | [
"Apache-2.0"
] | 0 | 85fc6f4bdb7ba73c07d96ce47e96634599b346f9 | https://github.com/angusl95/darts-kbc/tree/85fc6f4bdb7ba73c07d96ce47e96634599b346f9 |
Stack | import torch
import torch.utils
import torch.utils.data
class Stack(torch.nn.Module):
def __init__(self, repeats):
super(Stack, self).__init__()
self.repeats = repeats
def forward(self, x):
x = torch.repeat_interleave(x, self.repeats, dim=1)
return x
def get_inputs():
r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | angusl95/darts-kbc | Stack | false | 1,437 | [
"Apache-2.0"
] | 0 | 85fc6f4bdb7ba73c07d96ce47e96634599b346f9 | https://github.com/angusl95/darts-kbc/tree/85fc6f4bdb7ba73c07d96ce47e96634599b346f9 |
StatsNet | import torch
import torch.nn as nn
class StatsNet(nn.Module):
def __init__(self):
super(StatsNet, self).__init__()
def forward(self, x):
x = x.view(x.data.shape[0], x.data.shape[1], x.data.shape[2] * x.
data.shape[3])
mean = torch.mean(x, 2)
std = torch.std(x, 2)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | angelicagardner/ensemble-cnn-deepfakes-detection | StatsNet | false | 1,438 | [
"BSD-3-Clause"
] | 0 | 8740d2317848250249c741e0af5c4cbbe2d8af46 | https://github.com/angelicagardner/ensemble-cnn-deepfakes-detection/tree/8740d2317848250249c741e0af5c4cbbe2d8af46 |
AdaIn | import torch
import torch.nn as nn
class AdaIn(nn.Module):
def __init__(self):
super(AdaIn, self).__init__()
self.eps = 1e-05
def forward(self, x, mean_style, std_style):
B, C, H, W = x.shape
feature = x.view(B, C, -1)
std_feat = (torch.std(feature, dim=2) + self.eps)... | 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_... | andy6804tw/talking-hands-API | AdaIn | false | 1,439 | [
"MIT"
] | 0 | 4895c980565082b0fdcabbc704ee871855e6d5f5 | https://github.com/andy6804tw/talking-hands-API/tree/4895c980565082b0fdcabbc704ee871855e6d5f5 |
DEC_Conv | import torch
import torch.nn as nn
import torch.nn.functional as F
class crop(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
N, C, H, W = x.shape
x = x[0:N, 0:C, 0:H - 1, 0:W]
return x
class Conv(nn.Module):
def __init__(self, in_channels, out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | amonod/udvd | DEC_Conv | false | 1,440 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
ENC_Conv | import torch
import torch.nn as nn
class crop(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
N, C, H, W = x.shape
x = x[0:N, 0:C, 0:H - 1, 0:W]
return x
class shift(nn.Module):
def __init__(self):
super().__init__()
self.shift_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | amonod/udvd | ENC_Conv | false | 1,441 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
N2 | import torch
import torch.nn as nn
import torch.utils
from typing import Tuple
from abc import ABC
from abc import abstractmethod
import torch.utils.data
class Regularizer(nn.Module, ABC):
@abstractmethod
def forward(self, factors: 'Tuple[torch.Tensor]'):
pass
class N2(Regularizer):
def __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.triton_helpers import libdevice
import torch.nn as nn
import torch.utils
from typing import Tuple
from abc impo... | angusl95/darts-kbc | N2 | false | 1,442 | [
"Apache-2.0"
] | 0 | 85fc6f4bdb7ba73c07d96ce47e96634599b346f9 | https://github.com/angusl95/darts-kbc/tree/85fc6f4bdb7ba73c07d96ce47e96634599b346f9 |
_Residual_Block | import torch
import torch.nn as nn
class _Residual_Block(nn.Module):
def __init__(self, num_chans=64):
super(_Residual_Block, self).__init__()
bias = True
self.conv1 = nn.Conv2d(num_chans, num_chans, kernel_size=3, stride=
1, padding=1, bias=bias)
self.relu2 = nn.PReLU... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | albangossard/Course-inverse-problems-and-unrolled-networks | _Residual_Block | false | 1,443 | [
"MIT"
] | 0 | 0d4161c905149817e3abff9e70c101f36fac4270 | https://github.com/albangossard/Course-inverse-problems-and-unrolled-networks/tree/0d4161c905149817e3abff9e70c101f36fac4270 |
PredictionConvolutions | import torch
from torch import nn
from itertools import product as product
import torch.optim
import torch.utils.data
class PredictionConvolutions(nn.Module):
"""
Convolutions to predict class scores and bounding boxes using lower and higher-level feature maps.
The bounding boxes (locations) are predicte... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from itertools import product as product
import torch.optim... | aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection | PredictionConvolutions | false | 1,444 | [
"MIT"
] | 0 | a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 | https://github.com/aarashfeizi/a-PyTorch-Tutorial-to-Object-Detection/tree/a9e1f3092d4b8c094bff5cd0897e0e3c1e0bc9c2 |
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.... | andry900/NN-Project | residualUnit | false | 1,445 | [
"MIT"
] | 0 | e04a83029f5990d9b65216ab0648a8826a8ebca7 | https://github.com/andry900/NN-Project/tree/e04a83029f5990d9b65216ab0648a8826a8ebca7 |
ContrastiveLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class ContrastiveLoss(nn.Module):
def __init__(self, margin=2.0):
super(ContrastiveLoss, self).__init__()
self.margin = margin
def forward(self, output1, output2, label):
euclidean_distance = F.pair... | 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
import... | ani0075/learning-pytorch | ContrastiveLoss | false | 1,446 | [
"MIT"
] | 0 | c50e4126751821075e94c4cc3950dd8780370fce | https://github.com/ani0075/learning-pytorch/tree/c50e4126751821075e94c4cc3950dd8780370fce |
h_swish | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class h_swish(nn.Module):
def __init__(self, inplace=False):
super(h_swish, self).__init__()
self.inplace = inplace
def forward(self, x):
return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | anonymous2022ijcai/RGSL | h_swish | false | 1,447 | [
"MIT"
] | 0 | 11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 | https://github.com/anonymous2022ijcai/RGSL/tree/11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 |
CmapPafHeadAttention | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.... | andreiday/trt_pose_motion_tracking_robot_arm | CmapPafHeadAttention | false | 1,448 | [
"MIT"
] | 0 | 4ada47f6f12e18ce14ee53a22540e02923745dd8 | https://github.com/andreiday/trt_pose_motion_tracking_robot_arm/tree/4ada47f6f12e18ce14ee53a22540e02923745dd8 |
h_sigmoid | import torch
import torch.utils.data
import torch.nn as nn
class h_sigmoid(nn.Module):
def __init__(self, inplace=True, h_max=1):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
self.h_max = h_max
def forward(self, x):
return self.relu(x + 3) * self.h_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | anonymous2022ijcai/RGSL | h_sigmoid | false | 1,449 | [
"MIT"
] | 0 | 11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 | https://github.com/anonymous2022ijcai/RGSL/tree/11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 |
SigM | import torch
import torch.utils.data
import torch.nn as nn
class h_sigmoid(nn.Module):
def __init__(self, inplace=True, h_max=1):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
self.h_max = h_max
def forward(self, x):
return self.relu(x + 3) * self.h_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guard... | anonymous2022ijcai/RGSL | SigM | false | 1,450 | [
"MIT"
] | 0 | 11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 | https://github.com/anonymous2022ijcai/RGSL/tree/11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 |
StyleLoss | import torch
import torch.nn as nn
class GramMatrix(nn.Module):
def forward(self, input):
n_batches, n_channels, height, width = input.size()
flattened = input.view(n_batches, n_channels, height * width)
return torch.bmm(flattened, flattened.transpose(1, 2)).div_(height *
widt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | andreweskeclarke/style-transfer | StyleLoss | false | 1,451 | [
"MIT"
] | 0 | e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca | https://github.com/andreweskeclarke/style-transfer/tree/e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca |
Brain | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Replay:
def __init__(self):
self.hidden0 = None
self.states = []
self.actions = []
self.rewards = []
self.is_terminal = False
self.iter = 0
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | anhddo/ai-arena | Brain | false | 1,452 | [
"MIT"
] | 0 | bc881e83073be4f9130b1a50fa56a51c11d21f9f | https://github.com/anhddo/ai-arena/tree/bc881e83073be4f9130b1a50fa56a51c11d21f9f |
RelativeThreshold_RegLoss | import torch
import torch.nn as nn
import torch.nn.init
class RelativeThreshold_RegLoss(nn.Module):
def __init__(self, threshold, size_average=True):
super(RelativeThreshold_RegLoss, self).__init__()
self.size_average = size_average
self.eps = 1e-07
self.threshold = threshold
... | 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.nn.init
assert_size_stride = torch._C.... | andry900/NN-Project | RelativeThreshold_RegLoss | false | 1,453 | [
"MIT"
] | 0 | e04a83029f5990d9b65216ab0648a8826a8ebca7 | https://github.com/andry900/NN-Project/tree/e04a83029f5990d9b65216ab0648a8826a8ebca7 |
DilatedResidualLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class DilatedResidualLayer(nn.Module):
def __init__(self, dilation, in_channels, out_channels):
super(DilatedResidualLayer, self).__init__()
self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding
=dilation... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | anonymous-rubick/ms-tcn-bilinear | DilatedResidualLayer | false | 1,454 | [
"MIT"
] | 0 | b95d3ca834dc4811af563d38185acef975970e82 | https://github.com/anonymous-rubick/ms-tcn-bilinear/tree/b95d3ca834dc4811af563d38185acef975970e82 |
AttentionUnit | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
class AttentionUnit(nn.Module):
def __init__(self, sDim, xDim, attDim):
super(AttentionUnit, self).__init__()
self.sDim = sDim
self.xDim = xDim
self.attDim = attDim
self.sEmbed ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ankur6ue/aster-ocr | AttentionUnit | false | 1,455 | [
"MIT"
] | 0 | c4503bb19c843d519a36f0e5b8bebd6809800e04 | https://github.com/ankur6ue/aster-ocr/tree/c4503bb19c843d519a36f0e5b8bebd6809800e04 |
CNNQNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNNQNetwork(nn.Module):
"""CNN Q Function, which outputs array of action values"""
def __init__(self, state_size, action_size, seed, conv1_filters=16,
conv2_filters=16, conv3_filters=16, fc1_units=200, fc2_units=200):
""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | anindex/deepRL-projects | CNNQNetwork | false | 1,456 | [
"MIT"
] | 0 | bed03d1f985c8340fc75f715028b632bdce40641 | https://github.com/anindex/deepRL-projects/tree/bed03d1f985c8340fc75f715028b632bdce40641 |
GlobalAttention | import torch
import torch.nn as nn
import torch.cuda
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not all arguments have the same value: ' + str(args)
def 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.... | andy-yangz/birnn-decoder-NMT | GlobalAttention | false | 1,457 | [
"MIT"
] | 0 | 112293f463d93ef0e08cdcb363b908ed9ad5198e | https://github.com/andy-yangz/birnn-decoder-NMT/tree/112293f463d93ef0e08cdcb363b908ed9ad5198e |
BerhuLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.hub
class BerhuLoss(nn.Module):
def __init__(self):
super(BerhuLoss, self).__init__()
self.name = 'Berhu'
def forward(self, input, target, mask=None):
assert input.shap... | 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
... | appliedinnovation/fast-depth | BerhuLoss | false | 1,458 | [
"MIT"
] | 0 | 4606b4d340ae416de94afed45bc767fe6f64bd67 | https://github.com/appliedinnovation/fast-depth/tree/4606b4d340ae416de94afed45bc767fe6f64bd67 |
SILogLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.hub
class SILogLoss(nn.Module):
def __init__(self):
super(SILogLoss, self).__init__()
self.name = 'SILog'
def forward(self, input, target, mask=None, interpolate=False):
... | 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... | appliedinnovation/fast-depth | SILogLoss | false | 1,459 | [
"MIT"
] | 0 | 4606b4d340ae416de94afed45bc767fe6f64bd67 | https://github.com/appliedinnovation/fast-depth/tree/4606b4d340ae416de94afed45bc767fe6f64bd67 |
Self_Attn | import torch
import torch.utils.data
import torch.nn as nn
class Self_Attn(nn.Module):
""" Self attention Layer"""
def __init__(self, in_dim):
super(Self_Attn, self).__init__()
self.chanel_in = in_dim
self.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim //
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
from torch._inductor.runtime.... | anonymous2022ijcai/RGSL | Self_Attn | false | 1,460 | [
"MIT"
] | 0 | 11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 | https://github.com/anonymous2022ijcai/RGSL/tree/11c38ee50d50127c0f7c2a137bdb21ca5f7f3644 |
PreActBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class PreActBlock(nn.Module):
"""Pre-activation version of the BasicBlock."""
expansion = 1
def __init__(self, in_planes, planes, stride=1):
super(PreActBlock, self).__init__()
self.conv1 = nn.Conv2d(in_planes, planes, ker... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | appa-ayephyu/RobGAN | PreActBlock | false | 1,461 | [
"MIT"
] | 0 | 1d4577edb5b858e9d0c1e76a4c323de18201190c | https://github.com/appa-ayephyu/RobGAN/tree/1d4577edb5b858e9d0c1e76a4c323de18201190c |
GramMatrix | import torch
import torch.nn as nn
class GramMatrix(nn.Module):
def forward(self, input):
n_batches, n_channels, height, width = input.size()
flattened = input.view(n_batches, n_channels, height * width)
return torch.bmm(flattened, flattened.transpose(1, 2)).div_(height *
widt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | andreweskeclarke/style-transfer | GramMatrix | false | 1,462 | [
"MIT"
] | 0 | e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca | https://github.com/andreweskeclarke/style-transfer/tree/e4b18f4cdb3f473bf946f12cc39447b2f6bb15ca |
OptimizedBlock | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def _downsample(x):
return F.avg_pool2d(x, 2)
class OptimizedBlock(nn.Module):
def __init__(self, in_channels, out_channels, ksize=3, pad=1,
activation=F.relu, bn=False):
super(OptimizedBlock, 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
import math
import torch.nn a... | appa-ayephyu/RobGAN | OptimizedBlock | false | 1,463 | [
"MIT"
] | 0 | 1d4577edb5b858e9d0c1e76a4c323de18201190c | https://github.com/appa-ayephyu/RobGAN/tree/1d4577edb5b858e9d0c1e76a4c323de18201190c |
Dice_Loss | import torch
class Dice_Loss(torch.nn.Module):
"""This is a custom Dice Similarity Coefficient loss function that we use
to the accuracy of the segmentation. it is defined as ;
DSC = 2 * (pred /intersect label) / (pred /union label) for the losss we use
1- DSC so gradient descent leads to better outpu... | 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... | arjunsbalaji/oct | Dice_Loss | false | 1,464 | [
"Apache-2.0"
] | 0 | f21e11f6dda952cd914444512ddadb4141757951 | https://github.com/arjunsbalaji/oct/tree/f21e11f6dda952cd914444512ddadb4141757951 |
CoordConv | import torch
import torch.nn as nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_size, _,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | apyrros/HCC-comorbidities | CoordConv | false | 1,465 | [
"MIT"
] | 0 | fd74fb2f1438bc741cfe6728c5cb64737bc99d68 | https://github.com/apyrros/HCC-comorbidities/tree/fd74fb2f1438bc741cfe6728c5cb64737bc99d68 |
Perceptron | import torch
import torch.nn as nn
import torch.cuda
class Perceptron(nn.Module):
""" A perceptron is one linear Layer"""
def __init__(self, input_dim: 'int'):
"""
:param input_dim (int): size of inputs features
"""
super(Perceptron, self).__init__()
self.fc1 = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.cuda
assert_size_stride = torch._C._dynamo.gu... | arhouati/NLP_with_Pytorch | Perceptron | false | 1,466 | [
"MIT"
] | 0 | 8063cdb4b1245c59db2cd57f23b2cbde577c2c0f | https://github.com/arhouati/NLP_with_Pytorch/tree/8063cdb4b1245c59db2cd57f23b2cbde577c2c0f |
SeqKD | import torch
import torch.nn as nn
import torch.nn.functional as F
class SeqKD(nn.Module):
"""
NLL loss with label smoothing.
"""
def __init__(self, T=1):
super(SeqKD, self).__init__()
self.kdloss = nn.KLDivLoss(reduction='batchmean')
self.T = T
def forward(self, predicti... | 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... | ardasatata/SLR | SeqKD | false | 1,467 | [
"Apache-2.0"
] | 0 | a001a19775646cf7bab92f59e0d40019efb909c6 | https://github.com/ardasatata/SLR/tree/a001a19775646cf7bab92f59e0d40019efb909c6 |
DynamicConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn
class DynamicConv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True, sr_in_list=(1.0,),
sr_out_list=None):
self.sr_idx, self.sr_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
import torch.nn
assert_size_stride = torch._C._dynamo.guar... | arielclj/singa-easy | DynamicConv2d | false | 1,468 | [
"Apache-2.0"
] | 0 | fd4bc601a5501062936f874df14711a3cefa1346 | https://github.com/arielclj/singa-easy/tree/fd4bc601a5501062936f874df14711a3cefa1346 |
GeLU | import math
import torch
import torch.nn as nn
import torch.utils.data
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.nn as nn
import torch.utils.data
assert_size_stride = ... | ashutoshbaghel/tgifqa-lxmert | GeLU | false | 1,469 | [
"MIT"
] | 0 | 7969f478d20fbfbba1c0eaaf0b96891654bfcc26 | https://github.com/ashutoshbaghel/tgifqa-lxmert/tree/7969f478d20fbfbba1c0eaaf0b96891654bfcc26 |
ChanLayerNorm | import torch
import torch.nn as nn
class ChanLayerNorm(nn.Module):
"""Channelwise LayerNorm"""
def __init__(self, d: 'int', **kwargs):
super().__init__()
self.ln = nn.LayerNorm(d, **kwargs)
def forward(self, x):
x = self.ln(x.permute(0, 2, 3, 1))
return x.permute(0, 3, 1,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | arampacha/generative_models | ChanLayerNorm | false | 1,470 | [
"Apache-2.0"
] | 0 | 34f5a2fc760bbd7f9f9a956d8d8670c9746e5152 | https://github.com/arampacha/generative_models/tree/34f5a2fc760bbd7f9f9a956d8d8670c9746e5152 |
CNNPolicy | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNNPolicy(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, conv1_filters=32,
conv2_filters=32, conv3_filters=32, fc1_units=200, fc2_units=200):
"""Initialize parameters and build ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | anindex/deepRL-projects | CNNPolicy | false | 1,471 | [
"MIT"
] | 0 | bed03d1f985c8340fc75f715028b632bdce40641 | https://github.com/anindex/deepRL-projects/tree/bed03d1f985c8340fc75f715028b632bdce40641 |
P_net | import torch
import torch.nn as nn
import torch.nn.functional as F
class P_net(nn.Module):
def __init__(self, X_dim, N, z_dim):
super(P_net, self).__init__()
self.lin1 = nn.Linear(z_dim, int(N / 2))
self.lin2 = nn.Linear(int(N / 2), N)
self.lin4 = nn.Linear(N, X_dim)
def forw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | arnaghosh/VoxNet | P_net | false | 1,472 | [
"MIT"
] | 0 | 45fe8e9ff28b02f21b8991486317ff61cfa5d553 | https://github.com/arnaghosh/VoxNet/tree/45fe8e9ff28b02f21b8991486317ff61cfa5d553 |
BatchNorm | import torch
import torch.nn as nn
class BatchNorm(nn.Module):
def __init__(self, num_channels):
super().__init__()
theta_mu = torch.zeros(num_channels)
theta_sigma = torch.ones(num_channels)
self.theta_mu = nn.Parameter(theta_mu)
self.theta_sigma = nn.Parameter(theta_sigm... | 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_... | anish-pratheepkumar/GitDeepLearningStudy | BatchNorm | false | 1,473 | [
"MIT"
] | 0 | 3d1873e2ac70b9ee6cca309e96759e1714bc73f1 | https://github.com/anish-pratheepkumar/GitDeepLearningStudy/tree/3d1873e2ac70b9ee6cca309e96759e1714bc73f1 |
VectorQuantizer | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.nn.functional as F
class VQPseudoGrad(Function):
@staticmethod
def forward(ctx, z, q):
return q
@staticmethod
def backward(ctx, grad_output):
return grad_output, None
class VectorQuantizer(nn.Module... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.autograd import Fu... | arampacha/generative_models | VectorQuantizer | false | 1,474 | [
"Apache-2.0"
] | 0 | 34f5a2fc760bbd7f9f9a956d8d8670c9746e5152 | https://github.com/arampacha/generative_models/tree/34f5a2fc760bbd7f9f9a956d8d8670c9746e5152 |
ResidualConvUnit | import torch
import torch.nn as nn
class ResidualConvUnit(nn.Module):
"""Residual convolution module.
"""
def __init__(self, features):
"""Init.
Args:
features (int): number of features
"""
super().__init__()
self.conv1 = nn.Conv2d(features, 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 import triton_helpers
import torch.nn as nn
assert_... | anlok/depthmap-loktev | ResidualConvUnit | false | 1,475 | [
"MIT"
] | 0 | c5af9156985524063c5e49c52bc28aab3290da71 | https://github.com/anlok/depthmap-loktev/tree/c5af9156985524063c5e49c52bc28aab3290da71 |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self, n_inputs, n_units=[50, 50, 50]):
super(Net, self).__init__()
self.fc1 = nn.Linear(n_inputs, n_units[0])
self.fc2 = nn.Linear(n_units[0], n_units[1])
self.fc3 = nn.Linear(n_units[1], n_units[2])
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | apaleyes/pybnn | Net | false | 1,476 | [
"BSD-3-Clause"
] | 0 | 1362546662ebdf5d7f507add16a386fa665c51a1 | https://github.com/apaleyes/pybnn/tree/1362546662ebdf5d7f507add16a386fa665c51a1 |
GramMatrix | import torch
import torch.nn as nn
class GramMatrix(nn.Module):
def forward(self, input):
a, b, c, d = input.size()
features = input.view(a * b, c * d)
G = torch.mm(features, features.t())
return G.div(a * b * c * d)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | asapypy/mokumokuTorch | GramMatrix | false | 1,477 | [
"MIT"
] | 0 | ec59877b407a3f0ac1a9627ea5609698f2979278 | https://github.com/asapypy/mokumokuTorch/tree/ec59877b407a3f0ac1a9627ea5609698f2979278 |
Reconstruction_Layer | import torch
class Reconstruction_Layer(torch.nn.Module):
"""TThis is the reconstruction layer for the network to learn how to remake
the original input image"""
def __init__(self, batch_size, capsin_n_maps, capsin_n_dims,
reconstruct_channels):
super(Reconstruction_Layer, 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
assert_size_stride = torch._C... | arjunsbalaji/oct | Reconstruction_Layer | false | 1,478 | [
"Apache-2.0"
] | 0 | f21e11f6dda952cd914444512ddadb4141757951 | https://github.com/arjunsbalaji/oct/tree/f21e11f6dda952cd914444512ddadb4141757951 |
Q_net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Q_net(nn.Module):
def __init__(self, X_dim, N, z_dim):
super(Q_net, self).__init__()
self.xdim = X_dim
self.lin1 = nn.Linear(X_dim, N)
self.lin3 = nn.Linear(N, int(N / 2))
self.lin3gauss = nn.Linear(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
import torch.nn as nn
assert_... | arnaghosh/VoxNet | Q_net | false | 1,479 | [
"MIT"
] | 0 | 45fe8e9ff28b02f21b8991486317ff61cfa5d553 | https://github.com/arnaghosh/VoxNet/tree/45fe8e9ff28b02f21b8991486317ff61cfa5d553 |
Agreement_Routing_Down | import torch
def squash(s, axis=-1, epsilon=1e-07):
squared_norm = torch.sum(s * s, dim=axis)
safe_norm = torch.sqrt(squared_norm + epsilon)
squash_factor = squared_norm / (1.0 + squared_norm)
unit_vector = torch.div(s, safe_norm.unsqueeze(-1))
return torch.mul(squash_factor.unsqueeze(-1), unit_ve... | 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... | arjunsbalaji/oct | Agreement_Routing_Down | false | 1,480 | [
"Apache-2.0"
] | 0 | f21e11f6dda952cd914444512ddadb4141757951 | https://github.com/arjunsbalaji/oct/tree/f21e11f6dda952cd914444512ddadb4141757951 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 32, (3, 3))
self.pool1 = nn.MaxPool2d((2, 2))
self.conv2 = nn.Conv2d(32, 32, (3, 3))
self.pool2 = nn.MaxPool2d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | arcada-uas/intro-to-dl | Net | false | 1,481 | [
"MIT"
] | 0 | 675741ad123e88158ecab88f887ea31113c99e7a | https://github.com/arcada-uas/intro-to-dl/tree/675741ad123e88158ecab88f887ea31113c99e7a |
D_net_gauss | import torch
import torch.nn as nn
import torch.nn.functional as F
class D_net_gauss(nn.Module):
def __init__(self, N, z_dim):
super(D_net_gauss, self).__init__()
self.lin1 = nn.Linear(z_dim, N)
self.lin3 = nn.Linear(N, int(N / 2))
self.lin4 = nn.Linear(int(N / 2), 10)
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.... | arnaghosh/VoxNet | D_net_gauss | false | 1,482 | [
"MIT"
] | 0 | 45fe8e9ff28b02f21b8991486317ff61cfa5d553 | https://github.com/arnaghosh/VoxNet/tree/45fe8e9ff28b02f21b8991486317ff61cfa5d553 |
CombineSlices | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
class CombineSlices(nn.Module):
def __init__(self, slice_dim=2):
super().__init__()
self.slice_dim = slice_dim
def forward(self, x):
return torch.index_select(x, dim=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 import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
assert_size_stride = torch._C._dynamo.gu... | aslakey/fastMRI | CombineSlices | false | 1,483 | [
"MIT"
] | 0 | e94028aeccfdc70472b453c2ef2f072b40a287c7 | https://github.com/aslakey/fastMRI/tree/e94028aeccfdc70472b453c2ef2f072b40a287c7 |
Cartesian | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
class Cartesian(nn.Module):
def forward(self, x):
r, phi = x[..., 0], x[..., 1]
return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1)
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 math as tl_math
from torch import nn
import torch.utils.data
import torch.utils.data.dist... | aslakey/fastMRI | Cartesian | false | 1,484 | [
"MIT"
] | 0 | e94028aeccfdc70472b453c2ef2f072b40a287c7 | https://github.com/aslakey/fastMRI/tree/e94028aeccfdc70472b453c2ef2f072b40a287c7 |
Downsample | import torch
import torch.nn as nn
import torch._utils
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class Downsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.wit... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.parallel
import torch.... | ashwinipokle/deq | Downsample | false | 1,485 | [
"MIT"
] | 0 | 955560601ac7b9dd3088e918850efd9ba14b7610 | https://github.com/ashwinipokle/deq/tree/955560601ac7b9dd3088e918850efd9ba14b7610 |
Blind_UNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class crop(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
N, C, H, W = x.shape
x = x[0:N, 0:C, 0:H - 1, 0:W]
return x
class shift(nn.Module):
def __init__(self):
super(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | amonod/udvd | Blind_UNet | false | 1,486 | [
"MIT"
] | 0 | a1ccb777d205255ac68c40efb93dd3996f562c45 | https://github.com/amonod/udvd/tree/a1ccb777d205255ac68c40efb93dd3996f562c45 |
self_attn_mini | import torch
import torch.nn as nn
class self_attn_mini(nn.Module):
def __init__(self, input_size):
super(self_attn_mini, self).__init__()
self.input_size = input_size
self.key = nn.Linear(input_size, input_size, bias=False)
self.query = nn.Linear(input_size, input_size, bias=Fals... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | aryanbdps9/aml_music_generation | self_attn_mini | false | 1,487 | [
"MIT"
] | 0 | 42c8895128327a2884dbfeb8413e0060fef6e22f | https://github.com/aryanbdps9/aml_music_generation/tree/42c8895128327a2884dbfeb8413e0060fef6e22f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.