Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is tf.Variable uppercase but tf.constant lowercase?

Tags:

tensorflow

There is a little hard to guess why the case (I mean, upper case versus lower case) of constructors for variable, placeholder and constant is not the same, as below: tf.Variable(), tf.placeholder(), tf.constant().

What is the inherent difference between the variable method and the rest, that is start with an upper case letter?

like image 576
user25004 Avatar asked Apr 21 '17 05:04

user25004


People also ask

What is the difference between TF constant and TF variable?

In TensorFlow the differences between constants and variables are that when you declare some constant, its value can't be changed in the future (also the initialization should be with a value, not with operation). Nevertheless, when you declare a Variable, you can change its value in the future with tf.

Why is TF constant?

tf. constant is useful for asserting that the value can be embedded that way. If the argument dtype is not specified, then the type is inferred from the type of value . # Constant 1-D Tensor from a python list.

Why would you write a variable name in all uppercase all capital letters in Python?

Variables can only contain upper and lowercase letters (Python is case-sensitive) and _ (the underscore character). Hence, because we can't have spaces in variable names a common convention is to capitalize the first letter of every word after the first. For example, myName, or debtAmountWithInterest.

What is TF variable?

A tf. Variable represents a tensor whose value can be changed by running ops on it. Specific ops allow you to read and modify the values of this tensor. Higher level libraries like tf.


1 Answers

tf.constant() and tf.placeholder() are nodes in the graph (ops or operations). On the other hand tf.Variable() is a class.

And in PEP8 python style guide:

Class names should normally use the CapWords convention.

like image 127
Salvador Dali Avatar answered Oct 13 '22 07:10

Salvador Dali