June 2023
Intermediate to advanced
316 pages
4h 31m
Japanese
1 from keras.models import Sequential 2 from keras.layers import Dense 3 import numpy as np 4 import sys, os, string 5 6 characters = string.printable 7 char_indices = dict((c, i) for i, c in enumerate(characters)) 8 indices_char = dict((i, c) for i, c in enumerate(characters)) 9 10 INPUT_VOCAB_SIZE = len(characters) 11 LINE_SIZE = 80 12 13 def encode_one_hot(line): 14 x = np.zeros((1, LINE_SIZE, INPUT_VOCAB_SIZE)) 15 sp_idx = char_indices[' '] 16 for i, c in enumerate(line): 17 index = char_indices[c] if c in characters ...
Read now
Unlock full access