Skip to content
Related Articles

Related Articles

Python – tensorflow.DeviceSpec.job Attribute

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jul, 2020
View Discussion
Improve Article
Save Article

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 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 the job
job = device_spec.job
  
# Printing the result
print('Job: ', job)

Output:


Device Spec:  <tensorflow.python.framework.device_spec.DeviceSpecV2 object at 0x7fe5ba9810a8>
Job:  gfg

Example 2:

Python3




# Importing the library
import tensorflow as tf
  
# Initializing Device Specification
device_spec = tf.DeviceSpec(job ="gfg2", device_type ="GPU", device_index = 1)
  
# Printing the DeviceSpec object
print('Device Spec: ', device_spec)
  
# Getting the job
job = device_spec.job
  
# Printing the result
print('Job: ', job)

Output:


Device Spec:  <tensorflow.python.framework.device_spec.DeviceSpecV2 object at 0x7fe5ba981108>
Job:  gfg2


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!