How to understand the term `tensor` in TensorFlow?

前端 未结 4 1687
温柔的废话
温柔的废话 2020-12-02 05:14

I am new to TensorFlow. While I am reading the existing documentation, I found the term tensor really confusing. Because of it, I need to clarify the following

4条回答
  •  鱼传尺愫
    2020-12-02 06:11

    From the glossary:

    A Tensor is a typed multi-dimensional array. For example, a 4-D array of floating point numbers representing a mini-batch of images with dimensions [batch, height, width, channel].

    Basically, every data is a Tensor in TensorFlow (hence the name):

    • placeholders are Tensors to which you can feed a value (with the feed_dict argument in sess.run())
    • Variables are Tensors which you can update (with var.assign()). Technically speaking, tf.Variable is not a subclass of tf.Tensor though
    • tf.constant is just the most basic Tensor, which contains a fixed value given when you create it

    However, in the graph, every node is an operation, which can have Tensors as inputs or outputs.

提交回复
热议问题