{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Modularization\n",
    "## Phases\n",
    " ![image](images/phase.png)\n",
    "\n",
    "- Train phase\n",
    "\n",
    "    - data\n",
    "        - (input,label)\n",
    "    - model and inference\n",
    "        - operation\n",
    "        - paramters\n",
    "    - loss\n",
    "    - optimize and update parameter\n",
    "- Test phase\n",
    "    - input data\n",
    "    - inference\n",
    "\n",
    "\n",
    "## Implement the computation using TensorFlow\n",
    "\n",
    "- Graph: assemble a graph\n",
    "    - define the input and output(label)\n",
    "        - ```placeholder```\n",
    "        - ```tf.FIFOQueue```\n",
    "        - ```tf.data```\n",
    "    - Define the inference model\n",
    "        - ```conv```,```dense```,```relu```,```pool```\n",
    "        - ```Variable```\n",
    "    - Compute loss\n",
    "        - ```l2_loss```,```reduce_mean```,```softmax_cross_entropy```\n",
    "    - Optimizer\n",
    "        - ```GradientDescentOptimizer```,```MomentumOptimizer```,```AdagradOptimizer```\n",
    "- Session: execute the graph\n",
    "    - run\n",
    "        - ```inference```,```loss```,```opt```\n",
    "\n",
    "## Folder structure\n",
    "- dataset\n",
    "    - put dataset here\n",
    "- config\n",
    "    - learning_rate\n",
    "    - weight_decay\n",
    "    - optimize method\n",
    "    - batch_size\n",
    "    - input size\n",
    "    - ...\n",
    "- model\n",
    "    - inference\n",
    "- train\n",
    "    - train.py\n",
    "- test\n",
    "    - test.py\n",
    "- scripts\n",
    "    - ```sh```\n",
    "- utils\n",
    "    - data read\n",
    "    - data preprocess\n",
    "    - compute acc\n",
    "    \n",
    "\n",
    "## Debug your program in different levels\n",
    "- python language grammar\n",
    "    - mixed between python2 and python3\n",
    "- TensorFlow static graph\n",
    "    - ```dimension do not match```,```some dimension is None```\n",
    "- TensorFlow execute\n",
    "    - ```you must feed a value```,```some variable not intialize```,```nan```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
