Implementation
-
[LSTM] return_sequence = True or FalseImplementation/Text 2021. 10. 5. 13:42
### dec_hidden 값을 decoder 즉, lstm layer 에 통과시켰을 때, # return_sequence = True or False 에 따른 변경. dec_hidden.shape >>> (2,10,4) # return_sequence = False 일 때, dec_lstm = tf.keras.layers.LSTM(units= 5, return_sequence=False) dec_hidden = dec_lstm(dec_hidden, initial_state=[enc_h_state, enc_c_state], mask=dec_mask) dec_hidden.shape >>> (2,5) # return sequence = True 일 때, dec_lstm = tf.keras.layers.LST..
-
[Python] tensorflow.expand_dimsImplementation/Python 2021. 9. 28. 13:41
import numpy as np import random import tensorflow as tf sp = np.random.randint(-90, 100, (2,6)) # >>> sp # array([[ 8, -67, 34, -71, -50, -69], # [ 56, 30, 58, 76, 1, -83]]) tf.expand_dims( sp, axis=0 ) # tf.expand_dims( sp, axis=1 ) # tf.expand_dims( sp, axis=2) # # axis = 0 or 1 or 2 일 때 # axis = 0, (expanded, row, col) # axis = 1, (row, expanded, col) # axis = 2, (row, col, expanded) # 바뀐 sh..