Reputation: 3781
Which function is used to get the data type of tensors in tensorflow in python? I need to define dynamic data types according to different tensors.
Upvotes: 10
Views: 11143
Reputation: 19634
You can get the type using x.dtype
, as follows:
import tensorflow as tf
x=tf.constant([1,2])
x.dtype
This prints tf.int32
Upvotes: 14