What does this line mean in python 3.x?
a:[1,3]
Source : https://www.youtube.com/watch?v=yX8KuPZCAMo
Time: 17:40
What does this line mean in python 3.x?
a:[1,3]
Source : https://www.youtube.com/watch?v=yX8KuPZCAMo
Time: 17:40
This is the syntax of a dictionary in Python, a data structure which maps an index to another object.
a = tf.placeholder(tf.float32)
{a: [1,3]}
In this case, a
is a Tensor
from Tensorflow and [1,3]
are the values it will assume when the graph is executed.
IMO, you should invest your time into acquiring a better understanding of elementary data structures and syntax from Python before diving into Tensorflow.
In the video, a and b are tensorflow.python.framework.ops.Tensor
Objects. At time 17:40, the instructor uses a and b as keys and their respective values [1,3] and [2, 4]. At 17:45, in the pop_up, you can see the variable name, feed_dict
. He is just creating a dictionary.
You didn't give us the whole context of the code.
{a:[1,3]}
defines a dictionary with key a
and value [1,3]
.
OP takes a part of a Dictionary out of context which can be seen at timepoint 17:47min.
a
is declared as a = tf... etc
and thus has content and context.
[1,3] are list items.
then a:[1,3] in dict
:
a = keyname. [1,3] = values
try this:
a = 'alot of words for a keyname'
b = 17.47
my_dict = {a:["sing along song", "the voice of"], b:(12, 'candidates', None, "wins")}
print my_dict.keys()