Search code examples
pythontensorflowmachine-learninggraphtensorboard

Name use in computational graph image (TensorBoard)


I'm a noob in tensorflow and I start working on "Getting Started With TensorFlow" tutorial. In this tutorial there is an image of graph. In this image I don't find explanation about range and rank node. I feel that these two nodes are used to find range (0 and N-1) and data rank in sum : enter image description here

Is it right ?

When there is such a node in graph is it good to use doc :

https://www.tensorflow.org/api_docs/python/tf/range

https://www.tensorflow.org/api_docs/python/tf/rank

enter image description here


Solution

  • You are right in that range and Rank on the picture correspond to tf.range and tf.rank ops in tensorflow. They come not from the squares themselves (you can see the Square op below), but from tf.reduce_sum:

    loss = tf.reduce_sum(tf.square(linear_model - y)) # sum of the squares
    

    If you look at the source code in tensorflow/python/ops/math_ops.py, you can see them clearly in _ReductionDims function, which is used by tf.reduce_sum internally.