- https://www.youtube.com/watch?v=PoRJizFvM7s
- Promiseオブジェクトを返す
- resolveとrejectの二つの引数を取る
resolve()
を返したら呼び出し元でthen()
で受けられるreject()
を返したら呼び出し元でcatch()
で受けられる
const posts = [
resolve()
を返したら呼び出し元で then()
で受けられるreject()
を返したら呼び出し元で catch()
で受けられるconst posts = [
https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide/
docker run hello-world
import tensorflow as tf | |
from tensorflow.keras.layers import Dense, Flatten, Conv2D | |
from tensorflow.keras import Model | |
def load_dataset(): | |
mnist = tf.keras.datasets.mnist | |
(x_train, y_train), (x_test, y_test) = mnist.load_data() | |
x_train, x_test = x_train / 255.0, x_test / 255.0 |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
from IPython.display import display, Audio | |
wav_file = 'test.wav' | |
wav_raw = tf.io.read_file(wav_file) | |
wav_tensor = tf.audio.decode_wav(wav_raw) | |
print('sample_rate:', wav_tensor.sample_rate) |
func_args = [] | |
for wav_file in sorted(os.listdir(wav_dir)): | |
prefix = os.path.splitext(wav_file)[0] | |
wav_path = os.path.join(wav_dir, wav_file) | |
mulaw_path = os.path.join(mulaw_dir, '{}.npy'.format(prefix)) | |
melspec_path = os.path.join(melspec_dir, '{}.npy'.format(prefix)) | |
func_args.append((extract_features, wav_path, mulaw_path, melspec_path, config)) | |
with Pool(os.cpu_count()) as p: | |
for result in tqdm.tqdm(p.imap_unordered(argwrapper, func_args), total=len(func_args)): |
import os | |
import glob | |
from scipy.io import wavfile | |
import matplotlib.pyplot as plt | |
import IPython.display | |
%matplotlib inline | |
target_dir = '/path/to/*.wav' | |
for f in sorted(glob.glob(os.path.join(target_dir)))[:10]: | |
print(f) |
for layer in net.children(): | |
if isinstance(layer, nn.Conv2d): | |
do something with the layer |
load_weights = torch.load(load_path, map_location={'cuda:0': 'cpu'}) | |
net.load_state_dict(load_weights) |
torch.backends.cudnn.benchmark = True |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') |