# AI 이론/TensorFlow Function 3

TensorFlow tf.lookup

tf.lookup 의 모듈에는 다음과 같은 클래스들을 가지고 있습니다. KeyValueTensorInitalizer tf.lookup.KeyValueTensorInitializer( keys, values, key_dtype=None, value_dtype=None, name=None )​ 예제를 잠시 보겠습니다. 우선 keys,values값들은 텐서로 이루어져야 합니다. keys_tensor = tf.constant(['a', 'b', 'c']) vals_tensor = tf.constant([7, 8, 9]) input_tensor = tf.constant(['a', 'f']) init = tf.lookup.KeyValueTensorInitializer(keys_tensor, vals_tensor) ..

TensorFlow tf.strings

TensorFlow 의 tf.strings 메서드 입니다. tf.strings.substr() tf.strings.substr( input, pos, len, unit='BYTE', name=None ) input Tensor를 pos 인덱스부터 len길이전까지 짤라서 사용합니다. input = [b'Hello', b'World'] position = 1 length = 3 output = tf.strings.substr(input,position,length) # 결과 output = [b'ell', b'orl'] 각각의 데이터에 대해서 적용됩니다. Hello 의 index [1:3], World 의 index[1:3] tf.strings.regex_replace() tf.strings.regex_re..

TensorFlow batch,window 메서드

시계열 데이터를 다룰때 사용하는 메서드입니다. Batch 사용하기 range_ds = tf.data.Dataset.range(10000) # Using Batch batches = range_ds.batch(10,drop_remainder=True) for batch in batches.take(5): print(batch.numpy()) # Outputs [0 1 2 3 4 5 6 7 8 9] [10 11 12 13 14 15 16 17 18 19] [20 21 22 23 24 25 26 27 28 29] [30 31 32 33 34 35 36 37 38 39] [40 41 42 43 44 45 46 47 48 49] 한 단계 앞선 데이터를 예측하기 위한 메서드 입니다 def dense_1_step(b..

1