Question: Write TensorFlow code to provide the solutions to the following simple problems: 1 . Declare two constant tensors that have the values of 1 5

Write TensorFlow code to provide the solutions to the following simple problems:
1. Declare two constant tensors that have the values of 15 and 45. Add these two tensors and print
out the results.
2. Declare two variable tensors, a and b, that are initialized with scalar values of 2.75 and 8.5. Find
their product and print out the result.
3. Create two placeholders: x and y - that are both scalars of 32-bit floats. Assign 5.25 to x and 12.6
to y, multiply them together, and print out the results.
4. Create one placeholder: z - that is an N-Dimensional array (N can be >=1) that can have any
shape (shape = None). Feed this vector [1,3,5,7,9] into z and multiply it by 3. Display the
results.
5. Create a constant tensor that is a matrix of the shape (8,8). The matrix is initialized with all
ones (1). Create a variable tensor that is also a matrix of the shape (8,8) and initialized with
random integer values between 0 and 99. Add these two tensors and display the results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!