跳到主要內容

tf.cast()

Ref:
https://blog.csdn.net/UESTC_C2_403/article/details/72190282

tf.cast用法

例如:
  1. import tensorflow as tf;
  2. import numpy as np;
  3. A = tf.convert_to_tensor(np.array([[1,1,2,4], [3,4,8,5]]))
  4. with tf.Session() as sess:
  5. print A.dtype
  6. b = tf.cast(A, tf.float32)
  7. print b.dtype
输出:
<dtype: 'int64'>
<dtype: 'float32'>

留言

這個網誌中的熱門文章

DeepRacer

Preliminary training: deepracer-github-simapp.tar.gz Reward function: ./opt/install/sagemaker_rl_agent/lib/python3.5/site-packages/markov/environments/deepracer_env.py action = [steering_angle, throttle] TRAINING_IMAGE_SIZE = (160, 120) Plotted waypoints in vertices array of hard track Parameters: on_track, x, y, distance_from_center, car_orientation, progress, steps,                                                                          throttle, steering, track_width, waypoints, closest_waypoints Note: Above picture is from https://yanpanlau.github.io/2016/10/11/Torcs-Keras.html