DataTypes in tensorflow

Tensors can take up any one of the datatypes

Datatype Python type Description
DT_INT8tf.int8signed integer of 8 bits
DT_INT16tf.int16signed integer of 16 bits
DT_INT32tf.int32signed integer of 32 bits
DT_INT64tf.int64signed integer of 64 bits
DT_UINT8tf.uint8unsigned integer of 8bits
DT_UINT16tf.uint16unsigned integer of 16bits
DT_FLOATtf.float32floating point number of size 32bits
DT_DOUBLEtf.float64floating point number of size 64biys
DT_STRINGtf.stringbyte arrays of variable lengths. Each element of a Tensor is a byte array
DT_BOOLtf.boolBoolean value true or false
DT_COMPLEX64tf.complex64Complex number made of two 32 bits floating points: real and imaginary parts
DT_COMPLEX128tf.complex128Complex number made of two 64 bits floating points: real and imaginary parts
DT_QINT8tf.qint8Signed integer of 8bits used in quantized Ops.
DT_QINT32tf.qint32Signed integer of 32bits used in quantized Ops.
DT_QUINT8tf.quint8unsigned integer of 8bits used in quantized Ops.

Arithmetic Operators in tensorflow

TensorFlow gives various operations to perform basic arithmetic operators to your graph.
Operator Description
tf.add(x,y,name=None)Returns tensor with x + y element-wise.
tf.subtract(x,y,name=none)Returns tensor with x - y element-wise.
tf.multiply(x,y,name=none)Returns tensor x * y element-wise.
tf.scalar_mul(scalar,x)Multiplies scalar with tensor (scalor*x) and returns multiplied tensor.
tf.div(x,y,name=none)Divides x / y elementwise and returns tensor
tf.divide(x,y,name=none)Computes Python style division of x by y
tf.truediv(x,y,name=none)This function converts integer into floating point and then divides. This operator is generated by normal x / y division in Python 3
tf.floordiv(x,y,name=none)Divides x / y elementwise, rounding toward the most negative integer.
tf.realdiv(x,y,name=none)Returns x / y element-wise for real types.If x and y are reals, this will return the floating-point division.
tf.truncatemod(x,y,name=none)Returns element-wise remainder of division.
tf.cross(x,y,name=none)Compute the pairwise cross product.x and y must be the same shape; they can either be simple 3-element vectors, or any shape where the innermost dimension is 3. In the latter case, each pair of corresponding 3-element vectors is cross-multiplied independently.