小数点以下を切り上げる

説明

TensorFlowで小数点以下を切り上げるにはceil()を使います。ceil()の最初のパラメーターには数値や行列を指定します。

サンプルプログラム [サンプルをダウンロード]

import tensorflow as tf
import multiprocessing as mp
core_num = mp.cpu_count()
config = tf.ConfigProto(
  inter_op_parallelism_threads=core_num,
  intra_op_parallelism_threads=core_num )
a = tf.ceil([0.2, 0.5, 0.6, 0.9, -10.2, -10.5, -10.9])
ss= tf.Session(config=config)
print(ss.run(a))

実行結果

TensorFlowを使ったプログラムの実行結果
<<戻る