In this section, we will use TensorFlow to build some machine learning models. First, we will build a simple linear regression model and then a convolutional neural network model, similar to what we have seen in Chapter 5, Image Classification Using Convolutional Neural Networks.
The following code loads the TensorFlow library. We can confirm it loaded successfully by setting and accessing a constant string value:
> library(tensorflow)
# confirm that TensorFlow library has loaded
> sess=tf$Session()
> hello_world <- tf$constant('Hello world from TensorFlow')
> sess$run(hello_world)
b'Hello world from TensorFlow'