Skip to content

Instantly share code, notes, and snippets.

View aribornstein's full-sized avatar

PythicCoder aribornstein

View GitHub Profile
def spec_to_image(spec, eps=1e-6):
mean = spec.mean()
std = spec.std()
spec_norm = (spec - mean) / (std + eps)
spec_min, spec_max = spec_norm.min(), spec_norm.max()
spec_scaled = 255 * (spec_norm - spec_min) / (spec_max - spec_min)
spec_scaled = spec_scaled.astype(np.uint8)
return spec_scaled
@dolaameng
dolaameng / variable_rnn_torch.py
Last active December 31, 2021 05:19
Variable Length Sequence for RNN in pytorch Example
import torch
import torch.nn as nn
from torch.autograd import Variable
batch_size = 3
max_length = 3
hidden_size = 2
n_layers =1
# container
@sedouard
sedouard / sendToEventHub.py
Created November 13, 2014 04:09
Generate SAS Token for eventhub from Python
import urllib
import time
import hmac
import hashlib
import base64
def _sign_string(uri, key, key_name):
'''
100000 = milsecond expiry
'''