Hi,
How to use the multi-dimensional matrix with TensorFlow? I am searching for TensorFlow placeholder matrix with multi dimensions.
Thanks
Hi,
TensorFlow supports multi-dimensional matrix and it can easily perform various operations on the matrix. In the following example we are defining a multi-dimensional matrix as placeholder and then using it for multiplication.
Here is simple example code:
#Multi dimentional matrix example import tensorflow as tf x = tf.placeholder("float", [None, 3]) y = x * 2 sess = tf.Session() model = tf.global_variables_initializer() x_data = [[10, 15, 24], [59, 70, 40],] result = sess.run(y, feed_dict={x: x_data}) print(result)
Above program displays following details when executed:
C:\Users\Dell>python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import tensorflow as tf >>> >>> x = tf.placeholder("float", [None, 3]) >>> y = x * 2 >>> >>> sess = tf.Session() >>> model = tf.global_variables_initializer() >>> >>> x_data = [[10, 15, 24], [59, 70, 40],] >>> >>> result = sess.run(y, feed_dict={x: x_data}) >>> print(result) [[ 20. 30. 48.] [ 118. 140. 80.]] >>> >>> >>>
Thanks
Hi,
You can learn TensorFlow at following urls:
Learn TensorFlow with above tutorials.
Thanks
Ads