Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import nn | |
import torch.nn.functional as F | |
from collections import OrderedDict | |
import math | |
def pdist(v): | |
dist = torch.norm(v[:, None] - v, dim=2, p=2) | |
return dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' Two sample RNN (1d CNN + LSTM) networks used in the Kaggle | |
QuickDraw Challenge (https://www.kaggle.com/c/quickdraw-doodle-recognition) | |
Both of these networks expect a tuple input with first element being the sequences | |
and second being the sequence lengths (typical sorted packed format). The sequence tensor | |
should adhere to the following shape: (batch_size, channels, seq_len). | |
Where channels consists of stroke [x, y, t, end]. End indicates whether the | |
stroke is the last in a segment (pen up). It could easily be changed to start | |
(pen down) or combo of both. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.nn.modules.utils import _pair, _quadruple | |
class MedianPool2d(nn.Module): | |
""" Median pool (usable as median filter when stride=1) module. | |
NewerOlder