Code samples

Looking at different code samples and instructions related to Tensorflow, google machine learning library. Calculation is recursively abstracted away in different levels of "virtualization".

1. Not only a machine learning library. Comparison between program architecture of Tensorflow and Scikit. (Show side by side directory listings).

2. Tensorflow instructions suggest using a virtual environment. Virtualenv is a tool to keep the dependencies required by different Python projects in separate places.

$ source ~/tensorflow/bin/activate  # If using bas
$ source ~/tensorflow/bin/activate.csh  # If using csh
(tensorflow)$  # Your prompt should change.

3. Comparison of the Tensorflow code and its API, how it is experienced from the point of view of the programer and the programer-user.
3.1. Tensorflow creates a mchine within the machine.

/* static */ port::StatusOr
MachineManager::CreateSingletonInternal(PlatformKind platform,
                                        DeviceOptions options,
                                        const PluginConfig &config) {
  if (singleton_ != nullptr) {
    return port::Status{
        "cannot create machine manager singleton; one already exists"};
3.2. The programer experiences it as a graph.
import tensorflow as tf

# Create a Constant op that produces a 1x2 matrix.  The op is
# added as a node to the default graph.
# The value returned by the constructor represents the output
# of the Constant op.
matrix1 = tf.constant([[3., 3.]])

4. When the calculation is finally executed, the algorithm relates to its training data via inference. In this case an image is inferred.
def main(_):
  image = (FLAGS.image_file if FLAGS.image_file else
           os.path.join(FLAGS.model_dir, 'cropped_panda.jpg'))
See results.