Python - tensorflow.DeviceSpec.device_type Attribute Last Updated : 28 Jul, 2020 Comments Improve Suggest changes Like Article Like Report TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks. device_type is used to get the device type of DeviceSpec. Syntax: tensorflow.DeviceSpec.device_type Returns: It returns the device type. Example 1: Python3 # Importing the library import tensorflow as tf # Initializing Device Specification device_spec = tf.DeviceSpec(job ="gfg", device_type ="CPU", device_index = 1) # Printing the DeviceSpec object print('Device Spec: ', device_spec) # Getting device type device_type = device_spec.device_type # Printing the result print('Device Type: ', device_type) Output: Device Spec: <tensorflow.python.framework.device_spec.DeviceSpecV2 object at 0x7fe5ba96af48> Device Type: CPU Example 2: Python3 # Importing the library import tensorflow as tf # Initializing Device Specification device_spec = tf.DeviceSpec(job ="gfg", device_type ="GPU", device_index = 1) # Printing the DeviceSpec object print('Device Spec: ', device_spec) # Getting device type device_type = device_spec.device_type # Printing the result print('Device Type: ', device_type) Output: Device Spec: <tensorflow.python.framework.device_spec.DeviceSpecV2 object at 0x7fe5ba96aee8> Device Type: GPU Comment More infoAdvertise with us Next Article Python - tensorflow.DeviceSpec.device_type Attribute aman neekhara Follow Improve Article Tags : Python Python-Tensorflow Python Tensorflow-math-functions Practice Tags : python Similar Reads Python - tensorflow.DeviceSpec.device_index Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. device_index is used to get the device index of DeviceSpec. Syntax: tensorflow.DeviceSpec.device_index Returns: It returns the device index. Example 1: Python3 # Import 1 min read Python - tensorflow.IndexedSlices.device Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. device is used to find the name of the device on which values will be generated. Syntax: tensorflow.IndexedSlices.device Returns: It returns the name of the device. Exam 1 min read Python - tensorflow.DeviceSpec.job Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. job is used to get the job from the Device Specification. Syntax: tensorflow.DeviceSpec.job Returns: It returns the job of the DeviceSpec. Example 1: Python3 # Importing 1 min read Python - tensorflow.DeviceSpec.task Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. task is used to get the task index of DeviceSpec. Syntax: tensorflow.DeviceSpec.task Returns: It returns the task index of DeviceSpec Example 1: Python3 # Importing the 1 min read Python - tensorflow.DeviceSpec.replica Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. replica is used to get the replica index of DeviceSpec. Syntax: tensorflow.DeviceSpec.replica Returns: It returns the replica index of the DeviceSpec. Example 1: Python 1 min read Python - tensorflow.IndexedSlices.op Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. op is used to find the operation used to that produces value as an output. It only works when eager execution is disabled. Syntax: tensorflow.IndexedSlices.op Returns: I 2 min read Python - tensorflow.IndexedSlices.values Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. values is used to get the values of the slice. Syntax: tensorflow.IndexedSlices.values Returns: It returns a Tensor containing the values of the slice. Example 1: Python 1 min read Python - tensorflow.IndexedSlices.dtype Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. dtype is used to find the type of values in Tensor. Syntax: tensorflow.IndexedSlices.dtype Returns: It returns the dtype of elements in the tensor. Example 1: Python3 # 1 min read Python - tensorflow.IndexedSlices.shape Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. shape is used to get the tensorflow.TensorShape representing the shape of the dense tensor. Syntax:  tensorflow.IndexedSlices.shape Returns:  It returns tensorflow.Tenso 1 min read Python - tensorflow.IndexedSlices.dense_shape Attribute TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. dense_shape returns a 1-D tensor containing the shape of the corresponding dense tensor. Syntax: tensorflow.IndexedSlices.dense_shape Returns: It returns a 1-D Tensor. 1 min read Like