Skip to content

Instantly share code, notes, and snippets.

@sharanry
Created June 27, 2018 01:55
Show Gist options
  • Save sharanry/6090eb466d03b1e8a5c02c1629d9341a to your computer and use it in GitHub Desktop.
Save sharanry/6090eb466d03b1e8a5c02c1629d9341a to your computer and use it in GitHub Desktop.
Linear increase in nodes with every f() execution problem demonstration
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
"import os\n",
"import tensorflow as tf\n",
"import pymc4 as pm\n",
"from tensorflow_probability import edward2 as ed\n",
"from tensorflow_probability import distributions as tfd\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import seaborn as sns\n",
"from pymc4.inference.sampling.sample import sample\n",
"os.environ['TF_CPP_MIN_LOG_LEVEL'] = '0' "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Instantiating and defining the model the first time"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{}\n"
]
}
],
"source": [
"model = pm.Model()\n",
"\n",
"@model.define\n",
"def simple(cfg):\n",
" print(cfg)\n",
" ed.Normal(0., 1., name='normal')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Nodes with prefixes `normal` and `normal_1` are made"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"node {\n",
" name: \"normal/loc/input\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 0.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal/loc\"\n",
" op: \"Identity\"\n",
" input: \"normal/loc/input\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal/scale/input\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 1.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal/scale\"\n",
" op: \"Identity\"\n",
" input: \"normal/scale/input\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/sample_shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" }\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/normal/batch_shape_tensor/batch_shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" }\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat/values_0\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat/axis\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat\"\n",
" op: \"ConcatV2\"\n",
" input: \"normal_1/sample/concat/values_0\"\n",
" input: \"normal_1/sample/normal/batch_shape_tensor/batch_shape\"\n",
" input: \"normal_1/sample/concat/axis\"\n",
" attr {\n",
" key: \"N\"\n",
" value {\n",
" i: 2\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tidx\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/mean\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 0.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/stddev\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 1.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/RandomStandardNormal\"\n",
" op: \"RandomStandardNormal\"\n",
" input: \"normal_1/sample/concat\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"seed\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"seed2\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/mul\"\n",
" op: \"Mul\"\n",
" input: \"normal_1/sample/random_normal/RandomStandardNormal\"\n",
" input: \"normal_1/sample/random_normal/stddev\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal\"\n",
" op: \"Add\"\n",
" input: \"normal_1/sample/random_normal/mul\"\n",
" input: \"normal_1/sample/random_normal/mean\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/mul\"\n",
" op: \"Mul\"\n",
" input: \"normal_1/sample/random_normal\"\n",
" input: \"normal/scale\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/add\"\n",
" op: \"Add\"\n",
" input: \"normal_1/sample/mul\"\n",
" input: \"normal/loc\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/Shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice/stack\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice/stack_1\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice/stack_2\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice\"\n",
" op: \"StridedSlice\"\n",
" input: \"normal_1/sample/Shape\"\n",
" input: \"normal_1/sample/strided_slice/stack\"\n",
" input: \"normal_1/sample/strided_slice/stack_1\"\n",
" input: \"normal_1/sample/strided_slice/stack_2\"\n",
" attr {\n",
" key: \"Index\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"begin_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"ellipsis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"end_mask\"\n",
" value {\n",
" i: 1\n",
" }\n",
" }\n",
" attr {\n",
" key: \"new_axis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"shrink_axis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat_1/axis\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat_1\"\n",
" op: \"ConcatV2\"\n",
" input: \"normal_1/sample/sample_shape\"\n",
" input: \"normal_1/sample/strided_slice\"\n",
" input: \"normal_1/sample/concat_1/axis\"\n",
" attr {\n",
" key: \"N\"\n",
" value {\n",
" i: 2\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tidx\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/Reshape\"\n",
" op: \"Reshape\"\n",
" input: \"normal_1/sample/add\"\n",
" input: \"normal_1/sample/concat_1\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tshape\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"versions {\n",
" producer: 26\n",
"}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.graph.as_graph_def()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Reinstantiating and defining the model"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{}\n"
]
}
],
"source": [
"model = pm.Model()\n",
"\n",
"@model.define\n",
"def simple(cfg):\n",
" print(cfg)\n",
" ed.Normal(0., 1., name='normal')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Extra nodes with prefixes `normal_2` and `normal_3` are made"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"node {\n",
" name: \"normal/loc/input\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 0.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal/loc\"\n",
" op: \"Identity\"\n",
" input: \"normal/loc/input\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal/scale/input\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 1.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal/scale\"\n",
" op: \"Identity\"\n",
" input: \"normal/scale/input\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/sample_shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" }\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/normal/batch_shape_tensor/batch_shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" }\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat/values_0\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat/axis\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat\"\n",
" op: \"ConcatV2\"\n",
" input: \"normal_1/sample/concat/values_0\"\n",
" input: \"normal_1/sample/normal/batch_shape_tensor/batch_shape\"\n",
" input: \"normal_1/sample/concat/axis\"\n",
" attr {\n",
" key: \"N\"\n",
" value {\n",
" i: 2\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tidx\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/mean\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 0.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/stddev\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 1.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/RandomStandardNormal\"\n",
" op: \"RandomStandardNormal\"\n",
" input: \"normal_1/sample/concat\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"seed\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"seed2\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal/mul\"\n",
" op: \"Mul\"\n",
" input: \"normal_1/sample/random_normal/RandomStandardNormal\"\n",
" input: \"normal_1/sample/random_normal/stddev\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/random_normal\"\n",
" op: \"Add\"\n",
" input: \"normal_1/sample/random_normal/mul\"\n",
" input: \"normal_1/sample/random_normal/mean\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/mul\"\n",
" op: \"Mul\"\n",
" input: \"normal_1/sample/random_normal\"\n",
" input: \"normal/scale\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/add\"\n",
" op: \"Add\"\n",
" input: \"normal_1/sample/mul\"\n",
" input: \"normal/loc\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/Shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice/stack\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice/stack_1\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice/stack_2\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/strided_slice\"\n",
" op: \"StridedSlice\"\n",
" input: \"normal_1/sample/Shape\"\n",
" input: \"normal_1/sample/strided_slice/stack\"\n",
" input: \"normal_1/sample/strided_slice/stack_1\"\n",
" input: \"normal_1/sample/strided_slice/stack_2\"\n",
" attr {\n",
" key: \"Index\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"begin_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"ellipsis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"end_mask\"\n",
" value {\n",
" i: 1\n",
" }\n",
" }\n",
" attr {\n",
" key: \"new_axis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"shrink_axis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat_1/axis\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/concat_1\"\n",
" op: \"ConcatV2\"\n",
" input: \"normal_1/sample/sample_shape\"\n",
" input: \"normal_1/sample/strided_slice\"\n",
" input: \"normal_1/sample/concat_1/axis\"\n",
" attr {\n",
" key: \"N\"\n",
" value {\n",
" i: 2\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tidx\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_1/sample/Reshape\"\n",
" op: \"Reshape\"\n",
" input: \"normal_1/sample/add\"\n",
" input: \"normal_1/sample/concat_1\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tshape\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_2/loc/input\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 0.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_2/loc\"\n",
" op: \"Identity\"\n",
" input: \"normal_2/loc/input\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_2/scale/input\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 1.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_2/scale\"\n",
" op: \"Identity\"\n",
" input: \"normal_2/scale/input\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/sample_shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" }\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/normal/batch_shape_tensor/batch_shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" }\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/concat/values_0\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/concat/axis\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/concat\"\n",
" op: \"ConcatV2\"\n",
" input: \"normal_3/sample/concat/values_0\"\n",
" input: \"normal_3/sample/normal/batch_shape_tensor/batch_shape\"\n",
" input: \"normal_3/sample/concat/axis\"\n",
" attr {\n",
" key: \"N\"\n",
" value {\n",
" i: 2\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tidx\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/random_normal/mean\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 0.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/random_normal/stddev\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_FLOAT\n",
" tensor_shape {\n",
" }\n",
" float_val: 1.0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/random_normal/RandomStandardNormal\"\n",
" op: \"RandomStandardNormal\"\n",
" input: \"normal_3/sample/concat\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"seed\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"seed2\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/random_normal/mul\"\n",
" op: \"Mul\"\n",
" input: \"normal_3/sample/random_normal/RandomStandardNormal\"\n",
" input: \"normal_3/sample/random_normal/stddev\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/random_normal\"\n",
" op: \"Add\"\n",
" input: \"normal_3/sample/random_normal/mul\"\n",
" input: \"normal_3/sample/random_normal/mean\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/mul\"\n",
" op: \"Mul\"\n",
" input: \"normal_3/sample/random_normal\"\n",
" input: \"normal_2/scale\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/add\"\n",
" op: \"Add\"\n",
" input: \"normal_3/sample/mul\"\n",
" input: \"normal_2/loc\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/Shape\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/strided_slice/stack\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/strided_slice/stack_1\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/strided_slice/stack_2\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" dim {\n",
" size: 1\n",
" }\n",
" }\n",
" int_val: 1\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/strided_slice\"\n",
" op: \"StridedSlice\"\n",
" input: \"normal_3/sample/Shape\"\n",
" input: \"normal_3/sample/strided_slice/stack\"\n",
" input: \"normal_3/sample/strided_slice/stack_1\"\n",
" input: \"normal_3/sample/strided_slice/stack_2\"\n",
" attr {\n",
" key: \"Index\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"begin_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"ellipsis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"end_mask\"\n",
" value {\n",
" i: 1\n",
" }\n",
" }\n",
" attr {\n",
" key: \"new_axis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
" attr {\n",
" key: \"shrink_axis_mask\"\n",
" value {\n",
" i: 0\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/concat_1/axis\"\n",
" op: \"Const\"\n",
" attr {\n",
" key: \"dtype\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"value\"\n",
" value {\n",
" tensor {\n",
" dtype: DT_INT32\n",
" tensor_shape {\n",
" }\n",
" int_val: 0\n",
" }\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/concat_1\"\n",
" op: \"ConcatV2\"\n",
" input: \"normal_3/sample/sample_shape\"\n",
" input: \"normal_3/sample/strided_slice\"\n",
" input: \"normal_3/sample/concat_1/axis\"\n",
" attr {\n",
" key: \"N\"\n",
" value {\n",
" i: 2\n",
" }\n",
" }\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tidx\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"node {\n",
" name: \"normal_3/sample/Reshape\"\n",
" op: \"Reshape\"\n",
" input: \"normal_3/sample/add\"\n",
" input: \"normal_3/sample/concat_1\"\n",
" attr {\n",
" key: \"T\"\n",
" value {\n",
" type: DT_FLOAT\n",
" }\n",
" }\n",
" attr {\n",
" key: \"Tshape\"\n",
" value {\n",
" type: DT_INT32\n",
" }\n",
" }\n",
"}\n",
"versions {\n",
" producer: 26\n",
"}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.graph.as_graph_def()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (pymc3)",
"language": "python",
"name": "pymc3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment