Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save izmailovpavel/92f64bae23227a31567119e78e7bc549 to your computer and use it in GitHub Desktop.
Save izmailovpavel/92f64bae23227a31567119e78e7bc549 to your computer and use it in GitHub Desktop.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import tensorflow as tf\n",
"import sys"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import t3f\n",
"from t3f import TensorTrain\n",
"from t3f.ops import *\n",
"import t3f.kronecker as kr\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"A = t3f.get_variable(name='A', initializer=t3f.random_matrix(shape=((2,2,2),(3,3,3)), tt_rank=2))\n",
"B = t3f.get_variable(name='B', initializer=t3f.random_matrix(shape=((2,2,2),(3,3,3)), tt_rank=3))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"TensorShape([Dimension(3), Dimension(2), Dimension(3), Dimension(3)])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"B.tt_cores[1].get_shape()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"TensorShape([Dimension(2), Dimension(2), Dimension(3), Dimension(2)])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A.tt_cores[1].get_shape()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"TensorShape([Dimension(1), Dimension(2), Dimension(2), Dimension(1)])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A.get_tt_ranks()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[2, 5, 5, 2]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[rank_A.value + rank_B.value for rank_A, rank_B in zip(A.get_tt_ranks(), B.get_tt_ranks())]"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"TensorShape([Dimension(1), Dimension(2), Dimension(3), Dimension(2)])"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A.tt_cores[0].get_shape()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[1, 5, 5, 1]"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C_ranks"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[<tf.Tensor 'concat_76:0' shape=(1, 2, 3, 5) dtype=float32>,\n",
" <tf.Tensor 'concat_79:0' shape=(5, 2, 3, 5) dtype=float32>,\n",
" <tf.Tensor 'concat_80:0' shape=(5, 2, 3, 1) dtype=float32>]"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C_cores"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"i_shapes, j_shapes = A.get_raw_shape()\n",
"C_cores = []\n",
"for core_idx in range(A.ndims()):\n",
" core_A = A.tt_cores[core_idx]\n",
" core_B = B.tt_cores[core_idx]\n",
" A_r = A.get_tt_ranks()[core_idx]\n",
" B_r = B.get_tt_ranks()[core_idx]\n",
" A_r_next = A.get_tt_ranks()[core_idx+1]\n",
" B_r_next = B.get_tt_ranks()[core_idx+1]\n",
" \n",
" if core_idx == 0:\n",
" core_C = tf.concat(3, [core_A, core_B])\n",
" elif core_idx == A.ndims()-1:\n",
" core_C = tf.concat(0, [core_A, core_B])\n",
" else:\n",
" core_C_1 = tf.concat(3, [core_A, tf.zeros((A_r, i_shapes[core_idx], j_shapes[core_idx], B_r_next))])\n",
" core_C_2 = tf.concat(3, [tf.zeros((B_r, i_shapes[core_idx], j_shapes[core_idx], A_r_next)), core_B])\n",
" core_C = tf.concat(0, [core_C_1, core_C_2])\n",
" C_cores.append(core_C)\n",
"C_shape = A.get_raw_shape()\n",
"C_ranks = [rank_A.value + rank_B.value for rank_A, rank_B in zip(A.get_tt_ranks(), B.get_tt_ranks())]\n",
"C_ranks[0] = 1\n",
"C_ranks[-1] = 1\n",
"C = t3f.TensorTrain(C_cores, C_shape, C_ranks)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"init_op = tf.global_variables_initializer()"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"sess = tf.InteractiveSession()\n",
"sess.run(init_op)"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1.9425211e-06"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.linalg.norm(sess.run(t3f.ops.full(A))+sess.run(t3f.ops.full(B)) - sess.run(t3f.ops.full(C)) )"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(3, 4, 2)"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(tf.concat(1, [A, tf.zeros((3, 2, 2), dtype=tf.float64)])).shape"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"TensorShape([Dimension(2), Dimension(2), Dimension(2), Dimension(2)])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tf.matrix_diag([A, A]).get_shape()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 0.86851161, 0.92029975],\n",
" [ 0.11437407, 0.45230054]])"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(A)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([[[[ 0.86851161, 0. ],\n",
" [ 0. , 0.92029975]],\n",
"\n",
" [[ 0.11437407, 0. ],\n",
" [ 0. , 0.45230054]]],\n",
"\n",
"\n",
" [[[ 0.86851161, 0. ],\n",
" [ 0. , 0.92029975]],\n",
"\n",
" [[ 0.11437407, 0. ],\n",
" [ 0. , 0.45230054]]]])"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(tf.matrix_diag([A, A]))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sess.run(tf.pad(A, ))"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "TypeError",
"evalue": "'Variable' object does not support item assignment",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-20-6f7d1b0ef3d0>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mA\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: 'Variable' object does not support item assignment"
]
}
],
"source": [
"A[:10, :10] = 1"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'tt_int' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-0e6c631f6602>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtt_int\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdtype\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'tt_int' is not defined"
]
}
],
"source": [
"tt_int.dtype"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"tf.int64_ref"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"var_tt_int.dtype"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 536., 5561., 4221., 672., 6972., 5292.],\n",
" [ 3216., 5695., 4020., 4032., 7140., 5040.],\n",
" [ 3283., 4958., 1809., 4116., 6216., 2268.],\n",
" [ 40., 415., 315., 720., 7470., 5670.],\n",
" [ 240., 425., 300., 4320., 7650., 5400.],\n",
" [ 245., 370., 135., 4410., 6660., 2430.]])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(full(cast(var_tt_int, tf.float64)))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"tf.float32"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tt_vec.dtype"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"tf.float64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cast(tt_vec, tf.float64).dtype"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "UnimplementedError",
"evalue": "Cast float to string is not supported\n\t [[Node: Cast_2 = Cast[DstT=DT_STRING, SrcT=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](random_normal_4/_3)]]\n\nCaused by op 'Cast_2', defined at:\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py\", line 170, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/__main__.py\", line 3, in <module>\n app.launch_new_instance()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/config/application.py\", line 574, in launch_instance\n app.start()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelapp.py\", line 373, in start\n ioloop.IOLoop.instance().start()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/ioloop.py\", line 151, in start\n super(ZMQIOLoop, self).start()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py\", line 840, in start\n handler_func(fd_obj, events)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/stack_context.py\", line 275, in null_wrapper\n return fn(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py\", line 433, in _handle_events\n self._handle_recv()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py\", line 465, in _handle_recv\n self._run_callback(callback, msg)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py\", line 407, in _run_callback\n callback(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/stack_context.py\", line 275, in null_wrapper\n return fn(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py\", line 252, in dispatcher\n return self.dispatch_shell(stream, msg)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py\", line 213, in dispatch_shell\n handler(stream, idents, msg)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py\", line 362, in execute_request\n user_expressions, allow_stdin)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/ipkernel.py\", line 181, in do_execute\n shell.run_cell(code, store_history=store_history, silent=silent)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py\", line 2871, in run_cell\n interactivity=interactivity, compiler=compiler, result=result)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py\", line 2981, in run_ast_nodes\n if self.run_code(code, result):\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py\", line 3035, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"<ipython-input-7-caf5fd33e401>\", line 1, in <module>\n cast(tt_vec, tf.string).eval()\n File \"/Users/IzmailovPavel/Documents/Education/Projects/t3f/t3f/ops.py\", line 571, in cast\n res_cores.append(tf.cast(cores[core_idx], dtype))\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py\", line 674, in cast\n return gen_math_ops.cast(x, base_type, name=name)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/ops/gen_math_ops.py\", line 421, in cast\n result = _op_def_lib.apply_op(\"Cast\", x=x, DstT=DstT, name=name)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py\", line 759, in apply_op\n op_def=op_def)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/ops.py\", line 2240, in create_op\n original_op=self._default_original_op, op_def=op_def)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/ops.py\", line 1128, in __init__\n self._traceback = _extract_stack()\n\nUnimplementedError (see above for traceback): Cast float to string is not supported\n\t [[Node: Cast_2 = Cast[DstT=DT_STRING, SrcT=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](random_normal_4/_3)]]\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mUnimplementedError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_call\u001b[0;34m(self, fn, *args)\u001b[0m\n\u001b[1;32m 1020\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1021\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1022\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOpError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run_fn\u001b[0;34m(session, feed_dict, fetch_list, target_list, options, run_metadata)\u001b[0m\n\u001b[1;32m 1002\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtarget_list\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1003\u001b[0;31m status, run_metadata)\n\u001b[0m\u001b[1;32m 1004\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/contextlib.py\u001b[0m in \u001b[0;36m__exit__\u001b[0;34m(self, type, value, traceback)\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 66\u001b[0;31m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgen\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 67\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/errors_impl.py\u001b[0m in \u001b[0;36mraise_exception_on_not_ok_status\u001b[0;34m()\u001b[0m\n\u001b[1;32m 468\u001b[0m \u001b[0mcompat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_text\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpywrap_tensorflow\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_Message\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatus\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 469\u001b[0;31m pywrap_tensorflow.TF_GetCode(status))\n\u001b[0m\u001b[1;32m 470\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mUnimplementedError\u001b[0m: Cast float to string is not supported\n\t [[Node: Cast_2 = Cast[DstT=DT_STRING, SrcT=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](random_normal_4/_3)]]",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mUnimplementedError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-7-caf5fd33e401>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtt_vec\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0meval\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/Users/IzmailovPavel/Documents/Education/Projects/t3f/t3f/tensor_train.py\u001b[0m in \u001b[0;36meval\u001b[0;34m(self, feed_dict, session)\u001b[0m\n\u001b[1;32m 234\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msession\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 235\u001b[0m \u001b[0msession\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_default_session\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 236\u001b[0;31m \u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtt_cores\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 237\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 238\u001b[0m \u001b[0;31m# TODO: do we need this?\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 764\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 765\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[0;32m--> 766\u001b[0;31m run_metadata_ptr)\n\u001b[0m\u001b[1;32m 767\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 768\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run\u001b[0;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 962\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfinal_fetches\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mfinal_targets\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 963\u001b[0m results = self._do_run(handle, final_targets, final_fetches,\n\u001b[0;32m--> 964\u001b[0;31m feed_dict_string, options, run_metadata)\n\u001b[0m\u001b[1;32m 965\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 966\u001b[0m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_run\u001b[0;34m(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 1012\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhandle\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1013\u001b[0m return self._do_call(_run_fn, self._session, feed_dict, fetch_list,\n\u001b[0;32m-> 1014\u001b[0;31m target_list, options, run_metadata)\n\u001b[0m\u001b[1;32m 1015\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1016\u001b[0m return self._do_call(_prun_fn, self._session, handle, feed_dict,\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_call\u001b[0;34m(self, fn, *args)\u001b[0m\n\u001b[1;32m 1032\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1033\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1034\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode_def\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mop\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1035\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1036\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_extend_graph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mUnimplementedError\u001b[0m: Cast float to string is not supported\n\t [[Node: Cast_2 = Cast[DstT=DT_STRING, SrcT=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](random_normal_4/_3)]]\n\nCaused by op 'Cast_2', defined at:\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py\", line 170, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/__main__.py\", line 3, in <module>\n app.launch_new_instance()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/config/application.py\", line 574, in launch_instance\n app.start()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelapp.py\", line 373, in start\n ioloop.IOLoop.instance().start()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/ioloop.py\", line 151, in start\n super(ZMQIOLoop, self).start()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py\", line 840, in start\n handler_func(fd_obj, events)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/stack_context.py\", line 275, in null_wrapper\n return fn(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py\", line 433, in _handle_events\n self._handle_recv()\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py\", line 465, in _handle_recv\n self._run_callback(callback, msg)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py\", line 407, in _run_callback\n callback(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/stack_context.py\", line 275, in null_wrapper\n return fn(*args, **kwargs)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py\", line 252, in dispatcher\n return self.dispatch_shell(stream, msg)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py\", line 213, in dispatch_shell\n handler(stream, idents, msg)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py\", line 362, in execute_request\n user_expressions, allow_stdin)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/ipkernel.py\", line 181, in do_execute\n shell.run_cell(code, store_history=store_history, silent=silent)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py\", line 2871, in run_cell\n interactivity=interactivity, compiler=compiler, result=result)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py\", line 2981, in run_ast_nodes\n if self.run_code(code, result):\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py\", line 3035, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"<ipython-input-7-caf5fd33e401>\", line 1, in <module>\n cast(tt_vec, tf.string).eval()\n File \"/Users/IzmailovPavel/Documents/Education/Projects/t3f/t3f/ops.py\", line 571, in cast\n res_cores.append(tf.cast(cores[core_idx], dtype))\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py\", line 674, in cast\n return gen_math_ops.cast(x, base_type, name=name)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/ops/gen_math_ops.py\", line 421, in cast\n result = _op_def_lib.apply_op(\"Cast\", x=x, DstT=DstT, name=name)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py\", line 759, in apply_op\n op_def=op_def)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/ops.py\", line 2240, in create_op\n original_op=self._default_original_op, op_def=op_def)\n File \"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/ops.py\", line 1128, in __init__\n self._traceback = _extract_stack()\n\nUnimplementedError (see above for traceback): Cast float to string is not supported\n\t [[Node: Cast_2 = Cast[DstT=DT_STRING, SrcT=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/cpu:0\"](random_normal_4/_3)]]\n"
]
}
],
"source": [
"cast(tt_vec, tf.string).eval()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([[-3.71289062],\n",
" [ 3.62109375],\n",
" [ 0.30029297],\n",
" [ 4.359375 ],\n",
" [-5.01953125],\n",
" [-0.08587646]], dtype=float16)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(full(cast(tt_vec, tf.float16)))"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1.14746094],\n",
" [-1.48242188],\n",
" [ 1.6953125 ],\n",
" [-0.83544922],\n",
" [ 3.5390625 ],\n",
" [-2.29101562]], dtype=float16)"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(full(cast(var_tt_vec, tf.float16)))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 0.76099902, 0.68146479, -1.58427227, -0.98200351, 3.84147072,\n",
" 2.29332018],\n",
" [ 2.11051178, -0.80473089, -0.164331 , 0.83329439, -0.45185885,\n",
" -1.85124576],\n",
" [ 0.88125777, -1.0125407 , -1.02144814, 0.14754419, 2.31327033,\n",
" 0.0363793 ],\n",
" [-1.43848085, -0.81091458, -0.24053942, -0.12553386, -0.98501539,\n",
" -0.47961298],\n",
" [ 0.63257998, 0.60096687, 0.20326269, 0.08108442, 1.16603267,\n",
" 0.26561406],\n",
" [-0.77713645, -0.22840512, -0.11120777, -0.08337884, -0.39124507,\n",
" -0.49609843]], dtype=float32)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(full(cast(var_tt_mat, tf.float32)))"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "TypeError",
"evalue": "DataType int16 for attr 'T' not in list of allowed values: float16, float32, float64, int32, complex64, complex128",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-17-f58fe563396a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtt_vec\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mint16\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/Users/IzmailovPavel/Documents/Education/Projects/t3f/t3f/ops.py\u001b[0m in \u001b[0;36mfull\u001b[0;34m(tt)\u001b[0m\n\u001b[1;32m 99\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mranks\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 100\u001b[0m \u001b[0mcurr_core\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtt_cores\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mranks\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 101\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmatmul\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcurr_core\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 102\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_tt_matrix\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0mraw_shape\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_raw_shape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py\u001b[0m in \u001b[0;36mmatmul\u001b[0;34m(a, b, transpose_a, transpose_b, adjoint_a, adjoint_b, a_is_sparse, b_is_sparse, name)\u001b[0m\n\u001b[1;32m 1727\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1728\u001b[0m return gen_math_ops._mat_mul(\n\u001b[0;32m-> 1729\u001b[0;31m a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)\n\u001b[0m\u001b[1;32m 1730\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1731\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/ops/gen_math_ops.py\u001b[0m in \u001b[0;36m_mat_mul\u001b[0;34m(a, b, transpose_a, transpose_b, name)\u001b[0m\n\u001b[1;32m 1440\u001b[0m \"\"\"\n\u001b[1;32m 1441\u001b[0m result = _op_def_lib.apply_op(\"MatMul\", a=a, b=b, transpose_a=transpose_a,\n\u001b[0;32m-> 1442\u001b[0;31m transpose_b=transpose_b, name=name)\n\u001b[0m\u001b[1;32m 1443\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1444\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py\u001b[0m in \u001b[0;36mapply_op\u001b[0;34m(self, op_type_name, name, **keywords)\u001b[0m\n\u001b[1;32m 580\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mbase_type\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mbase_types\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 581\u001b[0m _SatisfiesTypeConstraint(base_type,\n\u001b[0;32m--> 582\u001b[0;31m _Attr(op_def, input_arg.type_attr))\n\u001b[0m\u001b[1;32m 583\u001b[0m \u001b[0mattrs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0minput_arg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtype_attr\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mattr_value\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 584\u001b[0m \u001b[0minferred_from\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0minput_arg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtype_attr\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0minput_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py\u001b[0m in \u001b[0;36m_SatisfiesTypeConstraint\u001b[0;34m(dtype, attr_def)\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0;34m\"DataType %s for attr '%s' not in list of allowed values: %s\"\u001b[0m \u001b[0;34m%\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 59\u001b[0m (dtypes.as_dtype(dtype).name, attr_def.name,\n\u001b[0;32m---> 60\u001b[0;31m \", \".join(dtypes.as_dtype(x).name for x in allowed_list)))\n\u001b[0m\u001b[1;32m 61\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: DataType int16 for attr 'T' not in list of allowed values: float16, float32, float64, int32, complex64, complex128"
]
}
],
"source": [
"sess.run(full(cast(tt_vec, tf.int16)))"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sess.close()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment