더북(TheBook)
import math, os
import unidecode

import tensorflow as tf
import numpy as np
import pandas as pd
import transformers
from tqdm.auto import tqdm

def _bytes_feature(value):
    """Returns a bytes_list from a string / byte."""
    if isinstance(value, type(tf.constant(0))):
        value = value.numpy()  # BytesList won't unpack a string from an EagerTensor.
    return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))

def _float_feature(value):
    """Returns a float_list from a float / double."""
    return tf.train.Feature(float_list=tf.train.FloatList(value=[value]))

def _float_array_feature(value):
    """Returns a float_list from a float / double."""  # FloatList가 리스트 형태인 경우
    return tf.train.Feature(float_list=tf.train.FloatList(value=value.reshape(-1)))

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.