Skip to content

Instantly share code, notes, and snippets.

View OleguerCanal's full-sized avatar
🤯

Oleguer OleguerCanal

🤯
View GitHub Profile
@TravisDunlop
TravisDunlop / freeze_stable_baselines.py
Last active January 25, 2020 20:34
Freeze a stable-baselines model to a protocol buffer file (i.e. .pb or .bytes)
'''
Freezing a stable-baselines to a frozen protocol buffer file to be served.
https://github.com/hill-a/stable-baselines
Some code taken from this lovely blog series
https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc
'''
import tensorflow as tf
import os
@rwightman
rwightman / median_pool.py
Last active July 22, 2024 16:31
PyTorch MedianPool (MedianFilter)
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.