Unit1-Building Models With Tensorflow
Unit1-Building Models With Tensorflow
TensorFlow
Why TesnorFlow ?
• Whether you’re an expert or a beginner, TensorFlow is an end-to-end
platform that makes it easy for you to build and deploy ML models.
https://www.youtube.com/watch?time_continue=109&v=NlpS-DhayQA&feature=emb_logo
Easy Model building
• TensorFlow offers multiple levels of abstraction so you can choose
the right one for your needs. Build and train models by using the
high-level Keras API, which makes getting started with TensorFlow
and machine learning easy.
• If you need more flexibility, eager execution allows for immediate
iteration and intuitive debugging. For large ML training tasks, use the
Distribution Strategy API for distributed training on different
hardware configurations without changing the model definition.
https://www.youtube.com/watch?time_continue=49&v=v-FgOACRgfs&feature=emb_logo
Robust ML production anywhere
• TensorFlow has always provided a direct path to production. Whether
it’s on servers, edge devices, or the web, TensorFlow lets you train
and deploy your model easily, no matter what language or platform
you use.
• Use TensorFlow Extended (TFX) if you need a full production ML
pipeline. For running inference on mobile and edge devices, use
TensorFlow Lite. Train and deploy models in JavaScript environments
using TensorFlow.js.
https://www.youtube.com/watch?time_continue=143&v=tPb2u9kwh2w&feature=emb_logo
Powerful experimentation for research
• Build and train state-of-the-art models without sacrificing speed or
performance. TensorFlow gives you the flexibility and control with
features like the Keras Functional API and Model Subclassing API for
creation of complex topologies. For easy prototyping and fast
debugging, use eager execution.
• TensorFlow also supports an ecosystem of powerful add-on libraries
and models to experiment with, including Ragged Tensors,
TensorFlow Probability, Tensor2Tensor and BERT.
https://www.youtube.com/watch?v=p45kQklIsd4&feature=emb_logo
tf.test.is_built_with_cuda
• Returns whether TensorFlow was built with CUDA (GPU) support.
import tensorflow as tf
Print(tf.__version__)
print(tf.test.is_built_with_cuda())
tf.test.is_built_with_gpu_support
• Returns whether TensorFlow was built with GPU (i.e. CUDA or ROCm)
support.
import tensorflow as tf
print(tf.test.is_built_with_gpu_support())
tf.test.gpu_device_name
• Returns the name of a GPU device if available or the empty string.
import tensorflow as tf
print(tf.test.gpu_device_name())
import tensorflow as tf
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))
Number of GPU available
import tensorflow as tf
print("Num GPUs Available: ",
len(tf.config.experimental.list_physical_devices('GPU')))
tf.config.list_physical_devices
import tensorflow as tf
physical_devices=tf.config.list_physical_devices()
for row in physical_devices:
print(row)