naturalizing

… and what should be natural, in starting, on a Tuesday morning?

I must go to the bottom of things, it’s early. What is a file, how does VS Code place itself on the Terminal? Still a new environment for me, I feel myself questioning the decisions behind its organization, and not being able to find quick answers to my questions.

Running in terminal — that is, in the terminal in VS code — I can type in all of the examples.

import numpy as numpy
import tensorflow as tf 

tf.InteractiveSession()

a = tf.zeros(2)
a.eval()

… but by the way, what is to close a session? I guess this will be clarified with the idea of session… then the function

tf.interactiveSession.close()

will make more sense. It doesn’t work within a file. Clear enough: it’s not interactive.

So, setting the environment (python 3.6.8 64-bit base) allows me to run the above (by selecting) as though I were typing it in as <stdin>. That’s interactive. In a static sort of way.


And so, further, to vectors. One introductory question for the morning: why does the ‘shape’ tensor have a blank space:

<tf.Tensor 'zeros_1:0' shape=(2,) dtype=float32>
>>> a.eval()
array([0., 0.], dtype=float32)

Or more, generally, how can I parse (for myself) the info: ‘zeros_1:0’ shape=(2,)? It’s not automatic. I need a good sentence or picture that will stick with me.

Quick answer: it’s not a Tensor, it’s a Python tuple (shape, that is), and so it needs a comma there at the end. But ‘zeros_1:0’… some sort of tracking in the session?

There’s always something. Es gibt immer eine Sache.

Leave a comment

Your email address will not be published. Required fields are marked *